UP | HOME

ROS Tf Activity

Demonstration

# create the workspace and clone the repository and get set up
mkdir -p ws/src
cd ws/src
git clone https://github.com/m-elwin/me495_tf.git -b ros2
cd ..
colcon build --symlink-install
source install/setup.bash

# run the broadcaster
ros2 run me495_tf in_out &

# list the topics, notice the /tf and /tf_static
ros2 topic list

# use rqt_tf_tree to see the tf_tree
ros2 run tf2_tools view_frames

# Also can use rqt_tf_tree. Need to install the rqt_tf_tree package
ros2 run rqt_tf_tree rqt_tf_tree

# use tf_echo to see translation between frames. C-c to quit
ros2 run tf2_ros tf2_echo right left

# run in rviz, set everything up correctly
rviz2

# run in rviz, using my rviz config
rviz2 -d src/me495_tf/config/view.rviz

# run the tracker node
ros2 run me495_tf tracker

Exercises

  1. Walk through the demonstration above, manually setting up rviz to display the transformations
  2. Modify in_out so that the base frame is dynamic, that is, it is broadcast from the regular broadcaster and not the static broadcaster.
  3. Make the base frame rotate about it's own z axis at a fixed rate, and visualize in rviz
  4. Add another frame called up that is a child of base. Have this frame move in sync with left and right but perpendicular to them
  5. Modify tracker so that when the distance between up and left is above a threshold, it prints a message

Resources

Author: Matthew Elwin.