How to include a launch file from another node into a current project
I am launching a specific node called roslaunch lidar_deck lidar_deck_rosbag.launch
I created another node called tugInterface, and that also has a launch
file called roslaunch tugInterface tuginterface.launch
. I circled it in red below.
The problem:
I am trying to include the launch
file called roslaunch tugInterface tuginterface.launch
into the roslaunch lidar_deck lidar_deck_rosbag.launch
but with no success.
Below the lidar_deck lidar_deck_rosbag.launch:
<?xml version="1.0" ?>
<launch>
<param name="/use_sim_time" value="false"/>
<node pkg="tf" type="static_transform_publisher" name="segment_frame" args="0 0 0 0 0 0 1 base_footprint segment_frame 10"/>
<node pkg="lidar_boat_detection" type="process_lidar" name="process_lidar" />
<node pkg="tf" type="static_transform_publisher" name="velodyne_bag_tranform" args="0 0 0 0 0 0 1 base_footprint velodyne 10"/>
<!-- RViz -->
<arg name="rviz" default="true"/>
<node if="$(arg rviz)" pkg="rviz" type="rviz" name="$(anon rviz)" respawn="false" args="-d $(find lidar_deck)/rviz/lidar_deck_rosbag.rviz" />
</launch>
I tried also the following version but that also did not work:
<?xml version="1.0" ?>
<launch>
<param name="/use_sim_time" value="false"/>
<node pkg="tf" type="static_transform_publisher" name="segment_frame" args="0 0 0 0 0 0 1 base_footprint segment_frame 10"/>
<node pkg="lidar_boat_detection" type="process_lidar" name="process_lidar" />
<node pkg="tf" type="static_transform_publisher" name="velodyne_bag_tranform" args="0 0 0 0 0 0 1 base_footprint velodyne 10"/>
<include file="$(find tugInterface)/launch/tuginterface.launch" />
<node pkg="tugInterface" type="tuginterface" name ="tuginterface" />
<!-- RViz -->
<arg name="rviz" default="true"/>
<node if="$(arg rviz)" pkg="rviz" type="rviz" name="$(anon rviz)" respawn="false" args="-d $(find lidar_deck)/rviz/lidar_deck_rosbag.rviz" />
</launch>
In addition to that I also tried to add <rosparam command="load" file="$(find tugInterface)/tuginterface.launch" />
to the launch
file but still didn't work.
How can I solve that? Thanks for pointing to the right direction.
Have you sourced both workspaces? I think otherwise it will not find the other node. Oh sorry, your headline is a little bit confusing, because they are all in the same workspace/project.
Hello and thanks for reading the question. Yes the workspace is outsourced. I did it in the
.basrh
file so that I didn't have to worry.