Question on Ultra Sonic Sensors?
Consider a robot car (20mmx20mm) having mounted 3 Ultra Sonic sensors on the front and the 2
sides, right and left respectively. An ultrasonic sensor measures the distance between where the
sensor is mounted, till the point it encounters an object DIRECTLY in front of it and gives the
value as an input. Write an algorithm which allows the car to navigate through the track shown
Note: All relevant components have been attached, and your answer does not need to talk about
the car but only the logic.
- flyingtiggerukLv 78 months ago
This isn’t a question on ultrasonic sensors it’s a programming flow diagram question.
Basically you have a combination of [go forward] [turn left] and [turn right] depending on the output from the 3 different sensors.. for example....
Put car on start line so it is inside maze
Turn car until all 3 sensors see a wall - you’ll need to expand on this if, for example you don’t know which way the car is pointing at the start. If it is 90 or 180 deg out it will only see 2 walls
Move forwards until desired distance achieved, or until left sensor detects closer wall - if you started near the bottom
Turn right 90 deg or until front and left sensors see walls ...... or carry on a bit further and turn left 90 deg, depending on what triggered the sensors in the previous step
And so on
Basically you have to consider every possibility and have the code to cope with it