ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I got my solution and it's working with rviz. I solved this issue adding directly to the header the name of my frame_id.
sensor_msgs::PointCloud2 shape;
pcl::toROSMsg(*point_cloud_ptr,shape);
shape.header.frame_id="myshape";
After that I created a transform broadcaster:
tf::TransformBroadcaster br;
tf::Transform transform;
transform.setOrigin( tf::Vector3(0.0, 0, 0.0) );
transform.setRotation( tf::Quaternion(0, 0, 0) );
which I send in every iteration:
while(nh.ok()){
br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "world", "myshape"));
pub.publish (shape);
loop_rate.sleep();
}
Here is my full code: http://pastebin.com/0nWrm14E