|Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.|
Enabling the Default Frames PackageDescription: Shows how to enable the default frames package containing the tools Freeze Frame, and Create Origin.
Tutorial Level: INTERMEDIATE
RCommander comes by default with a few utilities that allow users to operate on robot control frames. In your RCommander initialization file (my_rcommander.py in the previous tutorials, the essential steps are to instantiate tf.TransformListener then add the group default_frame to the call to run_rcommander. We illustrate this, and a few other bookkeeping steps (import statements, etc) below:
1 import roslib; roslib.load_manifest('my_rcommander') 2 import rcommander.rcommander as rc 3 import rospy 4 import tf 5 6 class MyRobotClass: 7 def __init__(self): 8 self.some_resource = "hello" 9 10 rospy.init_node('my_rcommander', anonymous=True) 11 robot = MyRobotClass() 12 tf = tf.TransformListener() 13 rc.run_rcommander(['default', 'default_frame', 'myrobot'], robot, tf)
The frames package need a TF broadcast server (included with RCommander) to be launched as well so you'll need to create a new launch file with the content:
<launch> <node pkg="my_rcommander" type="my_rcommander.py" output="screen" name="my_rcommander"/> <node pkg="tf_broadcast_server" type="tf_broadcast_server.py" output="screen" name="rcommander_tf_broadcast"/> </launch>
The TF broadcast server's main function is to periodically broadcast TF frames sent to it by tools in RCommander (INSERT LINK TO DOCUMENTATION HERE) Running this should create launch the RCommander window below with the new tools: Freeze Frame, and Create Origin.