Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

DynamixelProtocol Namespace Reference

Contains structures which define the layout of the binary communication with Dynamixel servos. More...

Classes

struct  GenericCmdHeader
struct  SyncWriteHeader
 Allows you to do a "synchronized write", where all recipients commit the value(s) at the same time, and do not send any response packets. More...
struct  SyncWriteEntry
struct  SyncWritePosSpeedEntry
 An element that follows a SyncWriteHeader, controls position and speed. More...
struct  SyncWriteContinuousRotationEntry
 An element that follows a SyncWriteHeader, enables or disables continuous rotation mode. More...
struct  SyncWriteLEDEntry
 An element that follows a SyncWriteHeader, toggles LED value. More...
struct  SyncWriteComplianceEntry
struct  SyncWritePunchEntry
struct  SyncWritePIDEntry
 For MX series servos, not AX or RX. More...
struct  SyncWriteTorqueEntry
struct  SyncWriteSoundHoldEntry
 clears the sound data max hold field of an AX-S1 More...
struct  SyncWriteSoundCountEntry
 clears the sound detected count field of an AX-S1 More...
struct  SyncWriteSoundHoldAndCountEntry
 clears the sound data max hold and sound detected count fields of an AX-S1 at the same time, see ClearSoundHold and ClearSoundCount More...
struct  WriteHeader
struct  BroadcastTorqueCmd
 Broadcasts a 'torque enable' (or disable) command to all servos using a write command to the appropriate address. More...
struct  BroadcastTorqueEntry
 Broadcasts a 'max torque' value to all servos using a write command to the appropriate address. More...
struct  BroadcastFullComplianceCmd
 Broadcasts a command to set controller parameters to 0, also disabling torque (see also BroadcastNoPunchCmd). More...
struct  BroadcastNoPunchCmd
 Sets 'punch' parameter to 0, eliminating torque jump (see also BroadcastFullComplianceCmd). More...
struct  BroadcastZeroSpeedCmd
 Sets 'speed' parameter to 0, ensuring no motion will occur from leftover 'free spin' commands. More...
struct  BroadcastBaudCmd
 Sets 'baud rate' parameter to the specified value, where resulting bits per second will be 2M / (baud+1). More...
struct  SetReturnDelayTimeCmd
 Sets 'return delay time' parameter to the specified value, where actual delay time is 2µs * value. More...
struct  SetStatusResponseLevelCmd
 Sets 'status response level' parameter to the specified value, see StatusResponseLevel. More...
struct  SetServoIDCmd
 Sends a command to change a servo's ID value (use carefully!). More...
struct  SetPosSpeedCmd
 Sets the position and speed for a single servo. More...
struct  ClearSoundHoldCmd
 clears the sound data max hold field of an AX-S1 More...
struct  ClearSoundCountCmd
 clears the sound detected count field of an AX-S1 More...
struct  ClearSoundHoldAndCountCmd
 clears the sound data max hold and sound detected count fields of an AX-S1 at the same time, see ClearSoundHold and ClearSoundCount More...
struct  GenericResponseHeader
 contains fields global to all response packets More...
struct  WriteResponse
 Expected response from a Write command (when sent to non-broadcast address). More...
struct  ServoSensorsResponse
 Expected response from a ReadServoSensorsCmd, common across AX, RX, and EX series at least. More...
struct  AXS1SensorsResponse
 Expected response from a ReadAXS1SensorsCmd. More...
struct  TorqueResponse
 Expected response from a ReadTorqueCmd. More...
struct  ServoInfoResponse
 Expected response from a ReadModelCmd. More...
struct  ReadCmd
 Contains fields which are global to all read commands, which can read a block of parameters from the unit. More...
struct  ReadServoSensorsCmd
 Requests a block of servo sensor values be sent, servo should respond with a ServoSensorsResponse. More...
struct  ReadAXS1SensorsCmd
 Requests a block of AX-S1 sensor values be sent, module should respond with a AXS1SensorsResponse. More...
struct  ReadTorqueCmd
 Requests the 'torque enable' status be sent, servo should respond with a TorqueResponse. More...
struct  ReadModelCmd
 Requests the 'model number' be sent, servo should respond with a ServoInfoResponse. More...
class  PingThread
 Attempts to ping the specified servo by reading its model number, and if successful, current sensor values. More...

Enumerations

enum  ModelID_t {
  MODEL_DX113 = 113, MODEL_DX116 = 116, MODEL_DX117 = 117, MODEL_AX12 = 12,
  MODEL_AX18 = 18, MODEL_AXS1 = 13, MODEL_RX10 = 10, MODEL_RX24 = 24,
  MODEL_RX28 = 28, MODEL_RX64 = 64, MODEL_MX28 = 29, MODEL_MX64 = 310,
  MODEL_MX106 = 320, MODEL_EX106P = 107, MODEL_UNKNOWN = static_cast<size_t>(1<<16)
}
enum  StatusResponseLevel { RESPOND_NONE = 0, RESPOND_READ = 1, RESPOND_ALL = 2 }
 

symbol names for status response level settings, see SetStatusResponseLevelCmd

More...
enum  ResponseError_t {
  VOLTAGE_ERROR = 1, ANGLE_ERROR = 2, HEAT_ERROR = 4, RANGE_ERROR = 8,
  CHECKSUM_ERROR = 16, LOAD_ERROR = 32, INSTRUCTION_ERROR = 64
}
 

Provides bitmasks for checking various error conditions in GenericResponseHeader::error.

More...

Functions

const std::map
< DynamixelProtocol::ModelID_t,
const std::string > 
dynamixelModels (knownModels,&knownModels[NUM_KNOWN_MODELS])
void reportErrors (unsigned int servoID, unsigned int offset, unsigned char err)
unsigned char nchecksum (const unsigned char *p, size_t len, size_t off=0)
 Compute a bitwise-negated checksum for a region of memory, with an optional offset.
unsigned char nchecksum (const struct GenericCmdHeader &p, size_t len)
 'specialization' of nchecksum for the GenericCmdHeader, which should skip marker fields
unsigned char nchecksum (const struct GenericResponseHeader &p, size_t len)
 'specialization' of nchecksum for the GenericResponseHeader, which should skip marker fields
template<class T >
void updateChecksum (T &cmd)
 updates the checksum field of the specified structure, call this for a structure after you modify its fields
template<class T >
bool validate (const T &msg)
 returns true if markers and checksum are valid
template<class R >
bool readResponse (std::istream &is, R &response, unsigned int offset)
 reads a response from an input stream, attempts to handle line noise before response
template<class T >
std::ostream & write (std::ostream &os, const T &cmd)
 writes a command into a stream, returning the stream for convenient ostream::flush call.
template<class T >
std::ostream & write (std::ostream &os, const T &cmd, unsigned char &checksum)
 writes a command into a stream and incrementing a checksum, returning the stream for convenient ostream::flush call. Remember to bitwise-not (~) the checksum before transmission!

Variables

const char * MODEL_UNKNOWN_NAME = "UNKNOWN"
const size_t NUM_KNOWN_MODELS = 14
std::pair
< DynamixelProtocol::ModelID_t,
const std::string > 
knownModels [NUM_KNOWN_MODELS]
const char * ResponseErrorNames [9]
const unsigned int MAX_ID = 0xFD
const unsigned int BROADCAST_ID = 0xFE
const unsigned int INVALID_ID = 0xFF
const unsigned int MARKER_VALUE = 0xFF
const std::map
< DynamixelProtocol::ModelID_t,
const std::string > 
dynamixelModels
 maps model numbers (e.g. from a ServoInfoResponse) to human-readable names
const unsigned char RESPONSE_HEADER_LEN = sizeof(GenericResponseHeader)+1

Detailed Description

Contains structures which define the layout of the binary communication with Dynamixel servos.


Enumeration Type Documentation

enum ModelID_t
Enumerator:
MODEL_DX113 
MODEL_DX116 
MODEL_DX117 
MODEL_AX12 
MODEL_AX18 
MODEL_AXS1 
MODEL_RX10 
MODEL_RX24 
MODEL_RX28 
MODEL_RX64 
MODEL_MX28 
MODEL_MX64 
MODEL_MX106 
MODEL_EX106P 
MODEL_UNKNOWN 

Definition at line 23 of file DynamixelProtocol.h.

Provides bitmasks for checking various error conditions in GenericResponseHeader::error.

Enumerator:
VOLTAGE_ERROR 
ANGLE_ERROR 
HEAT_ERROR 
RANGE_ERROR 
CHECKSUM_ERROR 
LOAD_ERROR 
INSTRUCTION_ERROR 

Definition at line 347 of file DynamixelProtocol.h.

symbol names for status response level settings, see SetStatusResponseLevelCmd

Enumerator:
RESPOND_NONE 

don't respond to anything

RESPOND_READ 

only respond to read commands (see ReadCmd and GenericResponseHeader subclasses)

RESPOND_ALL 

send a response packet for every command (see WriteResponse)

Definition at line 44 of file DynamixelProtocol.h.


Function Documentation

const std::map<DynamixelProtocol::ModelID_t, const std::string> DynamixelProtocol::dynamixelModels ( knownModels  ,
knownModels[NUM_KNOWN_MODELS] 
)
unsigned char nchecksum ( const struct GenericResponseHeader &  p,
size_t  len 
)

'specialization' of nchecksum for the GenericResponseHeader, which should skip marker fields

Definition at line 366 of file DynamixelProtocol.h.

unsigned char nchecksum ( const struct GenericCmdHeader &  p,
size_t  len 
)

'specialization' of nchecksum for the GenericCmdHeader, which should skip marker fields

Definition at line 92 of file DynamixelProtocol.h.

unsigned char DynamixelProtocol::nchecksum ( const unsigned char *  p,
size_t  len,
size_t  off = 0 
)

Compute a bitwise-negated checksum for a region of memory, with an optional offset.

You can add checksums from multiple calls to this function, then bitwise-negate at the end to obtain final checksum value

Definition at line 53 of file DynamixelProtocol.h.

Referenced by nchecksum(), readResponse(), updateChecksum(), validate(), write(), and DynamixelDriver::writeSyncEntries().

bool DynamixelProtocol::readResponse ( std::istream &  is,
R &  response,
unsigned int  offset 
)

reads a response from an input stream, attempts to handle line noise before response

returns false if an invalid response type is received

Definition at line 498 of file DynamixelProtocol.h.

Referenced by CommThread::readResponse(), and PingThread::run().

void reportErrors ( unsigned int  servoID,
unsigned int  offset,
unsigned char  err 
)

Referenced by readResponse().

bool DynamixelProtocol::validate ( const T msg  ) 

returns true if markers and checksum are valid

Definition at line 73 of file DynamixelProtocol.h.

Referenced by readResponse().

std::ostream& DynamixelProtocol::write ( std::ostream &  os,
const T cmd,
unsigned char &  checksum 
)

writes a command into a stream and incrementing a checksum, returning the stream for convenient ostream::flush call. Remember to bitwise-not (~) the checksum before transmission!

Definition at line 631 of file DynamixelProtocol.h.

std::ostream& DynamixelProtocol::write ( std::ostream &  os,
const T cmd 
)

writes a command into a stream, returning the stream for convenient ostream::flush call.

Definition at line 629 of file DynamixelProtocol.h.

Referenced by DynamixelDriver::motionStarting(), CommThread::runloop(), DynamixelDriver::sendZeroTorqueCmd(), and DynamixelDriver::writeSyncEntries().


Variable Documentation

const unsigned int BROADCAST_ID = 0xFE

Definition at line 18 of file DynamixelProtocol.h.

const std::map<DynamixelProtocol::ModelID_t, const std::string> dynamixelModels

maps model numbers (e.g. from a ServoInfoResponse) to human-readable names

Referenced by DynamixelDriver::pingServos().

const unsigned int INVALID_ID = 0xFF

Definition at line 19 of file DynamixelProtocol.h.

Initial value:
 {
    std::make_pair(MODEL_DX113, "DX-113"),
    std::make_pair(MODEL_DX116, "DX-116"),
    std::make_pair(MODEL_DX117, "DX-117"),
    std::make_pair(MODEL_AX12, "AX-12"),
    std::make_pair(MODEL_AX18, "AX-18"),
    std::make_pair(MODEL_AXS1, "AX-S1"),
    std::make_pair(MODEL_RX10, "RX-10"),
    std::make_pair(MODEL_RX24, "RX-24"),
    std::make_pair(MODEL_RX28, "RX-28"),
    std::make_pair(MODEL_RX64, "RX-64"),
    std::make_pair(MODEL_MX28, "MX-28"),
    std::make_pair(MODEL_MX64, "MX-64"),
    std::make_pair(MODEL_MX106, "MX-106"),
    std::make_pair(MODEL_EX106P, "EX-106+"),
  }

Definition at line 14 of file DynamixelProtocol.cc.

const unsigned int MARKER_VALUE = 0xFF

Definition at line 20 of file DynamixelProtocol.h.

Referenced by readResponse().

const unsigned int MAX_ID = 0xFD

Definition at line 17 of file DynamixelProtocol.h.

const char * MODEL_UNKNOWN_NAME = "UNKNOWN"

Definition at line 11 of file DynamixelProtocol.cc.

Referenced by ServoInfoResponse::getModelString(), and PingThread::run().

const size_t NUM_KNOWN_MODELS = 14

Definition at line 13 of file DynamixelProtocol.cc.

const unsigned char RESPONSE_HEADER_LEN = sizeof(GenericResponseHeader)+1

Definition at line 368 of file DynamixelProtocol.h.

const char * ResponseErrorNames
Initial value:
 {
    "VOLTAGE_ERROR",
    "ANGLE_ERROR",
    "HEAT_ERROR",
    "RANGE_ERROR",
    "CHECKSUM_ERROR",
    "LOAD_ERROR",
    "INSTRUCTION_ERROR",
    "UNKNOWN_ERROR",
    NULL
  }

Definition at line 32 of file DynamixelProtocol.cc.


Tekkotsu Hardware Abstraction Layer 5.1CVS
Generated Mon May 9 05:01:42 2016 by Doxygen 1.6.3