Difference between revisions of "Setting up the ROS Transforms"
(→Navigation Stack Test) |
(→Display Complete Tree) |
||
(20 intermediate revisions by the same user not shown) | |||
Line 7: | Line 7: | ||
* [http://answers.ros.org/question/44639/how-to-broadcast-a-transform-between-map-and-odom/ Transform Map to Odom] | * [http://answers.ros.org/question/44639/how-to-broadcast-a-transform-between-map-and-odom/ Transform Map to Odom] | ||
* [http://answers.ros.org/question/104111/how-to-publish-transform-from-odom-to-base_link/ Transform Odom to Base] | * [http://answers.ros.org/question/104111/how-to-publish-transform-from-odom-to-base_link/ Transform Odom to Base] | ||
− | * [ | + | * [https://u.cs.biu.ac.il/~yehoshr1/89-685/ROS_Lecture6.pptx Yehoshr's Lecture 6] |
= Base_link to Laser = | = Base_link to Laser = | ||
Line 23: | Line 23: | ||
x = 0.004 + 0.000 + 0.192 + 0.006 = 0.202 | x = 0.004 + 0.000 + 0.192 + 0.006 = 0.202 | ||
z = 0.021 + 0.018 + 0.011 + 0.061 = 0.111 | z = 0.021 + 0.018 + 0.011 + 0.061 = 0.111 | ||
+ | |||
+ | This neato_laser reference needs to be the same as the reference in costmap_common_params.yaml. See [[Navigation Tuning#laser_link]]. | ||
+ | |||
+ | The static_transform_publisher arguments are defined at [http://wiki.ros.org/tf#static_transform_publisher ROS TF]. Offset is in linear meters and angular quaternions. | ||
+ | |||
+ | static_transform_publisher x y z qx qy qz qw frame_id child_frame_id period_in_ms | ||
= Odom to Base_link = | = Odom to Base_link = | ||
Line 40: | Line 46: | ||
= Navigation Stack Test = | = Navigation Stack Test = | ||
+ | |||
+ | == Setup == | ||
Terminal 1 | Terminal 1 | ||
Line 48: | Line 56: | ||
roslaunch floor_hugger nav.launch | roslaunch floor_hugger nav.launch | ||
+ | |||
+ | == Display Tree == | ||
Terminal 3 | Terminal 3 | ||
Line 54: | Line 64: | ||
evince frames.pdf | evince frames.pdf | ||
− | |||
− | |||
[[Image:TF_Zoom_170415.png|800px]] | [[Image:TF_Zoom_170415.png|800px]] | ||
+ | |||
+ | == Exploration Tools == | ||
+ | |||
+ | === monitor === | ||
+ | |||
+ | Monitor the transforms between frames. See complete tree below. See [[URDF Representation of Floor Hugger]] for the robot transform definitions. | ||
+ | |||
+ | rosrun tf tf_monitor | ||
+ | All Broadcasters: | ||
+ | Node: unknown_publisher 96.979 Hz, Average Delay: -0.260119 Max Delay: 0.102549 | ||
+ | |||
+ | RESULTS: for all Frames | ||
+ | |||
+ | Frames: | ||
+ | Frame: base published by unknown_publisher Average Delay: -0.474372 Max Delay: 0 | ||
+ | Frame: base_link published by unknown_publisher Average Delay: 0.000405951 Max Delay: 0.00156847 | ||
+ | Frame: battery_layer published by unknown_publisher Average Delay: -0.474377 Max Delay: 0 | ||
+ | Frame: camera_layer published by unknown_publisher Average Delay: -0.474374 Max Delay: 0 | ||
+ | Frame: compute_layer published by unknown_publisher Average Delay: -0.474374 Max Delay: 0 | ||
+ | Frame: computer published by unknown_publisher Average Delay: -0.474373 Max Delay: 0 | ||
+ | Frame: control_layer published by unknown_publisher Average Delay: -0.474377 Max Delay: 0 | ||
+ | Frame: extended_base published by unknown_publisher Average Delay: -0.474378 Max Delay: 0 | ||
+ | Frame: laser_layer published by unknown_publisher Average Delay: -0.474373 Max Delay: 0 | ||
+ | Frame: laser_sensor published by unknown_publisher Average Delay: -0.474372 Max Delay: 0 | ||
+ | Frame: left_wheel published by unknown_publisher Average Delay: -0.474379 Max Delay: 0 | ||
+ | Frame: neato_laser published by unknown_publisher Average Delay: -0.0996256 Max Delay: 0 | ||
+ | Frame: odom published by unknown_publisher Average Delay: -0.0327469 Max Delay: 0.104149 | ||
+ | Frame: right_wheel published by unknown_publisher Average Delay: -0.474377 Max Delay: 0 | ||
+ | Frame: usb_hub published by unknown_publisher Average Delay: -0.474375 Max Delay: 0 | ||
+ | Frame: webcam_sensor published by unknown_publisher Average Delay: -0.474375 Max Delay: 0 | ||
+ | |||
+ | === map to odom transform === | ||
+ | |||
+ | See tf_map.launch script above to confirm the z value below | ||
+ | |||
+ | rosrun tf tf_echo map odom | ||
+ | At time 1492259778.541 | ||
+ | - Translation: [0.000, 0.000, 0.045] | ||
+ | - Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000] | ||
+ | in RPY (radian) [0.000, -0.000, 0.000] | ||
+ | in RPY (degree) [0.000, -0.000, 0.000] | ||
+ | |||
+ | === odom to base_link === | ||
+ | |||
+ | The odom to base_link transform in all zeros at startup. | ||
+ | |||
+ | rosrun tf tf_echo odom base_link | ||
+ | At time 1492260129.428 | ||
+ | - Translation: [0.000, 0.000, 0.000] | ||
+ | - Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000] | ||
+ | in RPY (radian) [0.000, -0.000, 0.000] | ||
+ | in RPY (degree) [0.000, -0.000, 0.000] | ||
+ | |||
+ | === odom to base_link after move === | ||
+ | |||
+ | The odom to base_link transform changes after the robot moves. | ||
+ | |||
+ | rostopic pub -1 /cmd_vel geometry_msgs/Twist '[5,0,0]' '[0,0,0]' | ||
+ | |||
+ | rosrun tf tf_echo odom base_link | ||
+ | At time 1492261296.158 | ||
+ | - Translation: [0.365, -0.062, 0.000] | ||
+ | - Rotation: in Quaternion [0.000, 0.000, -0.066, 0.998] | ||
+ | in RPY (radian) [0.000, 0.000, -0.132] | ||
+ | in RPY (degree) [0.000, 0.000, -7.546] | ||
+ | |||
+ | It reflects the same values as odometry. | ||
+ | |||
+ | rostopic echo odom | ||
+ | ... | ||
+ | pose: | ||
+ | pose: | ||
+ | position: | ||
+ | x: 0.364562615458 | ||
+ | y: -0.0618304999521 | ||
+ | z: 0.0 | ||
+ | orientation: | ||
+ | x: 0.0 | ||
+ | y: 0.0 | ||
+ | z: -0.0658021751817 | ||
+ | w: 0.997832688251 | ||
+ | ... | ||
+ | |||
+ | === base_link to neato_laser === | ||
+ | |||
+ | See tf_laser.launch for how these were derived. | ||
+ | |||
+ | rosrun tf tf_echo base_link neato_laser | ||
+ | At time 1492260448.546 | ||
+ | - Translation: [0.202, 0.000, 0.111] | ||
+ | - Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000] | ||
+ | in RPY (radian) [0.000, -0.000, 0.000] | ||
+ | in RPY (degree) [0.000, -0.000, 0.000] | ||
+ | |||
+ | === base_link to laser_sensor === | ||
+ | |||
+ | This is derived from the URDF and is the same as the base_link to the neato_laser. So I wonder whether the tf_laser.launch script is redundant. They fortunately give the same results. | ||
+ | |||
+ | rosrun tf tf_echo base_link laser_sensor | ||
+ | At time 1492260747.860 | ||
+ | - Translation: [0.202, 0.000, 0.111] | ||
+ | - Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000] | ||
+ | in RPY (radian) [0.000, -0.000, 0.000] | ||
+ | in RPY (degree) [0.000, -0.000, 0.000] | ||
+ | |||
+ | == Display Complete Tree == | ||
+ | |||
+ | See [[URDF Representation of Floor Hugger]]. It is pulled in from the rviz_mapping.launch script. Notice that its transforms are published by the robot_state_publisher. See robot_state_publisher launch below and the floor_hugger.urdf parameter definition below. | ||
+ | |||
+ | cat rviz_mapping.launch | ||
+ | <launch> | ||
+ | <arg name="gui" default="False" /> | ||
+ | <param name="robot_description" textfile="$(find floor_hugger)/model/floor_hugger.urdf" /> | ||
+ | <param name="use_gui" value="$(arg gui)"/> | ||
+ | <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" /> | ||
+ | <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" /> | ||
+ | <node name="rviz" pkg="rviz" type="rviz" args="-d $(find floor_hugger)/config/active_mapping.rviz" required="true" /> | ||
+ | </launch> | ||
+ | |||
+ | [[File:Frames.pdf|800px]] | ||
= Initial Test = | = Initial Test = |
Latest revision as of 10:14, 15 April 2017
Contents
References
- ROS tf
- Coordinate Frames
- Tutorials
- TF Setup
- Transform Map to Odom
- Transform Odom to Base
- Yehoshr's Lecture 6
Base_link to Laser
cat tf_laser.launch
<launch> <node pkg="tf" type="static_transform_publisher" name="base_to_laser" args="0.202 0 0.111 0 0 0 1 base_link neato_laser 100" /> </launch>
See floor_hugger.urdf URDF Representation of Floor Hugger
base_link => extended_base => Laser_layer => laser_sensor x = 0.004 + 0.000 + 0.192 + 0.006 = 0.202 z = 0.021 + 0.018 + 0.011 + 0.061 = 0.111
This neato_laser reference needs to be the same as the reference in costmap_common_params.yaml. See Navigation Tuning#laser_link.
The static_transform_publisher arguments are defined at ROS TF. Offset is in linear meters and angular quaternions.
static_transform_publisher x y z qx qy qz qw frame_id child_frame_id period_in_ms
Odom to Base_link
TBD: Where is this specified? In Odometry?
Map to Odom
cat tf_map.launch
<launch> <node pkg="tf" type="static_transform_publisher" name="odom_to_map" args="0 0 0.045 0 0 0 1.0 map odom 100" /> </launch>
Wheel radius is 45 mm. Calibrate_Phidgets_Odometry#From_Specs
Setup
Terminal 1
roscore
Terminal 2
roslaunch floor_hugger nav.launch
Display Tree
Terminal 3
rosrun tf view_frames evince frames.pdf
Exploration Tools
monitor
Monitor the transforms between frames. See complete tree below. See URDF Representation of Floor Hugger for the robot transform definitions.
rosrun tf tf_monitor All Broadcasters: Node: unknown_publisher 96.979 Hz, Average Delay: -0.260119 Max Delay: 0.102549 RESULTS: for all Frames Frames: Frame: base published by unknown_publisher Average Delay: -0.474372 Max Delay: 0 Frame: base_link published by unknown_publisher Average Delay: 0.000405951 Max Delay: 0.00156847 Frame: battery_layer published by unknown_publisher Average Delay: -0.474377 Max Delay: 0 Frame: camera_layer published by unknown_publisher Average Delay: -0.474374 Max Delay: 0 Frame: compute_layer published by unknown_publisher Average Delay: -0.474374 Max Delay: 0 Frame: computer published by unknown_publisher Average Delay: -0.474373 Max Delay: 0 Frame: control_layer published by unknown_publisher Average Delay: -0.474377 Max Delay: 0 Frame: extended_base published by unknown_publisher Average Delay: -0.474378 Max Delay: 0 Frame: laser_layer published by unknown_publisher Average Delay: -0.474373 Max Delay: 0 Frame: laser_sensor published by unknown_publisher Average Delay: -0.474372 Max Delay: 0 Frame: left_wheel published by unknown_publisher Average Delay: -0.474379 Max Delay: 0 Frame: neato_laser published by unknown_publisher Average Delay: -0.0996256 Max Delay: 0 Frame: odom published by unknown_publisher Average Delay: -0.0327469 Max Delay: 0.104149 Frame: right_wheel published by unknown_publisher Average Delay: -0.474377 Max Delay: 0 Frame: usb_hub published by unknown_publisher Average Delay: -0.474375 Max Delay: 0 Frame: webcam_sensor published by unknown_publisher Average Delay: -0.474375 Max Delay: 0
map to odom transform
See tf_map.launch script above to confirm the z value below
rosrun tf tf_echo map odom At time 1492259778.541 - Translation: [0.000, 0.000, 0.045] - Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000] in RPY (radian) [0.000, -0.000, 0.000] in RPY (degree) [0.000, -0.000, 0.000]
odom to base_link
The odom to base_link transform in all zeros at startup.
rosrun tf tf_echo odom base_link At time 1492260129.428 - Translation: [0.000, 0.000, 0.000] - Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000] in RPY (radian) [0.000, -0.000, 0.000] in RPY (degree) [0.000, -0.000, 0.000]
odom to base_link after move
The odom to base_link transform changes after the robot moves.
rostopic pub -1 /cmd_vel geometry_msgs/Twist '[5,0,0]' '[0,0,0]' rosrun tf tf_echo odom base_link At time 1492261296.158 - Translation: [0.365, -0.062, 0.000] - Rotation: in Quaternion [0.000, 0.000, -0.066, 0.998] in RPY (radian) [0.000, 0.000, -0.132] in RPY (degree) [0.000, 0.000, -7.546]
It reflects the same values as odometry.
rostopic echo odom ... pose: pose: position: x: 0.364562615458 y: -0.0618304999521 z: 0.0 orientation: x: 0.0 y: 0.0 z: -0.0658021751817 w: 0.997832688251 ...
base_link to neato_laser
See tf_laser.launch for how these were derived.
rosrun tf tf_echo base_link neato_laser At time 1492260448.546 - Translation: [0.202, 0.000, 0.111] - Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000] in RPY (radian) [0.000, -0.000, 0.000] in RPY (degree) [0.000, -0.000, 0.000]
base_link to laser_sensor
This is derived from the URDF and is the same as the base_link to the neato_laser. So I wonder whether the tf_laser.launch script is redundant. They fortunately give the same results.
rosrun tf tf_echo base_link laser_sensor At time 1492260747.860 - Translation: [0.202, 0.000, 0.111] - Rotation: in Quaternion [0.000, 0.000, 0.000, 1.000] in RPY (radian) [0.000, -0.000, 0.000] in RPY (degree) [0.000, -0.000, 0.000]
Display Complete Tree
See URDF Representation of Floor Hugger. It is pulled in from the rviz_mapping.launch script. Notice that its transforms are published by the robot_state_publisher. See robot_state_publisher launch below and the floor_hugger.urdf parameter definition below.
cat rviz_mapping.launch <launch> <arg name="gui" default="False" /> <param name="robot_description" textfile="$(find floor_hugger)/model/floor_hugger.urdf" /> <param name="use_gui" value="$(arg gui)"/> <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" /> <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" /> <node name="rviz" pkg="rviz" type="rviz" args="-d $(find floor_hugger)/config/active_mapping.rviz" required="true" /> </launch>
Initial Test
Terminal 1
roscore
Terminal 2
Set sim time to false in case it was set to true during gmapping.
rosparam set use_sim_time false roslaunch floor_hugger odometry.launch
Terminal 3
rosrun xv_11_laser_driver neato_laser_publisher _port:=/dev/ttyUSB0 _firmware_version:=2
Terminal 4
roslaunch floor_hugger tf_laser.launch
Terminal 5
roslaunch floor_hugger tf_map.launch
Terminal 6
rosrun tf view_frames evince frames.pdf
Result is a file named frames.pdf.