Obstacle Detection
In this blog, we demonstrate how to run our obstacle avoidance algorithm at night using raspberry pi and a Sphero RVR rover. The primary goal is to explore its surroundings while detecting and avoiding obstacles at Night. This algorithm uses Obstacle Detection algorithm to identify obstacles. Please check the Previous Blog blog for a detailed explanation on how to set it up.
The Raspberry Pi + Sphero RVR rover setup is shown below. A mobile camera was placed in front to record the movement continuously.
The raspberry pi is an IR camera and the IR leds turn on automatically once the ambient light falls below a certain threshold.
We run a python code to obtain the output, the source codes can be found below.
API source code from GitHubYou'll need to have a subscription key to use this, you can check out the intro blog on how to get your free subscription key.
A sample video of this can be viewed below. The settings for these area:
- MinSafeDistanceFactor = 0.5
- MinPathWidthFactor = 0.4
- MinObjectHeightFactor = 0.1
- MinObjectWidthFactor = 0.1
Sample Images for Obstacle avoidance at night
The images show original image and the processed image showing the best path. In the processed image, A green cone represents a valid path and a red represents a path that does not satisfy all the conditions.
If a traversable path that agrees with all the set threshold is successfully identified, the ‘StatusFlag’ will return 1, else it will return 0.
Sample input and processed output images are shown for reference below
In this implementation, there are a few additional conditions that were put in place to avoid any obstacles. In case the best direction is above 45 degrees from the center, it’s not possible to identify all the obstacles immediately as the field of view is restricted. In such cases, the rover turns to the new direction and waits for a confirmation if the path is obstacle free. If yes, it continues to traverse in the new direction, else, it will rotate and wait for confirmation.