japaric / 2wd

A remotely controlled wheeled robot
Apache License 2.0
10 stars 0 forks source link

Obstacle detection #2

Open japaric opened 7 years ago

japaric commented 7 years ago

The robot has an ultrasonic sensor that can measure the distance between the robot and an obstacle ahead. I want to use that sensor to implement some form of obstacle detection. I'm not sure what should be the behavior when the robot is close to an obstacle at this point -- preventing it from moving forwards seems sensible --, but we can start with just reporting the distance measured by the ultrasonic sensor as a start.

nordmoen commented 7 years ago

A very simple form of obstacle avoidance is Artificial Potential Fields. The basic idea is that obstacles (detected with ultrasonic sensor) "produce" a repulsion field that affect the desired driving direction. E.g. The robots want to drive to point B, the robot position is always A, we can then crate a vector from A -> B this is our desired driving direction. When an obstacle (C) is encountered it creates an opposing force, C -> A, by scaling these forces appropriately the robot will stop before hitting the obstacle, but even better, if the robot approaches the obstacle from an angle the sum of the forces will hopefully drive the robot around the obstacle. Illustrated here

japaric commented 7 years ago

That's a neat idea. I would have to mount the ultrasonic sensor on top of a servo -- right now it's fixed -- to get the most out of this. Alternatively I could add more sensors with different orientations.

nordmoen commented 7 years ago

It could probably still be done without more sensors (see Occupancy Grid), but that way lies SLAM.

Depending on how wide the sensor can go the easiest is probably more sensors.