EasyManua.ls Logo

SunFounder GalaxyRVR - Page 72

Default Icon
120 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
SunFounder GalaxyRVR Kit for Arduino, Release 1.0
Now let’s turn this flowchart into actual code to bring our Rover to life.
Note that the handleForwardMovement() function is where we’ve integrated the behavior of the ultrasonic sensor.
We read the distance data from the sensor and based on this data, we decide the movement of the Rover.
After uploading the code to your R3 board, its time to test the system. Make sure the Rover can detect and avoid obsta-
cles efficiently. Remember, you may need to adjust the detection distance in the code based on your actual environment
to perfect the system.
Step 3: Coding the Intelligent Following System
With our Rover now capable of avoiding obstacles, let’s enhance it further by making it follow objects. Our goal is to
modify our existing code to make the Rover move towards a moving object.
Ever wondered about the differences between a following system and an obstacle avoidance system?
The key here is that in a following system, we want our Rover to move in response to detected objects, while in an
obstacle avoidance system, were looking to steer clear of detected objects.
Lets visualize the desired workflow:
68 Chapter 3. Course Mode

Related product manuals