Skip to content

Latest commit

 

History

History
351 lines (242 loc) · 6.19 KB

File metadata and controls

351 lines (242 loc) · 6.19 KB

Running the package

Creating launch file for Broadcaster

Create a launch file inside the package if one does not exist already.

cd robotics/src/lab_1_tf
mkdir launch

create a launch file inside it called 'broadcaster_demo.launch'

code broadcaster_demo.launch

copy 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>

Building the broadcaster

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 build

or

catkin_make

Running the broadcasters

Move to the root of the ROS workspace and launch the program

source devel/setup.bash
roslaunch lab_1_tf broadcaster_demo.launch

On a seperate terminal, run

rosrun tf tf_echo /world /turtle1

to check the tf broadcast.



Creating launch file for Listener

Create a launch file inside the package if one does not exist already.

cd robotics/src/lab_1_tf
mkdir launch

create a launch file inside it called 'broadcaster_listener_demo.launch'

code broadcaster_listener_demo.launch

copy 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>

Building the listener

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 build

or

catkin_make

Running the listener

source devel/setup.bash

Move to the root of the ROS workspace and launch the program

roslaunch lab_1_tf broadcaster_listener_demo.launch

Creating launch file for Static Frame

Create a launch file inside the package if one does not exist already.

cd robotics/src/lab_1_tf
mkdir launch

create a launch file inside it called 'broadcaster_listener_static_demo.launch'

code broadcaster_listener_static_demo.launch

copy 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>

Building the static frame

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 build

or

catkin_make

Running the static frame

Move to the root of the ROS workspace and launch the program

source devel/setup.bash
roslaunch lab_1_tf broadcaster_listener_static_demo.launch


Creating launch file for dynamic frame

Create a launch file inside the package if one does not exist already.

cd robotics/src/lab_1_tf
mkdir launch

create a launch file inside it called 'broadcaster_listener_dynamic_demo.launch'

code broadcaster_listener_dynamic_demo.launch

copy 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>

Building the dynamic frame

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 build

or

catkin_make

Running the dynamic frame

Move to the root of the ROS workspace and launch the program

source devel/setup.bash
roslaunch lab_1_tf broadcaster_listener_dynamic_demo.launch

<< Back to Main menu