0
$\begingroup$

Rosanswers logo

I had pr2 robot running in gazebo.

I want to get the pose of r_wrist_roll_link with respect to base_link but got an error here.

$ rosrun tf tf_echo base_link r_wrist_roll_link
Failure at 146370.940000000
Exception thrown:Frame id /base_link does not exist! When trying to transform between   /r_wrist_roll_link and /base_link.
The current list of frames is:

At time 146371.172
- Translation: [0.590, -0.360, 0.930]
- Rotation: in Quaternion [0.651, -0.211, 0.381, 0.621]
        in RPY [1.475, -0.860, 0.310]
At time 146371.202
- Translation: [0.590, -0.360, 0.930]
- Rotation: in Quaternion [0.652, -0.210, 0.381, 0.621]
        in RPY [1.475, -0.860, 0.310]

Any idea what's the problem?

[UPDATE] It seems that it just can't find tf from base_link to r_wrist_roll_link at first, but then it gives the correct transform. I wrote some code to check the transform,

// get the position of r_wrist_roll_link
ros::Duration(0.1).sleep(); 
tf::StampedTransform transform;
try{
  listener.lookupTransform("base_link", "r_wrist_roll_link",
                           ros::Time(0), transform);
}   
catch (tf::TransformException ex){
  ROS_ERROR("%s",ex.what());
}   

It works fine but if I comment out the line ros::Duration(0.1).sleep(), it gives same error as in tf_echo. Maybe it's because transform listener needs some time to get some frames. Not sure if that's the problem of tf_echo.

Here is the output of roswtf and view_frames shows both base_link and r_wrist_roll_link.

Loaded plugin tf.tfwtf
Package: supercontroller_keyboard
================================================================================
Static checks summary:

Found 1 warning(s).
Warnings are things that may be just fine, but are sometimes at fault

WARNING The following packages have msg/srv-related cflags exports that are no longer necessary
    <export>
        <cpp cflags="..."
    </export>:
 * motion_planning_msgs: -I${prefix}/msg/cpp -I${prefix}/srv/cpp
 * kinematics_msgs: -I${prefix}/msg/cpp -I${prefix}/srv/cpp
 * geometric_shapes_msgs: -I${prefix}/msg/cpp
 * mapping_msgs: -I${prefix}/msg/cpp


================================================================================
Beginning tests of your ROS graph. These may take awhile...
analyzing graph...
... done analyzing graph
running graph rules...
... done running graph rules
running tf checks, this will take a second...
... tf checks complete

Online checks summary:

Found 3 warning(s).
Warnings are things that may be just fine, but are sometimes at fault

WARNING The following node subscriptions are unconnected:
 * /head_traj_controller/point_head_action:
   * /head_traj_controller/point_head_action/cancel
   * /head_traj_controller/point_head_action/goal
 * /l_gripper_controller/gripper_action_node:
   * /l_gripper_controller/gripper_action/cancel
   * /l_gripper_controller/gripper_action/goal
 * /gazebo:
   * /head_traj_controller/joint_trajectory_action/cancel
   * /r_arm_controller/joint_trajectory_action/goal
   * /gazebo/set_link_state
   * /l_arm_controller/command
   * /projector_wg6802418_controller/image
   * /set_hfov
   * /torso_controller/joint_trajectory_action/cancel
   * /torso_controller/joint_trajectory_action/goal
   * /plugged_in    ================================================================================
Beginning tests of your ROS graph. These may take awhile...
analyzing graph...
... done analyzing graph
running graph rules...
... done running graph rules
running tf checks, this will take a second...
... tf checks complete

Online checks summary:

Found 3 warning(s).
Warnings are things that may be just fine, but are sometimes at fault

WARNING The following node subscriptions are unconnected:
 * /head_traj_controller/point_head_action:
   * /head_traj_controller/point_head_action/cancel
   * /head_traj_controller/point_head_action/goal
 * /l_gripper_controller/gripper_action_node:
   * /l_gripper_controller/gripper_action/cancel
   * /l_gripper_controller/gripper_action/goal
 * /gazebo:
   * /head_traj_controller/joint_trajectory_action/cancel
   * /r_arm_controller/joint_trajectory_action/goal
   * /gazebo/set_link_state
   * /l_arm_controller/command
   * /projector_wg6802418_controller/image
   * /set_hfov
   * /torso_controller/joint_trajectory_action/cancel
   * /torso_controller/joint_trajectory_action/goal
   * /plugged_in
   * /l_arm_controller/joint_trajectory_action/goal
   * /torso_controller/follow_joint_trajectory/goal
   * /head_traj_controller/follow_joint_trajectory/cancel
   * /base_controller/command
   * /head_traj_controller/joint_trajectory_action/goal
   * /r_arm_controller/joint_trajectory_action/cancel
   * /torso_controller/follow_joint_trajectory/cancel
   * /l_arm_controller/joint_trajectory_action/cancel
   * /r_arm_controller/follow_joint_trajectory/cancel
   * /l_arm_controller/follow_joint_trajectory/goal
   * /head_traj_controller/follow_joint_trajectory/goal
   * /r_arm_controller/follow_joint_trajectory/goal
   * /r_arm_controller/command
   * /gazebo/set_model_state
   * /set_update_rate
   * /laser_tilt_controller/set_periodic_cmd
   * /laser_tilt_controller/set_traj_cmd
   * /l_arm_controller/follow_joint_trajectory/cancel
 * /torso_controller/position_joint_action_node:
   * /torso_controller/position_joint_action/goal
   * /torso_controller/position_joint_action/cancel
 * /pr2_dashboard_aggregator:
   * /pr2_etherCAT/motors_halted
   * /ddwrt/accesspoint
   * /power_board/state
 * /r_gripper_controller/gripper_action_node:
   * /r_gripper_controller/gripper_action/goal
   * /r_gripper_controller/gripper_action/cancel
 * /rviz_1312398084466095825:
   * /visualization_marker_array
   * /visualization_marker
 * /tf2_buffer_server:
   * /tf2_buffer_server/goal
   * /tf_static
   * /tf2_buffer_server/cancel

WARNING The following nodes are unexpectedly connected:
 * /torso_controller/position_joint_action_node->/rosout (/rosout)
 * /rviz_1312398084466095825->/rosout (/rosout)
 * /pr2_right_arm_kinematics->/rosout (/rosout)
 * /gazebo->/tf_echo_1312905336085059997 (/tf)
 * /tilt_hokuyo_node->/rosout (/rosout)
 * /base_hokuyo_node->/rosout (/rosout)
 * /camera_synchronizer_node->/rosout (/rosout)
 * /wide_stereo/wide_stereo_proc->/rosout (/rosout)
 * /l_forearm_cam/image_proc->/rosout (/rosout)
 * /narrow_stereo_textured/narrow_stereo_textured_proc->/rosout (/rosout)
 * /default_controllers_spawner->/rosout (/rosout)
 * /tf2_buffer_server->/rosout (/rosout)
 * /l_gripper_controller/gripper_action_node->/rosout (/rosout)
 * /r_gripper_controller/gripper_action_node->/rosout (/rosout)
 * /narrow_stereo/narrow_stereo_proc->/rosout (/rosout)
 * /pr2_mechanism_diagnostics->/rosout (/rosout)
 * /head_traj_controller/point_head_action->/rosout (/rosout)
 * /gazebo->/rosout (/rosout)
 * /robot_state_publisher->/rosout (/rosout)
 * /tf_echo_1312905346888907263->/rosout (/rosout)
 * /r_forearm_cam/image_proc->/rosout (/rosout)
 * /robot_pose_ekf->/rosout (/rosout)
 * /diag_agg->/rosout (/rosout)
 * /rxconsole_1312398154858191094->/rosout (/rosout)
 * /pr2_dashboard_aggregator->/rosout (/rosout)
 * /gazebo->/tf_echo_1312905342410323167 (/tf)

WARNING These nodes have died:
 * spawn_pr2_model-3
   * /l_arm_controller/joint_trajectory_action/goal
   * /torso_controller/follow_joint_trajectory/goal
   * /head_traj_controller/follow_joint_trajectory/cancel
   * /base_controller/command
   * /head_traj_controller/joint_trajectory_action/goal
   * /r_arm_controller/joint_trajectory_action/cancel
   * /torso_controller/follow_joint_trajectory/cancel
   * /l_arm_controller/joint_trajectory_action/cancel
   * /r_arm_controller/follow_joint_trajectory/cancel
   * /l_arm_controller/follow_joint_trajectory/goal
   * /head_traj_controller/follow_joint_trajectory/goal
   * /r_arm_controller/follow_joint_trajectory/goal
   * /r_arm_controller/command
   * /gazebo/set_model_state
   * /set_update_rate
   * /laser_tilt_controller/set_periodic_cmd
   * /laser_tilt_controller/set_traj_cmd
   * /l_arm_controller/follow_joint_trajectory/cancel
 * /torso_controller/position_joint_action_node:
   * /torso_controller/position_joint_action/goal
   * /torso_controller/position_joint_action/cancel
 * /pr2_dashboard_aggregator:
   * /pr2_etherCAT/motors_halted
   * /ddwrt/accesspoint
   * /power_board/state
 * /r_gripper_controller/gripper_action_node:
   * /r_gripper_controller/gripper_action/goal
   * /r_gripper_controller/gripper_action/cancel
 * /rviz_1312398084466095825:
   * /visualization_marker_array
   * /visualization_marker
 * /tf2_buffer_server:
   * /tf2_buffer_server/goal
   * /tf_static
   * /tf2_buffer_server/cancel

WARNING The following nodes are unexpectedly connected:
 * /torso_controller/position_joint_action_node->/rosout (/rosout)
 * /rviz_1312398084466095825->/rosout (/rosout)
 * /pr2_right_arm_kinematics->/rosout (/rosout)
 * /gazebo->/tf_echo_1312905336085059997 (/tf)
 * /tilt_hokuyo_node->/rosout (/rosout)
 * /base_hokuyo_node->/rosout (/rosout)
 * /camera_synchronizer_node->/rosout (/rosout)
 * /wide_stereo/wide_stereo_proc->/rosout (/rosout)
 * /l_forearm_cam/image_proc->/rosout (/rosout)
 * /narrow_stereo_textured/narrow_stereo_textured_proc->/rosout (/rosout)
 * /default_controllers_spawner->/rosout (/rosout)
 * /tf2_buffer_server->/rosout (/rosout)
 * /l_gripper_controller/gripper_action_node->/rosout (/rosout)
 * /r_gripper_controller/gripper_action_node->/rosout (/rosout)
 * /narrow_stereo/narrow_stereo_proc->/rosout (/rosout)
 * /pr2_mechanism_diagnostics->/rosout (/rosout)
 * /head_traj_controller/point_head_action->/rosout (/rosout)
 * /gazebo->/rosout (/rosout)
 * /robot_state_publisher->/rosout (/rosout)
 * /tf_echo_1312905346888907263->/rosout (/rosout)
 * /r_forearm_cam/image_proc->/rosout (/rosout)
 * /robot_pose_ekf->/rosout (/rosout)
 * /diag_agg->/rosout (/rosout)
 * /rxconsole_1312398154858191094->/rosout (/rosout)
 * /pr2_dashboard_aggregator->/rosout (/rosout)
 * /gazebo->/tf_echo_1312905342410323167 (/tf)

WARNING These nodes have died:
 * spawn_pr2_model-3

Originally posted by vincent on ROS Answers with karma: 311 on 2011-08-09

Post score: 1


Original comments

Comment by vincent on 2011-08-09:
i've updated it

Comment by dornhege on 2011-08-09:
Nobody publishes a /base_link transform. The simulation does this if working correctly. Can you add the output of roswtf and rosrun tf view_frames?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You said it already in your post. The listener needs to get the information first before it can transform.

Instead of the sleep you can use: waitForTransform.


Originally posted by dornhege with karma: 31395 on 2011-08-09

This answer was ACCEPTED on the original site

Post score: 6


Original comments

Comment by vincent on 2011-08-09:
thank you. yes i think hsu is right, since waitForTransform() did fail sometimes from my experience as well

Comment by hsu on 2011-08-09:
from past experience, I remeber Transformer::waitForTransform(...) sometimes returns false and does not block, so you need while loop around the call.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.