How to perform obstacle avoidance without map in Gazebo?

asked 2020-07-06 14:56:00 -0600

Bulldog24 gravatar image

updated 2020-07-06 15:18:12 -0600

I am working on a project where the robot (Husky) is given a goal (x,y) in Gazebo's frame of reference and it has to avoid obstacles while moving towards the goal.

Currently, I have

  • (r, phi) from the /scan topic through which I get nearest obstacle in front of the robot and its angle. (Obstacle vector).
  • A goal vector that has (x,y) and goal_angle.
  • theta from robot's orientation (from /odom after converting from euler to quaternion)

My current strategy is to calculate angle_to_goal = goal_angle - theta - phi And move towards the goal if angle_to_goal is less than 0.2.

However, this isn't avoiding any obstacles. Any thoughts as to how I can avoid obstacles with knowing only the above three pieces of information.

Thank you.

edit retag flag offensive close merge delete



Hi @Bulldog24,

Looking at your set up, not having a map means that you want a pure reactive algorithm for obstacle avoidance, What you can do is mantain a linear velocity comparing each time the distance provided by the ranges and when the range is less than a threshold just stop the robot and rotate it until there are no obstacle or the threshold is surpassed by a margin. Then resumes the contant velocity and start cheking again for obstacles. Furthermore there is no compulsory to stop the robot you can compute a low speed profile from the ranges to keep the robot moving while rotating.

Weasfas gravatar image Weasfas  ( 2020-07-08 09:38:05 -0600 )edit

One way you can do it, you can calculate your path at each time step. If your path crosses a certain obstacle with a threshold value then you need to calculate a different path. I guess you know the maximum angular velocity and acceleration of robot. So you can decide how much further you need to know to avoid an obstacle. A good number would be to look 5 seconds ahead. So at the end you would be planning a local path while keeping a global goal as an objective.

deco99 gravatar image deco99  ( 2020-07-08 09:51:46 -0600 )edit

@deco99 can you please give an idea how to calculate that path?

Bulldog24 gravatar image Bulldog24  ( 2020-07-08 12:13:39 -0600 )edit

you can calculate such path using a sliding window algorithm. What you do basically is you calculate the robot position in very small time steps like 100 ms. In doing so you will calculate the robots location and orientation. You can always assume that robot likes to go at a preferred velocity and zero angular velocity. Also you can calculate multiple paths by changing the final velocity and final angular velocity. This give you all possible locations the robot can be in the next say 2 seconds. Remove the ones which will cross obstacles and select the location closest to the final goal. Use the already calculated final velocity and final angular velocity.

deco99 gravatar image deco99  ( 2020-07-08 17:13:21 -0600 )edit