How to get distance and direction from robot to obstacle?

asked 2018-10-09 22:21:41 -0600

zhxue gravatar image

Hey guys.

I want to write artificial potential field algorithm as my own local_planner.

In order to do this,i need to get distance and direction from robot to obstacle.They should be some where in costmap_2d or base_local_planner but i can't find them.The costmap_2d provides costmap_2d::calculateMinAndMaxDistances but it's not what i need.

Could you please tell me where functions are or how could i get them?

Thank you.

edit retag flag offensive close merge delete

Comments

1

@zhxue, perhaps from some sensor you use like laser range finder, sonar etc.? What kind of model/real robot do you use?

l4ncelot gravatar imagel4ncelot ( 2018-10-10 04:06:21 -0600 )edit
1

You can get robot pose here. And I don't think there is easy way to distinguish between obstacles. One way is to read costmap into matrix and implement your own logic from there.

Choco93 gravatar imageChoco93 ( 2018-10-10 04:34:48 -0600 )edit

@l4ncelot Hi,we are now using a car made by ourselves.The car is not completed yet.It has a laser radar and many ultrasonic radar.Maybe it's easier to get distance and direction from robot to obstacle just from those radars?

zhxue gravatar imagezhxue ( 2018-10-10 21:12:31 -0600 )edit

@zhxue it is IMO. Distances should be available through classic ROS topics with ROS drivers for your hardware. Then you just need to transform those messages according to the position of your laser range finder in respect to the car itself.

l4ncelot gravatar imagel4ncelot ( 2018-10-11 01:45:39 -0600 )edit

Look at tf tutorials on robot_setup, robot_state_publisher1 and ...

l4ncelot gravatar imagel4ncelot ( 2018-10-11 01:47:39 -0600 )edit
l4ncelot gravatar imagel4ncelot ( 2018-10-11 01:47:51 -0600 )edit