Controlling Rover 1 - MAKLab/Moons-of-MAKLab GitHub Wiki
Rover 1 uses to platforms to control it's movement:
- A raspberry Pi (V2) - Performing high function such as web interface, camera etc
- An Arduino Nano - Performing low level function such as controlling motors and servos (plus any sensors that are added)
The Arduino is connected to the raspberry Pi's hardware serial port tx (Pin 8, GPIO14) but so far not to the rx (Pin 10, GPIO15) though this may be required in time.
The Pi's default transmission rate is 115200 and this is what the Arduino is expecting as well for serial communication. It does not make much sense to use anything different here, it would make it necessary to change the settings on the pi... 115200 is fine for our purposes
As of 02/03/16 The rover has two sets of commands that can be fed to it. Move the motors or move the servos (for the camera turret/mount which has pan and tilt):
To move the motors the instruction is:
MLF200,
- The M tells the arduino to move a motor.
- The L tells it that it is the left motor we wish to move (choices L or R)
- The F indicates direction (choices F or B)
- The 200 is the speed for the motor (choices 0-255)
- The comma indicates the end of the instruction. It will work without, but then you are waiting for the serial to timeout, so please remember it
To Move the Servos:
SP90,
- The S tells the Arduino to set a servo position
- The P tells it which, (P = Pan, T = Tilt)
- The 90 is the position in degrees (0-180, 90 in straight ahead in this case)
- The comma indicates the end of the instruction. It will work without, but then you are waiting for the serial to timeout, so please remember it
##Safe Mode The Arduino needs an instruction every 500 millis to keep it moving. Even if this is just a repeat of the previous instruction. If it does not receive a recognizable instruction in this time it enters a safe mode. In Safe mode the rover applies breaks to the motors and sets its camera turret to straight ahead and upright.