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

which frame I should use ?

asked 2014-07-20 06:23:28 -0500

RSA_kustar gravatar image

I used laser_geometry tutorial and I have this code:

 LaserScanToPointCloud(ros::NodeHandle n): 
  n_(n),
// laser_sub_(n_, "base_scan", 10),
laser_sub_(n_, "/laserscan", 1),
laser_notifier_(laser_sub_,listener_, "laser0_frame", 1)
{
  std::cout << "Object created" << std::endl ;

    laser_notifier_.registerCallback(
    boost::bind(&LaserScanToPointCloud::scanCallback, this, _1));
    laser_notifier_.setTolerance(ros::Duration(0.01));// 0.01
    std::cout << "before pub " << std::endl ;

    scan_pub_ = n_.advertise<sensor_msgs::PointCloud>("cloud",1);
    std::cout << "after pub " << std::endl ;

}

==========================================

sensor_msgs::PointCloud cloud;
try
{
    std::cout << "try " << std::endl ;

    projector_.transformLaserScanToPointCloud(
      "laser0_frame",*scan_in, cloud,listener_);
}
catch (tf::TransformException& e)
{
    std::cout << "catch 1 " << std::endl ;

    std::cout << e.what();
    std::cout << "catch " << std::endl ;

    return;
}

I changed base_scan to laser_scan --> this is because the topic name that publishes laser data is called laser_scan is that right ?? should I do that or shouldn't I ? Also, I did rostopic echo /scan and I found that the frame id is laser0_frame.. So I used it instead of the base_link. The base_link was used in the geometry tutorial.

now in the previous code should I use base_link or laser0_frame

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-07-20 10:30:03 -0500

bvbdort gravatar image

i think you forgot publishing pointcloud after conversion.

edit flag offensive delete link more

Comments

I did using the following command and it is there in the question
scan_pub_ = n_.advertise<sensor_msgs::pointcloud>("cloud",1);

RSA_kustar gravatar image RSA_kustar  ( 2014-10-09 04:09:59 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-07-20 06:14:19 -0500

Seen: 222 times

Last updated: Jul 20 '14