Robot Core Documentation
|
Smart motor controller class. More...
Classes | |
enum | SmartMotorMode |
Specifies the type of control. More... | |
enum | SmartMotorType |
Specifies the type of motor. More... | |
Public Member Functions | |
SmartMotor (SmartMotorType type, int pwmPin, int dirPin) | |
SmartMotor (SmartMotorType type, int pwmPin, int dirPin, int i2cAddr) | |
SmartMotor (int pin, int min, int zero, int max) | |
SmartMotor (int pin, int min, int zero, int max, int i2cAddr) | |
void | setMaxSpeed (double maxSpeed) |
void | set (double value) |
void | setFeedbackDevice (Encoder encoder) |
Encoder | getFeedbackDevice () |
void | setControlMode (SmartMotorMode mode) |
void | setFTerm (double f) |
void | setITerm (double i) |
void | setPTerm (double p) |
void | setIZone (double z) |
void | setInverted (boolean invert) |
void | setDTerm (double d) |
void | setMinPower (double minPower) |
void | setDeadZone (double deadZone) |
Smart motor controller class.
This class serves as the base class for the different types of motors It can handle advanced motor control using PID to control of the motor speed.
robotCore.SmartMotor.SmartMotor | ( | SmartMotorType | type, |
int | pwmPin, | ||
int | dirPin ) |
Creates an instance of a PWM duty cycle motor using 1 or 2 pins
type | - Specifies the type of motor |
pwmPin | - Specifies the pin for the PWM signal |
dirPin | - Specifies the pin for the direction control. If this value is zero then only the pwmPin is used and the motor cannot be reversed. |
robotCore.SmartMotor.SmartMotor | ( | SmartMotorType | type, |
int | pwmPin, | ||
int | dirPin, | ||
int | i2cAddr ) |
Creates instance of a PWM duty cycle motor using 1 or 2 pins when the motor is connected to an auxiliary Arduino via i2c
type | - Specifies the type of motor |
pwmPin | - Specifies the pin for the PWM signal |
dirPin | - Specifies the pin for the direction control. If this value is zero then only the pwmPin is used and the motor cannot be reversed. |
i2cAddr | - Specifies the address of the i2c connected Arduino |
robotCore.SmartMotor.SmartMotor | ( | int | pin, |
int | min, | ||
int | zero, | ||
int | max ) |
Creates an instance of a servo style motor
pin | - Specifies the pin servo signal |
min | - Specifies the minimum (full reverse) PWM time in ms |
zero | - Specifies the zero (stop) PWM time in ms. |
max | - Specifies the max (full forward) PWM time in ms. |
robotCore.SmartMotor.SmartMotor | ( | int | pin, |
int | min, | ||
int | zero, | ||
int | max, | ||
int | i2cAddr ) |
Creates instance of a servo style motor when the motor is connected to an auxiliary Arduino via i2c
pin | - Specifies the pin servo signal |
min | - Specifies the minimum (full reverse) PWM time in ms |
zero | - Specifies the zero (stop) PWM time in ms. |
max | - Specifies the max (full forward) PWM time in ms. |
i2cAddr | - Specifies the address of the i2c connected Arduino |
Encoder robotCore.SmartMotor.getFeedbackDevice | ( | ) |
void robotCore.SmartMotor.set | ( | double | value | ) |
value | - Sets either the power, speed or position depending on the current mode. If the motor is in power mode, this should be in the range -1 to +1. If the motor is in speed mode, then this should either be the desired speed in encoder units, or -1 to +1 if the maxSpeed value has been set. If the motor is in position mode, the value should be the desired position in encoder units (i.e. NOT degrees) |
void robotCore.SmartMotor.setControlMode | ( | SmartMotorMode | mode | ) |
mode | - Sets the current control mode. |
void robotCore.SmartMotor.setDeadZone | ( | double | deadZone | ) |
minDeadZone | - For positional control specifies the max error to be considered on target. This value should be in encoder units (i.e. NOT degrees) |
void robotCore.SmartMotor.setDTerm | ( | double | d | ) |
d | - Specifies the derivative term for the PID control. |
void robotCore.SmartMotor.setFeedbackDevice | ( | Encoder | encoder | ) |
encoder | - Specifies the feedback device to be used to control the speed. |
void robotCore.SmartMotor.setFTerm | ( | double | f | ) |
f | - Specifies the 'feed forward' term for the PID control. |
void robotCore.SmartMotor.setInverted | ( | boolean | invert | ) |
invert | - If true then the direction of the motor is reversed |
void robotCore.SmartMotor.setITerm | ( | double | i | ) |
i | - Specifies the integral term for the PID control. |
void robotCore.SmartMotor.setIZone | ( | double | z | ) |
z | - Specifies the I Zone term for the PID control. This is the region outside of which, the I term is ignored. |
void robotCore.SmartMotor.setMaxSpeed | ( | double | maxSpeed | ) |
maxSpeed | - Specifies the maximum speed of the motor. Setting this value allows control of the speed using the range -1 to +1 similar to when the motor is controlled by power. |
void robotCore.SmartMotor.setMinPower | ( | double | minPower | ) |
wrap | - When using position control this specifies that the position wraps modulo wrap |
minPower | - Specifies the minimum power needed to get the motor to run |
void robotCore.SmartMotor.setPTerm | ( | double | p | ) |
p | - Specifies the proportional term for the PID control. |