英文:
launch xxx.launch in catkin_ws
问题
为了在 "ws/" 目录中使用 "roslaunch start.launch",您需要执行以下步骤:
-
将您的 "start.launch" 文件移动到 "ws/" 目录中,以便它与您的工作区一起。
-
在 "start.launch" 文件中,确保正确设置所有的节点参数,以便它们能够找到它们所需的配置和资源文件。
-
确保 "ws/" 目录中包含了所有需要的依赖包和资源文件,以便启动文件能够正常运行。
这样,您就可以在 "ws/" 目录中使用 "roslaunch start.launch" 来启动您的节点了。请注意,确保所有节点的参数和资源路径都正确设置,以便它们能够正常运行。
英文:
To start several nodes together, I write a launch file in catkin_ws. The first layer of my ws is: devel build src launch.
In src, I have several pkg, and each of them has a node.
However, I can only use cmd:
roslaunch start.launch
in ws/launch
.
Can someone tell me if I want to use roslaunch start.launch
in ws/
, what I need to do?
I think if I put all nodes in one pkg and there is a launch directory in this pkg, I can "roslaunch" this launch file in workspace.
But it is not convenient to manage my code.
My launch file looks like this:
start.launch
<launch>
<node pkg="rslidar_sdk" name="rslidar_sdk_node" type="rslidar_sdk_node" output="screen">
<param name="config_path" value=""/>
</node>
<node pkg="cam_node" name="cam_node" type="cam_node" output="screen">
<param name="config_path" value=""/>
</node>
<node pkg="imu_node" name="imu_node" type="imu_node" output="screen">
<param name="config_path" value=""/>
</node>
<node pkg="lidarconv" name="lidarconv_node" type="lidarconv_node" output="screen">
<param name="config_path" value=""/>
</node>
<!-- rosrun rs_to_velodyne rs_to_velodyne XYZIRT XYZIRT -->
</launch>
答案1
得分: 1
在ROS中,创建自定义的启动文件包非常常见,即包含一个仅包含.launch文件的launch文件夹,并在CMakeLists.txt文件中列出所有依赖项。安装此包还会安装启动文件所需的依赖项。
项目结构可能如下所示:
catkin_ws/
devel/
build/
src/
my_launch_pkg/
launch/
start.launch
CMakeLists.txt
这样,您只需在工作空间中运行以下命令来激活您的工作空间:
cd catkin_ws && source devel/setup.bash
然后可以从任何位置启动您的启动文件:
roslaunch my_launch_pkg start.launch
英文:
In ROS
, it is very common to create your own custom package of launch files, i.e. containing just a launch
folder containing just .launch
files and with all its dependencies listed in the CMakeLists.txt
file. Installing this package will also install the dependencies needed to start its launch files.
The project structure may look like this:
catkin_ws/
devel/
build/
src/
my_launch_pkg/
launch/
start.launch
CMakeLists.txt
This way you just need to source your worskspace:
cd catkin_ws && source devel/setup.bash
to launch your launch file from anywhere:
roslaunch my_launch_pkg start.launch
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论