0
$\begingroup$

Rosanswers logo

Hello, I have issue with my lidar. It doesn't show the data when the fixed frame is anything except its own laser_frame.

I means, when I switch fixed frame to /odom or /base_footprint I do not see any data in rviz anymore and starting receive that error message :Transform [sender=unknown_publisher] Unknown reason for transform failure.

I am using YDLIDAR X4

could someone help me? Thank you

EDITED 1:

the photo of tf tree: image description


Originally posted by Yehor on ROS Answers with karma: 166 on 2020-05-07

Post score: 0


Original comments

Comment by Dragonslayer on 2020-05-07:
What does rosrun tf view_frames show for a tf tree?? Likely you dont load the urdf of your robot, or dont publish a map and odom etc. Do you only launch X4.launch? Fixed frame in rviz usually is the map frame. For your lidar you need a laser_frame in your urdf or a static transform publisher wich transforms direct or indirect from base_link/base_footprint to laser_frame. The standard X4.launch file has a static transform from base_footprint to laser_frame (the last few lines). In the launchfile as well there is the line "" . Visualization only works if there is a transform for the frame_id´s frame. X4.launch alone only gives you laser_frame no other transforms are published no odom no base_footprint.

Comment by Yehor on 2020-05-07:
@Dragonslayer I have added

I have static transform publisher from base_footprint to laser_frame.

Comment by Dragonslayer on 2020-05-07:
Odom publishes at low frequenzy 6hz. Might be an issue. If you just launch X4.lauch without the driver_node and set fixed_frame base_footprint the same thing happens?

Comment by Dragonslayer on 2020-05-07:
If you visualize tf in rviz what does it show? Errors as well?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I found the solution here: https://github.com/EAIBOT/ydlidar/issues/14

In the cpp of the lidar node you have to change these lines:

scan_msg.scan_time = scan.config.scan_time/1000000000.0; scan_msg.time_increment = scan.config.time_increment/1000000000.0;


Originally posted by Yehor with karma: 166 on 2020-05-07

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Dragonslayer on 2020-05-07:
Nice to hear. By the way I red sometime ago that rviz in some cases use another coordinate system, this was in regard to pointclouds though. The solution was to invert the axis in rviz, so not to mess up calculations in ros. So if your robot after all this "looks" good in rviz but "works" the wrong way this might be a topic to follow up on. All the best. Matt

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.