Header file for the servos and motors functions.
More...
#include "serial.h"
#include "hdt.h"
#include "types.h"
Go to the source code of this file.
|
#define | SERVO_LOW 0 |
|
#define | SERVO_HIGH 255 |
|
|
int | MOTORInit () |
| Initialises the IO board and sets up tables for motors. More...
|
|
int | SERVOInit () |
| Initialises the IO board and sets up tables for servos. More...
|
|
int | SERVORange (int servo, int low, int high) |
| Sets the range for the servos. More...
|
|
int | SERVOSet (int servo, int angle) |
| Set the given servos to the same given angle depending on table value. More...
|
|
int | SERVOSetRaw (int servo, int angle) |
| Set the given servos to the same given angle in raw mode. More...
|
|
int | MOTORDrive (int motor, int speed) |
| Set the given motors to the same given speed dependant on hdt table. More...
|
|
int | MOTORDriveRaw (int motor, int speed) |
| Set the given motor to a given speed. More...
|
|
int | MOTORPID (int motor, int p, int i, int d) |
| Set the given motors with PID control. More...
|
|
int | MOTORPIDoff (int motor) |
| Shuts off PID control. More...
|
|
int | MOTORSpeed (int motor, int ticks) |
| Sets the controlled motor speed in ticks/sec. More...
|
|
int | ENCODERRead (int quad) |
| Reads the value from the encoder. More...
|
|
int | ENCODERReset (int quad) |
| Resets the encoder, in reality just stores the current value of the encoder and subtracts it from future values. More...
|
|
|
int | ENCODERBaseVal [4] |
|
HDT_MOTOR * | MOTORFirst |
|
HDT_SERVO * | SERVOFirst |
|
int | MOTORInitialised |
|
int | SERVOInitialised |
|
Header file for the servos and motors functions.
- Author
- Marcus Pham
int ENCODERRead |
( |
int |
quad | ) |
|
Reads the value from the encoder.
- Parameters
-
quad | the encoder to read from |
- Returns
- the encoder value on success, 1 on failure
int ENCODERReset |
( |
int |
quad | ) |
|
Resets the encoder, in reality just stores the current value of the encoder and subtracts it from future values.
- Parameters
-
- Returns
- 0 on success, 1 on failure
int MOTORDrive |
( |
int |
motor, |
|
|
int |
speed |
|
) |
| |
Set the given motors to the same given speed dependant on hdt table.
- Parameters
-
motor | the motor to set |
speed | : motor speed in percent |
Valid values for speed :
- -100 to 100 (full backward to full forward)
- 0 for full stop
- Returns
- 0 on success, 1 on failure
int MOTORDriveRaw |
( |
int |
motor, |
|
|
int |
speed |
|
) |
| |
Set the given motor to a given speed.
- Parameters
-
motor | the motor to set |
speed | : motor speed |
Valid values for speed :
- -100 to 100 (full backward to full forward)
- 0 for full stop
- Returns
- 0 on success, 1 on failure
Initialises the IO board and sets up tables for motors.
- Returns
- 0 on success, 1 otherwise
int MOTORPID |
( |
int |
motor, |
|
|
int |
p, |
|
|
int |
i, |
|
|
int |
d |
|
) |
| |
Set the given motors with PID control.
- Parameters
-
motor | the motor to set |
p | the p setting |
i | the i setting |
d | the d setting |
- Returns
- 0 on success, 1 on failure
int MOTORPIDoff |
( |
int |
motor | ) |
|
Shuts off PID control.
- Parameters
-
- Returns
- 0 on success, 1 on failure
int MOTORSpeed |
( |
int |
motor, |
|
|
int |
ticks |
|
) |
| |
Sets the controlled motor speed in ticks/sec.
- Parameters
-
motor | the motor to set |
ticks | the number of ticks per sec |
- Returns
- 0 on success, 1 on failure
Initialises the IO board and sets up tables for servos.
- Returns
- 0 on success, 1 otherwise
int SERVORange |
( |
int |
servo, |
|
|
int |
low, |
|
|
int |
high |
|
) |
| |
Sets the range for the servos.
- Parameters
-
servo | the servo to set |
low | the lower limit |
high | the upper limit |
- Returns
- 0 on success, 1 otherwise
int SERVOSet |
( |
int |
servo, |
|
|
int |
angle |
|
) |
| |
Set the given servos to the same given angle depending on table value.
- Parameters
-
servo | the servo number |
angle | the angle to set it to |
- Returns
- 0 on success, 1 on failure
int SERVOSetRaw |
( |
int |
servo, |
|
|
int |
angle |
|
) |
| |
Set the given servos to the same given angle in raw mode.
- Parameters
-
servo | the servo to set |
int | angle : valid values = 0-255 |
- Returns
- 0 on success, 1 otherwise