ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Non-fully qualified frame_id

asked 2013-08-08 13:32:28 -0500

Challen gravatar image

updated 2013-08-09 05:33:07 -0500

Hey all, I am trying to convert an incoming laser scan from a hokuyo urg laser scanner into a pointcloud for the purpose of building a octomap. Here is the code I'm working with, which is mostly from a tutorial:

class LaserScanToPointCloud {
    ros::NodeHandle node;
    laser_geometry::LaserProjection projector;
    tf::TransformListener listener;
    message_filters::Subscriber<sensor_msgs::LaserScan> laser_sub;
    tf::MessageFilter<sensor_msgs::LaserScan> laser_notifier;
    ros::Publisher scan_pub;

    LaserScanToPointCloud(ros::NodeHandle n): node(n), laser_sub(node, "scan", 10),
    laser_notifier(laser_sub, listener, "Brain5", 10) {
      laser_notifier.registerCallback(boost::bind(&LaserScanToPointCloud::scanCallback, this, _1));
      scan_pub = node.advertise<sensor_msgs::PointCloud2>("my_cloud", 1);

    void scanCallback (const sensor_msgs::LaserScan::ConstPtr& scan_in) {
      sensor_msgs::PointCloud2 cloud;
      try {
        projector.transformLaserScanToPointCloud("Brain5", *scan_in, cloud, listener);
      catch(tf::TransformException& e) {
        std::cout << e.what();
      std::cout << "publishing" << std::endl;
/*      tf::TransformBroadcaster br;
      tf::Transform transform;
      transform.setOrigin(tf::Vector3(0, 0, 0));
      transform.setRotation(tf::Quaternion(0, 0, 0, 1));
      br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "map", "odom_combined"));*/

int main(int argc, char** argv) {
  ros::init(argc, argv, "my_scan_to_cloud");
  ros::NodeHandle n;
  LaserScanToPointCloud lstopc(n);
  return 0;

The code works fine when the tf frame that I pass to the Message Filter is the same as the laser's frame. But I have issues when I try to add transforms from the laser frame (not fixed) to a fixed frame. When I add this extra frame, the code will sporadically spit out a pointcloud, but no where near the consistency when I just use one frame.

I get this warning every time I run the code, if it's important:

[ WARN] [1376004701.242796255]: Message from [/hokuyo_node] has a non-fully-qualified frame_id [laser]. Resolved locally to [/laser].  This is will likely not work in multi-robot systems.  This message will only print once.

Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-08-09 04:55:48 -0500

madmax gravatar image

You should add an "/" in front of the laser frame. In multi-robot systems you will likely have a namespace in front of the laser frame like "/robot_1/laser".

edit flag offensive delete link more


Thanks. It looks like that's going to work.

Challen gravatar image Challen  ( 2013-08-09 06:14:22 -0500 )edit

Could you please explain a bit more about the "/" ? Also, since it mentions "locally resolved" doesn't it solve the problem ? Thank you.

2ROS0 gravatar image 2ROS0  ( 2014-07-03 16:36:04 -0500 )edit

Question Tools

1 follower


Asked: 2013-08-08 13:32:28 -0500

Seen: 539 times

Last updated: Aug 09 '13