#include <wrapper.h>
Inheritance diagram for CAx12:
Public Member Functions | |
CAx12 () | |
void | readFromRobot () |
Reads servo motor information from robot into data. | |
void | writeToRobot (byte schedule=0) |
Writes servo motor information from data to robot. | |
bool | rangeError () |
Indicates if an out-of-bounds error occurred. | |
void | setTargetAngle (float angle_in_degree) |
void | setTargetAngleMinMax (float min, float max) |
float | getTargetAngle () |
float | getCurrentAngle () |
void | setCurrentAngle (float angle_in_degree) |
void | setTargetToCurrentAngle () |
void | setSpeedLimit (unsigned int limit) |
unsigned int | getSpeedLimit () |
unsigned int | getCurrentSpeed () |
void | controlSpeed (float targetPosition, float time, int speedMax=1023) |
void | setTorqueLimit (unsigned int limit) |
unsigned int | getTorqueLimit () |
int | getCurrentTorque () |
void | controlTorque (float targetPosition, float time, unsigned int torqueMax=1023) |
Public Attributes | |
CController | torquePID |
CController | speedPID |
float | angleSign |
Should be +1.0 (clockwise, standard value) or -1.0 (counterclockwise). | |
byte | data [AX12_DATA_READ] |
Stores servo motor information (Current and target angle, torque, speed). | |
bool | checkRange |
Indicates if out-of-bound error should be produced. | |
bool | useCurrentAngle |
Indicates if current or target angle should be used to test out-of-bound errors. | |
Private Attributes | |
float | angleMin |
Lower bound for valid angles (in degree). | |
float | angleMax |
Upper bound for valid angles (in degree). | |
float | angleErrorCurrent |
float | angleErrorTarget |
Target angle (in degree) that produces the last out-of-bounds error. | |
bool | angleError |
Indicates if an out-of-bounds error occured. | |
unsigned long | timestamp |
Timestamp of last angle update. | |
float | oldAngles [OLDANGLESCOUNT] |
Cyclic buffer of past target angles. | |
int | oldAnglesIndex |
Current index in cyclic buffer. |
After calling readFromRobot, the current state of the servo module is accessible through the get-functions. The current values can be changed via the set-functions and can be written to the robot by calling writeToRobot.
CAx12::CAx12 | ( | ) |
void CAx12::readFromRobot | ( | ) |
Reads servo motor information from robot into data.
void CAx12::writeToRobot | ( | byte | schedule = 0 |
) |
Writes servo motor information from data to robot.
bool CAx12::rangeError | ( | ) |
Indicates if an out-of-bounds error occurred.
void CAx12::setTargetAngle | ( | float | angle_in_degree | ) |
void CAx12::setTargetAngleMinMax | ( | float | min, | |
float | max | |||
) |
float CAx12::getTargetAngle | ( | ) |
float CAx12::getCurrentAngle | ( | ) |
void CAx12::setCurrentAngle | ( | float | angle_in_degree | ) |
void CAx12::setTargetToCurrentAngle | ( | ) |
void CAx12::setSpeedLimit | ( | unsigned int | limit | ) |
unsigned int CAx12::getSpeedLimit | ( | ) |
unsigned int CAx12::getCurrentSpeed | ( | ) |
void CAx12::controlSpeed | ( | float | targetPosition, | |
float | time, | |||
int | speedMax = 1023 | |||
) |
void CAx12::setTorqueLimit | ( | unsigned int | limit | ) |
unsigned int CAx12::getTorqueLimit | ( | ) |
int CAx12::getCurrentTorque | ( | ) |
void CAx12::controlTorque | ( | float | targetPosition, | |
float | time, | |||
unsigned int | torqueMax = 1023 | |||
) |
float CAx12::angleMin [private] |
Lower bound for valid angles (in degree).
float CAx12::angleMax [private] |
Upper bound for valid angles (in degree).
float CAx12::angleErrorCurrent [private] |
float CAx12::angleErrorTarget [private] |
Target angle (in degree) that produces the last out-of-bounds error.
bool CAx12::angleError [private] |
Indicates if an out-of-bounds error occured.
unsigned long CAx12::timestamp [private] |
Timestamp of last angle update.
float CAx12::oldAngles[OLDANGLESCOUNT] [private] |
Cyclic buffer of past target angles.
int CAx12::oldAnglesIndex [private] |
Current index in cyclic buffer.
float CAx12::angleSign |
Should be +1.0 (clockwise, standard value) or -1.0 (counterclockwise).
byte CAx12::data[AX12_DATA_READ] |
Stores servo motor information (Current and target angle, torque, speed).
bool CAx12::checkRange |
Indicates if out-of-bound error should be produced.
Indicates if current or target angle should be used to test out-of-bound errors.