55 #include "rnr/rnrconfig.h" 58 #include "rnr/units.h" 112 DYNA_LOG_ERROR(rc,
"Servo %d: Failed to get the model number.", nServoId);
119 DYNA_LOG_ERROR(rc,
"Servo %d: Failed to get the firmware verions.",
129 case DynaServoAX12::DYNA_MODEL_NUM:
130 pDynaServo =
new DynaServoAX12(comm, nServoId, uModelNum, uFwVer);
138 pDynaServo =
new DynaServoMX12W(comm, nServoId, uModelNum, uFwVer);
142 pDynaServo =
new DynaServoMX28(comm, nServoId, uModelNum, uFwVer);
146 pDynaServo =
new DynaServoMX64(comm, nServoId, uModelNum, uFwVer);
150 pDynaServo =
new DynaServoMX106(comm, nServoId, uModelNum, uFwVer);
154 pDynaServo =
new DynaServoRX10(comm, nServoId, uModelNum, uFwVer);
158 pDynaServo =
new DynaServoRX24F(comm, nServoId, uModelNum, uFwVer);
162 pDynaServo =
new DynaServoRX28(comm, nServoId, uModelNum, uFwVer);
166 pDynaServo =
new DynaServoRX64(comm, nServoId, uModelNum, uFwVer);
349 *pBaudRate = nBaudRate;
372 nServoId, nNewBaudRate);
388 return comm.
Ping(nServoId);
398 return comm.
Reset(nServoId);
435 printf(
" %s Control Table\n", sTblName);
436 printf(
"Address Name Raw Value\n");
437 printf(
"------- ---- --- -----\n");
442 for(i=0; i<uSize; ++i)
466 printf(
"Failed To Read\n");
477 printf(
"0x%02x ", uVal);
481 printf(
"0x%04x ", uVal);
492 iVal = (int)(uVal & uMask);
504 iVal = (int)(uVal & p->
m_uMask);
RoadNarrows Dynamixel Bus Communications Abstract Base Class Interface.
virtual int UpdateOdometer(int nEncCurPos)
Update the odometer from the current servo position and rotation direction.
static int BaudNumToRate(int nBaudRate)
Map baud number to Dynamixel baud rate.
RoadNarrows AX Series Dynamixel Declarations.
char * newstr(const char *s)
Allocate new duplicated string.
uint_t m_uAddr
control table entry address
RoadNarrows MX-106T and MX-106R Dynamixel Servo Class Interface.
static int WriteBaudRate(DynaComm &comm, int nServoId, int nNewBaudRate)
Write the new baud rate to the servo's EEPROM.
#define DYNA_ADDR_FWVER_MASK
valid data mask
RoadNarrows RX Series Dynamixel Declarations.
void DumpCtlTbl(const char *sTblName, const DynaCtlTblEntry_T tblInfo[], size_t uSize)
Dump the servo control tabl values to stdout.
bool_t m_bSigned
entry is [not] signed integer
static const int DYNA_MODEL_NUM
#define DYNA_TRY_SERVO_ID(id)
Testing if the servo id is in range exception macro.
MX-28 Dynamixel Servo Class.
#define DYNA_OK
not an error, success
RoadNarrows MX Series Dynamixel Declarations.
static int ReadBaudRate(DynaComm &comm, int nServoId, int *pBaudRate)
Read the servo's baud rate from the servo's EEPROM.
int m_nOdDir
odometer direction: normal or reverse
#define DYNA_ADDR_MODEL_NUM_LSB
model number lsb (R)
uint_t m_uSize
entry size 1 or 2 bytes
virtual ~DynaServo()
Destructor.
static const int DYNA_MODEL_NUM
virtual int Reset(int nServoId)=0
Reset a servo back to default values.
#define DYNA_ADDR_MODEL_NUM_MASK
valid data mask
static const int DYNA_MODEL_NUM
DynaAgent_T * m_pAgent
servo agent
RX-64 Dynamixel Servo Class.
DynaServoCfg_T m_cfg
servo shadowed EEPROM configuration
AX-12, AX-12+, AX-12A Dynamixel Servo Class.
virtual int Read8(int nServoId, uint_t uAddr, byte_t *pVal)=0
Read an 8-bit value from Dynamixel servo control table.
static int ReadModelNumber(DynaComm &comm, int nServoId, uint_t *pModelNum)
Read the servo model number from the servo's EEPROM.
RoadNarrows AX-12, AX-12+, AX-12A Dynamixel Servo Class Interface.
RX-10 Dynamixel Servo Class Interface.
Generic Dynamixel Servo Base Class Interface.
INLINE_IN_H int iabs(int a)
Return absolute value of a.
static const int DYNA_MODEL_NUM
static const int DYNA_MODEL_NUM
virtual int Read16(int nServoId, uint_t uAddr, ushort_t *pVal)=0
Read a 16-bit value from Dynamixel servo control table.
virtual bool Ping(int nServoId)=0
Ping the servo.
const char * m_sFmt
alternal output format
#define DYNA_ADDR_ID_MASK
valid data mask
EX-106+ Dynamixel Servo Class.
Miscellaneous collection of useful utilities.
uint_t m_uFwVer
firmware version
RoadNarrows EX Series Dynamixel Declarations.
Dynamixel Servo Abstract Base Class.
const char * m_sName
entry name
#define DYNA_LOG_ERROR(ecode, efmt,...)
Log Error.
void * m_pAgentArg
servo agent callback argument
virtual void DisableOdometer()
Disable odometer mapping.
virtual int Write8(int nServoId, uint_t uAddr, byte_t byVal)=0
Write an 8-bit value to Dynamixel servo control table.
static int WriteServoId(DynaComm &comm, int nServoId, int nNewServoId)
Write the new servo id to the servo's EEPROM.
static int Reset(DynaComm &comm, int nServoId)
Reset the given servo back to default values.
static int ReadFirmwareVersion(DynaComm &comm, int nServoId, uint_t *pFwVer)
Read the servo's firmware version from the servo's EEPROM.
int m_nEncLastPos
last encoder position read from servo
Servo Control Table Entry.
uint_t m_uModelNum
servo model number
The libDynamixel internal declarations.
char * m_sModelName
model name
RoadNarrows MX-12W Dynamixel Servo Class Interface.
static DynaServo * New(DynaComm &comm, int nServoId)
Archetype constructor to create a new Dynamixel servo instance.
Generic Dynamixel Servo Base Class.
int m_nOdometer
current odometer reading (accumulator)
RoadNarrows RX-24F Dynamixel servo Class Interface.
MX-106 Dynamixel Servo Class.
int m_nEncZeroPt
servo encoder zero point position
#define DYNA_ADDR_BAUD_RATE
baud rate enumeration (RW)
static bool Ping(DynaComm &comm, int nServoId)
Ping the given servo.
virtual void Unlink()
Unlink this servo.
bool m_bOdEnabled
odometer mapping [not] enabled
RX-28 Dynamixel Servo Class.
MX-64 Dynamixel Servo Class.
static const int DYNA_MODEL_NUM
RoadNarrows RX-28 Dynamixel Servo Class Interface.
void Init(int nServoId, uint_t uModelNum, uint_t uFwVer)
Initialize servo class instance.
RoadNarrows RX-64 Dynamixel Servo Class Interface.
DynaServoOdometer_T m_od
servo virtual odometer
RoadNarrows Dynamixel Archetype Servo Abstract Base Class.
uint_t m_uCurPos
current position (encoder ticks)
static const int DYNA_MODEL_NUM
static const int DYNA_MODEL_NUM
#define DYNA_ADDR_ID
dynamixel id (RW)
RoadNarrows Dynamixel Top-Level Package Header File.
EX-106+ Dynamixel Servo Class Interface.
RX-24F Dynamixel Servo Class.
DynaComm & m_comm
attached Dynamixel bus comm. object
uint_t m_uRawPosMax
maximum raw position value (servo mode)
static const int DYNA_MODEL_NUM
DynaServoState_T m_state
servo shadowed RAM state
static int ReadServoId(DynaComm &comm, int nServoId, int *pServoId)
Read the servo's id from the servo's EEPROM.
DynaServoSpec_T m_spec
servo specification
uint_t m_uMask
mask of entry
static const int DYNA_MODEL_NUM
virtual int ResetOdometer(int nEncZeroPt, bool bIsReverse)
Reset the servo's virtual odometer.
#define DYNA_ECODE_BAD_VAL
bad value
MX-12W Dynamixel Servo Class.
RoadNarrows MX-28 Dynamixel Servo Class Interface.
RX-10 Dynamixel Servo Class.
RoadNarrows MX-64 Dynamixel Servo Class Interface.
#define DYNA_ADDR_FWVER
firmware version (R)
RoadNarrows Dynamixel Library Error and Logging Routines.
static int BaudRateToNum(int nBaudRate)
Map baud rate to Dynamixel baud number.
Dynamixel Bus Communications Abstract Base Class.
#define DYNA_TRY_COMM(comm)
Test if bus communication is available exception macro.