CWrapper Class Reference

Robot Communication Wrapper. More...

#include <wrapper.h>

List of all members.

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.


Detailed Description

Robot Communication Wrapper.

Implements the communication protocol. Provides functions to read data from or write data to the robot.


Member Enumeration Documentation

enum CWrapper::COMMUNICATION_COMMANDS

Robot Communication Protocol.

Enumerator:
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 


Member Function Documentation

unsigned long CWrapper::readTimer (  ) 

Returns the timer value of the uC TODO: implement on robot.

void CWrapper::sendControlData ( byte  id,
byte data,
byte  len 
)

Sends Control/Configuration Data to the robot.

byte CWrapper::readButtonState ( byte  id  ) 

Returns the state of button id on the CM-5 TODO: implement on robot.

byte CWrapper::readLedState ( byte  id  ) 

Returns the state of led id on the CM-5 TODO: implement on robot.

void CWrapper::writeLedState ( byte  id,
byte  state 
)

Sets the state of led id on the CM-5 to state TODO: implement on robot.

bool CWrapper::readFromAx ( byte  id,
byte  addr,
void *  buffer,
byte  len 
)

Reads len bytes from servo/sensor id starting at address addr to buffer.

bool CWrapper::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.

Parameters:
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.

Parameters:
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.

Parameters:
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.


The documentation for this class was generated from the following files:
Generated on Mon Apr 21 23:27:45 2008 for BioloidControl by  doxygen 1.5.2