Create a launch file inside the package if one does not exist already.
cd robotics/src/lab_1_tfmkdir launchcreate a launch file inside it called 'broadcaster_demo.launch'
code broadcaster_demo.launchcopy the following lines into it
<launch>
<!-- Turtlesim Node-->
<node pkg="turtlesim" type="turtlesim_node" name="sim"/>
<node pkg="turtlesim" type="turtle_teleop_key" name="teleop" output="screen"/>
<node name="turtle1_tf_broadcaster" pkg="lab_1_tf" type="broadcaster.py" respawn="false" output="screen" >
<param name="turtle" type="string" value="turtle1" />
</node>
<node name="turtle2_tf_broadcaster" pkg="lab_1_tf" type="broadcaster.py" respawn="false" output="screen" >
<param name="turtle" type="string" value="turtle2" />
</node>
</launch>Modify CMakeLists.txt
catkin_install_python(PROGRAMS scripts/broadcaster.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)Build the code
Go to root of the workspace
cd robotics/
and run either of
catkin buildor
catkin_makeMove to the root of the ROS workspace and launch the program
source devel/setup.bashroslaunch lab_1_tf broadcaster_demo.launchOn a seperate terminal, run
rosrun tf tf_echo /world /turtle1to check the tf broadcast.
Create a launch file inside the package if one does not exist already.
cd robotics/src/lab_1_tfmkdir launchcreate a launch file inside it called 'broadcaster_listener_demo.launch'
code broadcaster_listener_demo.launchcopy the following lines into it
<launch>
<!-- Turtlesim Node-->
<node pkg="turtlesim" type="turtlesim_node" name="sim"/>
<node pkg="turtlesim" type="turtle_teleop_key" name="teleop" output="screen"/>
<node name="turtle1_tf_broadcaster" pkg="lab_1_tf" type="broadcaster.py" respawn="false" output="screen" >
<param name="turtle" type="string" value="turtle1" />
</node>
<node name="turtle2_tf_broadcaster" pkg="lab_1_tf" type="broadcaster.py" respawn="false" output="screen" >
<param name="turtle" type="string" value="turtle2" />
</node>
<node pkg="lab_1_tf" type="listener.py" name="listener" />
</launch>Modify CMakeLists.txt
catkin_install_python(PROGRAMS scripts/broadcaster.py scripts/listener.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)Build the code
Go to root of the workspace
cd robotics/
and run either of
catkin buildor
catkin_makesource devel/setup.bashMove to the root of the ROS workspace and launch the program
roslaunch lab_1_tf broadcaster_listener_demo.launchCreate a launch file inside the package if one does not exist already.
cd robotics/src/lab_1_tfmkdir launchcreate a launch file inside it called 'broadcaster_listener_static_demo.launch'
code broadcaster_listener_static_demo.launchcopy the following lines into it
<launch>
<!-- Turtlesim Node-->
<node pkg="turtlesim" type="turtlesim_node" name="sim"/>
<node pkg="turtlesim" type="turtle_teleop_key" name="teleop" output="screen"/>
<node name="turtle1_tf_broadcaster" pkg="lab_1_tf" type="broadcaster.py" respawn="false" output="screen" >
<param name="turtle" type="string" value="turtle1" />
</node>
<node name="turtle2_tf_broadcaster" pkg="lab_1_tf" type="broadcaster.py" respawn="false" output="screen" >
<param name="turtle" type="string" value="turtle2" />
</node>
<node pkg="lab_1_tf" type="listener.py" name="listener" />
<node pkg="lab_1_tf" type="static_frame.py"
name="broadcaster_fixed" />
</launch>Modify CMakeLists.txt
catkin_install_python(PROGRAMS scripts/broadcaster.py scripts/listener.py scripts/static_frame.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)Build the code
Go to root of the workspace
cd robotics/
and run either of
catkin buildor
catkin_makeMove to the root of the ROS workspace and launch the program
source devel/setup.bashroslaunch lab_1_tf broadcaster_listener_static_demo.launchCreate a launch file inside the package if one does not exist already.
cd robotics/src/lab_1_tfmkdir launchcreate a launch file inside it called 'broadcaster_listener_dynamic_demo.launch'
code broadcaster_listener_dynamic_demo.launchcopy the following lines into it
<launch>
<!-- Turtlesim Node-->
<node pkg="turtlesim" type="turtlesim_node" name="sim"/>
<node pkg="turtlesim" type="turtle_teleop_key" name="teleop" output="screen"/>
<node name="turtle1_tf_broadcaster" pkg="lab_1_tf" type="broadcaster.py" respawn="false" output="screen" >
<param name="turtle" type="string" value="turtle1" />
</node>
<node name="turtle2_tf_broadcaster" pkg="lab_1_tf" type="broadcaster.py" respawn="false" output="screen" >
<param name="turtle" type="string" value="turtle2" />
</node>
<node pkg="lab_1_tf" type="listener.py" name="listener" />
<node pkg="lab_1_tf" type="dynamic_frame.py" name="broadcaster_dynamic" />
</launch>Modify CMakeLists.txt
catkin_install_python(PROGRAMS scripts/broadcaster.py scripts/listener.py scripts/dynamic_frame.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)Build the code
Go to root of the workspace
cd robotics/
and run either of
catkin buildor
catkin_makeMove to the root of the ROS workspace and launch the program
source devel/setup.bashroslaunch lab_1_tf broadcaster_listener_dynamic_demo.launch