ros-perception / slam_gmapping

http://www.ros.org/wiki/slam_gmapping
668 stars 528 forks source link

gmapping node ignores tf2 static latch transforms. #13

Closed rnunziata closed 10 years ago

rnunziata commented 11 years ago

gmapping node ignores tf2 static latch transforms. If I code this transform as a tf2 static latch it is ignored but if specified via node input as shown below then the scanner data is transformed correctly. The scanner fame is attached to the camera_link.

<node pkg="tf" type="static_transform_publisher" name="hftf_broadcaster" 
args="0 0 .2 0 0 0 1 camera_link hokuyo_frame 100"/>

int main(int argc, char **argv)
{ 
  ros::init(argc, argv, "robot_odometry");

  // send static latch transformations 

  tf2_ros::StaticTransformBroadcaster static_broadcaster;
  geometry_msgs::TransformStamped msg;

  msg.header.stamp = ros::Time::now();
  msg.transform.rotation.x =  0.0;
  msg.transform.rotation.y =  0.0;
  msg.transform.rotation.z =  0.0;
  msg.transform.rotation.w =  1.0;

  msg.header.frame_id = "base_link";   
  msg.transform.translation.x = 0;
  msg.transform.translation.y = 0;
  msg.transform.translation.z = 0.1;
  msg.child_frame_id = "camera_link";
  static_broadcaster.sendTransform(msg);

  msg.header.frame_id = "camera_link";   
  msg.transform.translation.x = 0;
  msg.transform.translation.y = 0;
  msg.transform.translation.z = 0.2;
  msg.child_frame_id = "hokuyo_frame";
  static_broadcaster.sendTransform(msg);

//    msg.header.frame_id = "base_link";   // additional test transform
//    msg.transform.translation.x = 0;     // but should not be needed as chain is
//    msg.transform.translation.y = 0;     // hokuyo_frame->camera_link->base_link
//    msg.transform.translation.z = 0.2;   // transforms are all specified
//    msg.child_frame_id = "hokuyo_frame";
//    static_broadcaster.sendTransform(msg);

  msg.header.frame_id = "camera_link";   
  msg.transform.translation.x = 0;
  msg.transform.translation.y = 0;
  msg.transform.translation.z = 0.3;
  msg.child_frame_id = "camera_frame";
  static_broadcaster.sendTransform(msg);

  PublishOdometry sp;

  ros::spin();

  return 0;
}
wjwwood commented 11 years ago

@tfoote

tfoote commented 11 years ago

What is the error and how can it be reproduced?

rnunziata commented 10 years ago

Fixed in Indigo.