#include <wrapper.h>
Public Types | |
| enum | COMMUNICATION_COMMANDS { COMM_NONE, COMM_RFC, COMM_WTC, COMM_RFAX, COMM_WTAX, COMM_TIME, COMM_RBS, COMM_RLS, COMM_WLS, COMM_RSAX, COMM_RFAAX, COMM_WTAAX, COMM_PARAM, COMM = 255 } |
| Robot Communication Protocol. More... | |
Public Member Functions | |
| unsigned long | readTimer () |
| Returns the timer value of the uC TODO: implement on robot. | |
| void | sendControlData (byte id, byte *data, byte len) |
| Sends Control/Configuration Data to the robot. | |
| byte | readButtonState (byte id) |
| Returns the state of button id on the CM-5 TODO: implement on robot. | |
| byte | readLedState (byte id) |
| Returns the state of led id on the CM-5 TODO: implement on robot. | |
| void | writeLedState (byte id, byte state) |
| Sets the state of led id on the CM-5 to state TODO: implement on robot. | |
| bool | readFromAx (byte id, byte addr, void *buffer, byte len) |
| Reads len bytes from servo/sensor id starting at address addr to buffer. | |
| bool | writeToAx (byte id, byte addr, void *data, byte len, byte schedule) |
| Writes len bytes from data to servo/sensor id starting at address addr to buffer. | |
| bool | readFromAllAx (byte addr, void *buffer, int len) |
| Reads data from all servos at once (with CRC). | |
| bool | writeToAllAx (byte addr, void *data, int len) |
| Writes data from all servos at once (with CRC). | |
| void | runScheduledAx (void) |
| Sends the schedule command to all servos. | |
| int | readFromConsole (byte *buffer) |
| Returns user input (on the console) on the pc TODO: implement on the pc. | |
| void | writeToConsole (byte *buffer, int len) |
| Prints data to the console on the pc TODO: implement on the pc. | |
Implements the communication protocol. Provides functions to read data from or write data to the robot.
| unsigned long CWrapper::readTimer | ( | ) |
Returns the timer value of the uC TODO: implement on robot.
Sends Control/Configuration Data to the robot.
Returns the state of button id on the CM-5 TODO: implement on robot.
Returns the state of led id on the CM-5 TODO: implement on robot.
Sets the state of led id on the CM-5 to state TODO: implement on robot.
Reads len bytes from servo/sensor id starting at address addr to buffer.
Writes len bytes from data to servo/sensor id starting at address addr to buffer.
| schedule | If set to 1, the data won't be processed by the servos/sensors until runScheduledAx is called (use this to send data synchronously to multiple servos/sensors). |
| bool CWrapper::readFromAllAx | ( | byte | addr, | |
| void * | buffer, | |||
| int | len | |||
| ) |
Reads data from all servos at once (with CRC).
The current angle, torque and speed values from all servos will be read. The data is sent as a bit string, use CRobotWrapper::readAx12s to automatically decode it.
| buffer | Has to be of size READOFFSET + AX12_DATA_READ_TOTAL | |
| len | Has to be READOFFSET + AX12_DATA_READ_TOTAL |
| bool CWrapper::writeToAllAx | ( | byte | addr, | |
| void * | data, | |||
| int | len | |||
| ) |
Writes data from all servos at once (with CRC).
The target angle, torque and speed values of all servos will be overwritten. The data is sent as a bit string, use CRobotWrapper::writeAx12s to automatically encode it.
| data | Has to be of size WRITEOFFSET + AX12_DATA_WRITE_TOTAL | |
| len | Has to be WRITEOFFSET + AX12_DATA_WRITE_TOTAL |
| void CWrapper::runScheduledAx | ( | void | ) |
Sends the schedule command to all servos.
If data has been sent to multiple servos/sensors via writeToAx with the schedule parameter set to 1, the servos/sensor will take on the new values nearly at the same time if this command is sent.
| int CWrapper::readFromConsole | ( | byte * | buffer | ) |
Returns user input (on the console) on the pc TODO: implement on the pc.
| void CWrapper::writeToConsole | ( | byte * | buffer, | |
| int | len | |||
| ) |
Prints data to the console on the pc TODO: implement on the pc.
1.5.2