Robotics StackExchange | Archived questions

Getting translation error

Update: I published my own transforms and they work fine....see code following for one wheel. But if I go through the robot-state-publisher not.

void calculateJointState2(const float pv, const std::string name)
{
  geometry_msgs::TransformStamped msg;

  msg.header.stamp = ros::Time::now();
  msg.transform.rotation.x =  0.0;
  msg.transform.rotation.y =  0;
  msg.transform.rotation.z =  0;
  msg.transform.rotation.w =  pv*(M_PI/180); // calc not tested yet

  msg.header.frame_id = "base_link";   
  msg.transform.translation.x = 0.05;
  msg.transform.translation.y = -0.15;
  msg.transform.translation.z = 0.1;
  msg.child_frame_id = "right_wheel";
  odom_broadcaster.sendTransform(msg);
}

Update: here is a copy of the topic as published from my odometry to jointstate and the associated tf that is from the robot state publisher.

joint state as I sent it: rostopic echo /joint_states

header: 
  seq: 251
  stamp: 
    secs: 13
    nsecs: 927000000
  frame_id: base_link
name: ['joint2']
position: [-0.003120610024780035]
velocity: [0.0]
effort: []

Transform received: rostopic echo /tf

transforms: 
  - 
    header: 
      seq: 0
      stamp: 
        secs: 13
        nsecs: 927000000
      frame_id: base_link
    child_frame_id: right_wheel
    transform: 
      translation: 
        x: nan
        y: nan
        z: nan
      rotation: 
        x: nan
        y: nan
        z: nan
        w: nan
---

Getting translation error, move_base and gmapping should be providing odom to map translation. I am publishing base-link to odom odometry. Joint states are published with same time stamp as the odometry. What is the best way to investigate this error? What should I be looking for.

I am sending joint states (base-link to joint) with robot-state-publisher node running in background. It is doing the translation to wheel. yes? When set the global and fixed frame id in rviz to base-link it prints same msg but say base-link instead of map

[ERROR] [1380206510.724690354, 7.561000000]: Error getting latest time from frame `'right_wheel' to frame 'map': Could not find a connection between 'map' and 'NO_PARENT' because they are not part of the same tree. Tf has two or more unconnected trees. (Error code: 2)`

This error seems to be unrelated to weather I publish joint states or not. It is also being generated at a rate that far exceeds the rate of odometry I am publishing.

image description

Asked by rnunziata on 2013-09-26 05:05:46 UTC

Comments

Can you transform from base_link to right_wheel?

Asked by dornhege on 2013-09-26 05:36:40 UTC

Not sure what you are asking. I am sending joint states (base-link to joint) with robot-state-publisher node running in background. It is doing the translation to wheel. yes? When set the global and fixed frame id in rviz to base-link it prints same msg as above but say base-link instead of map

Asked by rnunziata on 2013-09-26 05:53:32 UTC

Answers

Given the information that you added, it's clear that this is not a problem of odometry or gmapping - both are working fine. You are just not sending the tf information for base_link -> right_wheel (correctly), so it can't transform that in any way.

Probably you URDF is not setup for that or the joint state you are publishing doesn't match the URDF or a joint state is missing. For checking/debugging you should see similar errors when you try to request base_link -> right_wheel, so you can ignore gmapping/odometry for now.

Asked by dornhege on 2013-09-26 22:33:20 UTC

Comments

I have a separate question on this topic but so far not one has spotted an error in the setup. http://answers.ros.org/question/79151/updated-robot-state-publisher-causing-error-in-tf-with-eg-code/

Asked by rnunziata on 2013-09-27 02:18:57 UTC

That is precisely the error causing the troubles in here.

Asked by dornhege on 2013-09-27 04:51:17 UTC

When you say " You are just not sending the tf information for base_link -> right_wheel (correctly)," . Is this not what the robot state publisher is suppose to do. I just have to send the joint states. Which I do as shown above.

Asked by rnunziata on 2013-09-27 06:11:00 UTC

Well, you have to define the URDF and joint state correctly. Under the assumption that there is no bug in robot_state_publisher then it should produce the correct results.

Asked by dornhege on 2013-09-27 06:20:55 UTC

Can you look at question 79151 and see if there is anything wrong with the definition? If there is not I think I will open a ticket.

Asked by rnunziata on 2013-09-27 06:27:03 UTC