Ask Your Question

Get the position and angle of the obstacle detected by rplidar

asked 2019-07-24 01:49:39 -0500

nadiah gravatar image

Hi, I am new to ROS, actually I had been tried to understand ROS for 2 months, but I am still confused about that. I could build the map using hector mapping and know how to get the distance data of obstacles around the rplidar, but now I need to know the exact position (x, y, z and angle) of the obstacles, anyone knows how to get those data? I need to implement the obstacle detectin on the car, and after that I will make the obstacle avoidance.

I am using rplidar A2 with raspberry pi 3 and ROS kinetic.

Thank you

edit retag flag offensive close merge delete


what do you mean by obstacle?

Only the measured point of your Lidar, a cell in the map from SLAM or a detected obstacle from a obstacle detection like this?

Tristan9497 gravatar image Tristan9497  ( 2021-03-17 10:30:50 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2021-03-17 11:17:00 -0500

Sounds like you have some sort of SLAM package operational. However this is not enough to detect obstacles. Yes, you will get lidar points where there are obstacles, but you will also end up with noise or false positives. You need to process this further to detect obstacles. One of the most common and easy ways to do this is to cluster the points to filter out noise or points that aren't very dense. Then you will have to track these objects. If all of this sounds too overwhelming, there are several packages that perform this task. The very simple lidar_tracking package should help you with this. It returns a list of detected and tracked objects as markers where you should be able to pull out the positions and poses of the objects.

edit flag offensive delete link more

answered 2021-03-17 10:39:02 -0500

Take a look at the documentation of the message type sensor_msgs::LaserScan here you will see, that you not only have the ranges but also a definition for the min and max angle as well as the angle increment.

This would let you calculate the x and y coordinate of each measurement using trigonometry. Z is obiously 0 in regards to the position of your laser (assuming it is mounted horizontaly)

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-07-24 01:49:39 -0500

Seen: 455 times

Last updated: Mar 17 '21