I was following the ROS official documentation on how to publish a point cloud and I was able to successfully run the code. Now I'm trying to visualize the point cloud using ROS RVIZ but I'm getting an error.
Transform [sender=unknown_publisher] For frame [single_frame]: Fixed Frame [map] does not exist
How can I overcome this error? It says the frame does not exist. Is there a workaround or a configuration setting in RVIZ to bypass the error? Or how can I update my c++ code to update the frame object? Can you please provide me with some example code?
It's the tf frame that all positions/measurements that you see are relative to. For example, let's say you have a robot that has two frames, odom (a world-fixed frame) and base_link (the body frame of the robot).
In ROS terms, a coordinate system is called a frame. Rviz needs to know which frame use for its drawing. To choose the fixed frame, type its name (or use the drop-down box) on the left under “Global Options.” For Project 2, there are two coordinate frames called world and laser.
rviz is missing the transformation from its given Fixed Frame
(i.e. map
) to the frame of your point cloud data (i.e. base_link
).
If you are working with ROS by means of measurement data, kinematics and dynamics, I highly recommend the tf-tutorials on that.
However, there are two options two fix your issue:
1.
You can create a publisher which tells rviz how to transform the base_link
frame into the map
frame by typing the following command into your command line:
rosrun tf static_transform_publisher 0 0 0 0 0 0 map base_link 50
This command, explanation here, publishes the information that both frames coinside, with 50 Hz.
2. Another option is to tell rviz that its fixed frame should be base_link
. So just alter map
to base_link
as proposed in the image below.
To add more to the knowledge base. After executing the static_transform_publisher as explained by @Tik0, the Transform error disappeared. However, I still couldn't see the point cloud in the visualizer. Then after doing a few more trials, I noticed the size of the points has been set to 0.01 by default. Therefore, the points were too small to visualize. After increasing the point size in rviz point cloud settings I was able to visualize it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With