We need to bring some intelligence in this fabulous rover ;-)
In order to achieve this, we will use an electronic kit from Rooby that is made of a main board, 2 motors, a battery case and 2 sensors.
The main board can be easily programmed using a software provided by Rooby: Rooby Pilot.
The program is created like a puzzle, putting together a series of actions and sensors.
The program can be tested virtually in Rooby Pilot. Once finalized, it can be sent to the main board via a USB cable.
Here's our program:
Its logic is "move backward and change direction"
- Trevor moves forward (driving motor on)
- IF one of the 2 sensors of Trevor hits a wall (or a corner) THEN
- the driving motor is inverted, Trevor goes reverse for x seconds
- the driving motor stops
- the direction motor rotates the front wheel of x degrees clockwise
- the direction motor stops
- the driving motor goes reverse for x seconds
- the direction motor rotates the front wheel of x degrees anti-clockwise (back straight)
- the driving motor goes forward
- Trevor changed direction and moves forward again till it hits a wall again and re-applies the same logic (move backwards and change direction)
- ELSE Trevor continues to move forward
Remark :
- We equipped Trevor with 2 sensors (right and left) in order to run different actions depending which sensor is activated. When the left sensor is hit first, the direction will run anti-clockwise in order to move Trevor away from the wall. The opposite action runs when the right sensors is hit first.
No comments:
Post a Comment