Dynamixel  2.9.5
RoadNarrows Robotics Dynamixel Package
DynaServoEX106P Class Reference

EX-106+ Dynamixel Servo Class. More...

#include <DynaServoEX106P.h>

Inheritance diagram for DynaServoEX106P:
DynaServoGeneric DynaServo

Public Member Functions

 DynaServoEX106P (DynaComm &comm)
 Bare-bones initialization constructor. More...
 
 DynaServoEX106P (DynaComm &comm, int nServoId, uint_t uModelNum=DYNA_MODEL_NUM, uint_t uFwVer=DYNA_FWVER_NA)
 Initialization constructor. More...
 
virtual ~DynaServoEX106P ()
 Destructor.
 
virtual const DynaEX106PCfgExt_TGetConfigurationExt ()
 Get servo extended configuration. More...
 
virtual const DynaEX106PStateExt_TGetStateExt ()
 Get servo extended state. More...
 
virtual int CfgReadDriveMode (bool *pIsMaster, bool *pIsNormal)
 Read from the servo configuration EEPROM the drive mode. More...
 
virtual int CfgWriteDriveMode (bool bIsMaster, bool bIsNormal)
 Write to the servo configuration EEPROM the new drive mode. More...
 
virtual int ReadSensedCurrent (uint_t *pMilliAmps, uint_t *pTorqueDir)
 Read from the servo configuration EEPROM the sensed current data. More...
 
virtual int Read (uint_t uAddr, uint_t *pVal)
 
virtual int Write (uint_t uAddr, uint_t uVal)
 
virtual int SyncCfg ()
 Synchronize the shadowed configuration to the servo control table EEPROM configuration. More...
 
virtual int SyncState ()
 Synchronize the shadowed state data to the servo control table RAM state. More...
 
virtual void Dump ()
 Dump contents of the servo EEPROM and RAM control tables.
 
- Public Member Functions inherited from DynaServoGeneric
 DynaServoGeneric (DynaComm &comm)
 Bare-bones initialization constructor. More...
 
 DynaServoGeneric (DynaComm &comm, int nServoId, uint_t uModelNum=DYNA_MODEL_NUM, uint_t uFwVer=DYNA_FWVER_NA)
 Initialization constructor. More...
 
virtual ~DynaServoGeneric ()
 Destructor.
 
virtual float CvtRawTempToC (uint uTemp)
 Convert raw temperature coding to degrees Celsius. More...
 
virtual float CvtRawVoltToVolts (uint uVolts)
 Convert raw volts coding to volts. More...
 
virtual int AgentWriteGoalPos (int nGoalOdPos)
 Agent write to the servo state memory to set the new goal position. More...
 
virtual int AgentWriteGoalSpeed (int nGoalSpeed)
 Agent write to the servo state memory to set the new goal speed. More...
 
virtual int AgentWriteGoalSpeedPos (int nGoalSpeed, int nGoalOdPos)
 Agent write to the servo state memory to set the new goal position and speed. More...
 
virtual int MoveTo (int nGoalOdPos)
 Move to the goal postition. More...
 
virtual int MoveAtSpeedTo (int nGoalSpeed, int nGoalOdPos)
 Move at speed to the goal postition. More...
 
virtual int MoveAtSpeed (int nGoalSpeed)
 Move at speed. More...
 
virtual int EStop ()
 Emergency stop servo. More...
 
virtual int Stop ()
 Stop servo. More...
 
virtual int Freeze ()
 Freeze servo at current position. More...
 
virtual int Release ()
 Release servo from any applied torque. More...
 
virtual int CfgReadRotationLimits (uint_t *pCwLim, uint_t *pCcwLim)
 Read from the servo configuration EEPROM the current rotation limits. More...
 
virtual int CfgWriteRotationLimits (uint_t uCwLim, uint_t uCcwLim)
 Write to the servo configuration EEPROM the new rotation limits. More...
 
virtual int CfgReadTemperatureLimit (uint_t *pTempLim)
 Read from the servo configuration EEPROM the current maximum temperature limit. More...
 
virtual int CfgWriteTemperatureLimit (uint_t uTempLim)
 Write to the servo configuration EEPROM the new maximum temperature limit. More...
 
virtual int CfgReadVoltageLimits (uint_t *pMinVoltLim, uint_t *pMaxVoltLim)
 Read from the servo configuration EEPROM the current voltage limits. More...
 
virtual int CfgWriteVoltageLimits (uint_t uMinVoltLim, uint_t uMaxVoltLim)
 Write to the servo configuration EEPROM the new voltage limits. More...
 
virtual int CfgReadMaxTorqueLimit (uint_t *pMaxTorqueLim)
 Read from the servo configuration EEPROM the current on power-up maximum torque limit. More...
 
virtual int CfgWriteMaxTorqueLimit (uint_t uMaxTorqueLim)
 Write to the servo configuration EEPROM the new on power-up maximum torque limit. More...
 
virtual int CfgReadAlarmShutdownMask (uint_t *pAlarmMask)
 Read from the servo configuration EEPROM the current servo shutdown on alarms mask. More...
 
virtual int CfgWriteAlarmShutdownMask (uint_t uAlarmMask)
 Write to the servo configuration EEPROM the new servo shutdown on alarms mask. More...
 
virtual int CfgReadServoMode (uint_t *pServoMode)
 Read from the servo configuration EEPROM to determine the servo operational mode. More...
 
virtual int CfgWriteServoMode (uint_t uCwLim, uint_t uCcwLim)
 Write to the servo configuration EEPROM to set the servo operational mode. More...
 
virtual int CfgWriteServoModeContinuous ()
 Write to the servo configuration EEPROM to set the servo operational mode to the full/continuous mode. More...
 
virtual int ReadTorqueEnable (bool *pState)
 Read from the servo state memory the current torque enable value. More...
 
virtual int WriteTorqueEnable (bool bState)
 Write to the servo state memory to set the new torque enable value. More...
 
virtual int ReadLed (bool *pState)
 Read from the servo state memory the current LED on/off value. More...
 
virtual int WriteLed (bool bState)
 Write to the servo state memory to turn on or off the servo LED. More...
 
virtual int ReadControlMethod (DynaServoCtlMethod_T *pCtlMethod)
 Read from the servo state memory the current control method parameters. More...
 
virtual int WriteControlMethod (DynaServoCtlMethod_T &ctlMethod)
 Write to the servo state memory the new control method parameters. More...
 
virtual int ReadGoalPos (int *pGoalPos)
 Read from the servo state memory the current goal position. More...
 
virtual int WriteGoalPos (int nGoalOdPos)
 Write to the servo state memory to set the new goal position. More...
 
virtual int ReadGoalSpeed (int *pGoalSpeed)
 Read from the servo state memory the current goal speed and direction. More...
 
virtual int WriteGoalSpeed (int nGoalSpeed)
 Write to the servo state memory the new goal speed and direction. More...
 
virtual int ReadMaxTorqueLimit (uint_t *pMaxTorqueLim)
 Read from the servo state memory the current maximum torque limit. More...
 
virtual int WriteMaxTorqueLimit (uint_t uMaxTorqueLim)
 Write to the servo state memory to set the new maximum torque limit. More...
 
virtual int ReloadMaxTorqueLimit ()
 Reload the maximum torque limit from the configuration. More...
 
virtual int ReadCurPos (int *pCurOdPos)
 Read from the servo state memory the current servo position. More...
 
virtual int ReadCurSpeed (int *pCurSpeed)
 Read from the servo state memory the current speed and direction. More...
 
virtual int ReadCurLoad (int *pCurLoad)
 Read from the servo state memory the current load. More...
 
virtual int ReadDynamics (int *pCurPos, int *pCurSpeed, int *pCurLoad)
 Read from the servo state memory the current servo dynamics. More...
 
virtual int ReadHealth (uint_t *pAlarms, int *pCurLoad, uint_t *pCurVolt, uint_t *pCurTemp)
 Read from the servo state memory the current servo health. More...
 
virtual int ReadIsMoving (bool *pState)
 Read from the servo state memory to test if the servo is currently moving. More...
 
virtual bool Ping ()
 Ping this servo. More...
 
virtual int Reset ()
 Reset this servo back to default values. More...
 
virtual int SyncData ()
 Synchronize the shadowed configuration and state data to the servo control table. More...
 
- Public Member Functions inherited from DynaServo
 DynaServo (DynaComm &comm, int nServoId, uint_t uModelNum, uint_t uFwVer)
 Default initialization constructor. More...
 
virtual ~DynaServo ()
 Destructor.
 
virtual uint_t GetModelNumber () const
 Get servo model number. More...
 
virtual uint_t GetFirmwareVersion () const
 Get servo firmware version. More...
 
virtual const char * GetModelName () const
 Get servo model name string. More...
 
virtual uint_t GetServoId () const
 Get servo id. More...
 
virtual uint_t GetServoMode () const
 Get the servo operational mode. More...
 
virtual uint_t Has360PosInfo () const
 Test if servo has 360 ° positioning information. More...
 
virtual const DynaServoSpec_TGetSpecification () const
 Get servo specification. More...
 
virtual const DynaServoCfg_TGetConfiguration () const
 Get servo configuration. More...
 
virtual const DynaServoState_TGetState () const
 Get servo state. More...
 
bool IsMaster () const
 Test if this servo is a master. More...
 
bool IsLinkedMaster () const
 Test if this servo is a linked master. More...
 
bool IsUnlinked () const
 Test if this servo is unlinked. More...
 
virtual const DynaServoLink_T GetLinkInfo () const
 Get linked information. More...
 
virtual void Link (uint_t uLinkType, DynaServo *pServoMate, bool bRotReversed)
 Link this servo to another. More...
 
virtual void Unlink ()
 Unlink this servo.
 
int GetOdometer ()
 Get the current virtual odometer value. More...
 
int IsOdometerEnabled ()
 Test if virtual odometer mapping is enabled. More...
 
int GetOdometerZeroPt ()
 Get the virtual odometer zero point. More...
 
bool IsOdometerReversed ()
 Test if the virtual odometer is reversed. More...
 
int CalcOdometerAtEncMin ()
 Calculate the odometer value at the minimum (zero) encoder value. More...
 
int CalcOdometerAtEncMax ()
 Calculate the odometer value at the maximum encoder value. More...
 
int OdometerToEncoder (int nOdPos)
 Convert virtual odometer units to servo encoder units. More...
 
int CalcSpeedDir (int nOdGoalPos)
 Calculate serve direction to goal odometer position. More...
 
virtual int ResetOdometer (int nEncZeroPt, bool bIsReverse)
 Reset the servo's virtual odometer. More...
 
virtual int UpdateOdometer (int nEncCurPos)
 Update the odometer from the current servo position and rotation direction. More...
 
virtual void DisableOdometer ()
 Disable odometer mapping. More...
 
virtual uint_t GetAlarms () const
 Get the current servo alarms. More...
 
virtual uint_t GetCurPos () const
 Get the current servo position. More...
 
virtual int GetCurSpeed () const
 Get the current servo speed. More...
 
virtual int GetGoalSpeed () const
 Get the goal servo speed. More...
 
virtual int GetCurLoad () const
 Get the current servo load. More...
 
virtual uint_t GetCurTemp () const
 Get the current temperature. More...
 
virtual uint_t GetCurVolt () const
 Get the current voltage. More...
 
virtual void SetSoftTorqueThresholds (uint_t uOverTorqueTh, uint_t uClearTorqueTh)
 Set soft torque thresholds. More...
 
virtual void GetSoftTorqueThresholds (uint_t &uOverTorqueTh, uint_t &uClearTorqueTh)
 Get soft torque thresholds. More...
 
virtual void SetSoftTorqueOverCond (bool bNewCond)
 Set or clear servo in soft over torque condition. More...
 
virtual bool HasSoftTorqueOverCond ()
 Test if servo is in a soft over torque condition. More...
 
virtual void RegisterAgent (DynaAgent_T *pAgent, void *pAgentArg)
 Register servo proxy agent. More...
 
virtual void UnregisterAgent ()
 Unregister servo proxy agent.
 
virtual bool HasAgent ()
 Tests if servo has a registered agent. More...
 

Static Public Attributes

static const int DYNA_MODEL_NUM = DYNA_MODEL_NUM_EX106P
 
- Static Public Attributes inherited from DynaServoGeneric
static const int DYNA_MODEL_NUM = DYNA_MODEL_NUM_GENERIC
 

Protected Member Functions

void Init (int nServoid, uint_t uFwVer)
 Initialize servo class instance. More...
 
void InitSpec ()
 Initialize servo fixed specification data.
 
void InitCfg ()
 Initialize servo configuration data.
 
void InitState ()
 Initialize servo state data.
 
uint_t PackDriveMode (bool bIsMaster, bool bIsNormal)
 Pack drive mode. More...
 
int UnpackDriveMode (uint_t uVal, bool *pIsMaster, bool *pIsNormal)
 Unpack drive mode. More...
 
int UnpackSensedCurrent (uint_t uVal, uint_t *pMilliAmps, uint_t *pTorqueDir)
 Unpack sensed current. More...
 
- Protected Member Functions inherited from DynaServoGeneric
void Init ()
 Initialize servo class instance.
 
void InitSpec ()
 Initialize servo fixed specification data.
 
void InitCfg ()
 Initialize servo configuration data.
 
void InitState ()
 Initialize servo state data.
 
virtual void CheckData ()
 Check data for consitencies. More...
 
void SetServoMode ()
 Set the servo mode given the servo capabilites and the current rotation limits. More...
 
virtual int CalcMatesGoalPos (int nGoalOdPos, int *pGoalOdPosMate)
 Calculate the linked mate's goal position given this servo's goal position. More...
 
virtual int CalcMatesGoalSpeed (int nGoalSpeed)
 Calculate the linked mate's speed speed given this servo's goal speed. More...
 
virtual int ReadCtlMethodCompliance (DynaServoCtlMethod_T *pCtlMethod)
 Read from the servo state memory the current compliance control method parameters. More...
 
virtual int WriteCtlMethodCompliance (DynaServoCtlMethod_T &ctlMethod)
 Write to the servo state memory the new compliance control method parameters. More...
 
virtual int ReadCtlMethodPid (DynaServoCtlMethod_T *pCtlMethod)
 Read from the servo state memory the current PID control method parameters. More...
 
virtual int WriteCtlMethodPid (DynaServoCtlMethod_T &ctlMethod)
 Write to the servo state memory the new PID control method parameters. More...
 
virtual bool ChkComplianceSlope (uint_t uVal)
 Check validity of compliance slope discrete values. More...
 
virtual uint_t PackGoalSpeed (int nGoalSpeed)
 Pack the goal speed into the control table value. More...
 
virtual int UnpackGoalSpeed (uint_t uVal)
 Unpack goal speed from the control table value. More...
 
virtual int UnpackCurSpeed (uint_t uVal)
 Unpack current speed from the control table value. More...
 
virtual int UnpackCurLoad (uint_t uVal)
 Unpack current load estimate from the control table value. More...
 
- Protected Member Functions inherited from DynaServo
void Init (int nServoId, uint_t uModelNum, uint_t uFwVer)
 Initialize servo class instance. More...
 
void DumpCtlTbl (const char *sTblName, const DynaCtlTblEntry_T tblInfo[], size_t uSize)
 Dump the servo control tabl values to stdout. More...
 

Protected Attributes

DynaEX106PCfgExt_T m_cfgExt
 configuration extension data
 
DynaEX106PStateExt_T m_stateExt
 state extension data
 
- Protected Attributes inherited from DynaServo
DynaCommm_comm
 attached Dynamixel bus comm. object
 
int m_nServoId
 servo id
 
DynaServoSpec_T m_spec
 servo specification
 
DynaServoCfg_T m_cfg
 servo shadowed EEPROM configuration
 
DynaServoState_T m_state
 servo shadowed RAM state
 
CrossLink_T m_link
 servo cross linkage
 
DynaAgent_Tm_pAgent
 servo agent
 
void * m_pAgentArg
 servo agent callback argument
 
int m_nErrorCode
 class instance errored state
 

Additional Inherited Members

- Static Public Member Functions inherited from DynaServo
static DynaServoNew (DynaComm &comm, int nServoId)
 Archetype constructor to create a new Dynamixel servo instance. More...
 
static int ReadModelNumber (DynaComm &comm, int nServoId, uint_t *pModelNum)
 Read the servo model number from the servo's EEPROM. More...
 
static int ReadFirmwareVersion (DynaComm &comm, int nServoId, uint_t *pFwVer)
 Read the servo's firmware version from the servo's EEPROM. More...
 
static int ReadServoId (DynaComm &comm, int nServoId, int *pServoId)
 Read the servo's id from the servo's EEPROM. More...
 
static int WriteServoId (DynaComm &comm, int nServoId, int nNewServoId)
 Write the new servo id to the servo's EEPROM. More...
 
static int ReadBaudRate (DynaComm &comm, int nServoId, int *pBaudRate)
 Read the servo's baud rate from the servo's EEPROM. More...
 
static int WriteBaudRate (DynaComm &comm, int nServoId, int nNewBaudRate)
 Write the new baud rate to the servo's EEPROM. More...
 
static bool Ping (DynaComm &comm, int nServoId)
 Ping the given servo. More...
 
static int Reset (DynaComm &comm, int nServoId)
 Reset the given servo back to default values. More...
 

Detailed Description

EX-106+ Dynamixel Servo Class.

The DynaServoEX106P class provides the specific interface to the EX-106+ Dynamixel servos

Definition at line 111 of file DynaServoEX106P.h.

Constructor & Destructor Documentation

DynaServoEX106P::DynaServoEX106P ( DynaComm comm)
inline

Bare-bones initialization constructor.

May be used be derived classes to avoid undue communication and initializaton overhead.

Parameters
commDynamixel bus communication instance.

Definition at line 126 of file DynaServoEX106P.h.

References DYNA_FWVER_NA, and ~DynaServoEX106P().

126  : DynaServoGeneric(comm)
127  {
128  }
DynaServoGeneric(DynaComm &comm)
Bare-bones initialization constructor.
DynaServoEX106P::DynaServoEX106P ( DynaComm comm,
int  nServoId,
uint_t  uModelNum = DYNA_MODEL_NUM,
uint_t  uFwVer = DYNA_FWVER_NA 
)

Initialization constructor.

Parameters
commDynamixel bus communication instance.
nServoIdServo Id.
uModelNumServo model number.
uFwVerServo firmware version.

Definition at line 134 of file DynaServoEX106P.cxx.

References DynaServoGeneric::CheckData(), DynaServoGeneric::Init(), and DynaServoGeneric::SyncData().

137  :
138  DynaServoGeneric(comm)
139 {
140  Init(nServoId, uFwVer); // this class
141  SyncData(); // this class
142  CheckData(); // this class
143 }
void Init()
Initialize servo class instance.
DynaServoGeneric(DynaComm &comm)
Bare-bones initialization constructor.
virtual void CheckData()
Check data for consitencies.
virtual int SyncData()
Synchronize the shadowed configuration and state data to the servo control table. ...

Member Function Documentation

int DynaServoEX106P::CfgReadDriveMode ( bool *  pIsMaster,
bool *  pIsNormal 
)
virtual

Read from the servo configuration EEPROM the drive mode.

If this servo is the master in a linked pair of servos, both servos' configuration data are read.

Note
Drive mode requires the paired EX-106+'s to be connected via the synchronization cable.
Control Table:
dyna_ex106p_memmap_drive_mode.
Parameters
[out]pIsMasterThis servo is [not] the master.
[out]pIsNormalServos [don't] rotate in same directions.
Returns
On success, DYNA_OK is returned.
On error, the appropriate < 0 negated Dynamixel Error Code is returned.

Definition at line 154 of file DynaServoEX106P.cxx.

References CfgReadDriveMode(), DYNA_EX106P_ADDR_DRIVE_MODE, DYNA_OK, DYNA_TRY_COMM, DynaServo::IsLinkedMaster(), DynaEX106PCfgExt_T::m_bDriveModeIsMaster, DynaEX106PCfgExt_T::m_bDriveModeIsNormal, m_cfgExt, DynaServo::m_comm, DynaServo::m_link, DynaServo::m_nServoId, DynaServo::CrossLink_T::m_pServoMate, DynaComm::Read8(), and UnpackDriveMode().

Referenced by CfgReadDriveMode(), GetStateExt(), and SyncCfg().

155 {
156  uint_t uVal; // working value
157  bool bVal1, bVal2; // working booleans
158  DynaServoEX106P *pServoMate; // servo mate
159  int rc; // return code
160 
162 
164 
165  if( rc == DYNA_OK )
166  {
169 
170  *pIsMaster = m_cfgExt.m_bDriveModeIsMaster;
171  *pIsNormal = m_cfgExt.m_bDriveModeIsNormal;
172 
173  if( IsLinkedMaster() )
174  {
175  pServoMate = (DynaServoEX106P *)(m_link.m_pServoMate);
176 
177  rc = pServoMate->CfgReadDriveMode(&bVal1, &bVal2);
178  }
179  }
180 
181  return rc;
182 }
bool IsLinkedMaster() const
Test if this servo is a linked master.
Definition: DynaServo.h:236
#define DYNA_OK
not an error, success
Definition: Dynamixel.h:78
virtual int Read8(int nServoId, uint_t uAddr, byte_t *pVal)=0
Read an 8-bit value from Dynamixel servo control table.
virtual int CfgReadDriveMode(bool *pIsMaster, bool *pIsNormal)
Read from the servo configuration EEPROM the drive mode.
DynaEX106PCfgExt_T m_cfgExt
configuration extension data
EX-106+ Dynamixel Servo Class.
int UnpackDriveMode(uint_t uVal, bool *pIsMaster, bool *pIsNormal)
Unpack drive mode.
CrossLink_T m_link
servo cross linkage
Definition: DynaServo.h:840
int m_nServoId
servo id
Definition: DynaServo.h:836
DynaComm & m_comm
attached Dynamixel bus comm. object
Definition: DynaServo.h:835
#define DYNA_EX106P_ADDR_DRIVE_MODE
EEPROM drive mode (RW)
Definition: EX.h:233
bool m_bDriveModeIsMaster
master (slave) servo
bool m_bDriveModeIsNormal
normal (reverse) rotation to each other
#define DYNA_TRY_COMM(comm)
Test if bus communication is available exception macro.
int DynaServoEX106P::CfgWriteDriveMode ( bool  bIsMaster,
bool  bIsNormal 
)
virtual

Write to the servo configuration EEPROM the new drive mode.

If this servo is the master in a linked pair of servos, both servos' configuration data are written appropriately.

Note
Drive mode requires the paired EX-106+'s to be connected via the synchronization cable.
Control Table:
dyna_ex106p_memmap_drive_mode.
Parameters
pIsMasterThis servo is [not] the master.
pIsNormalServos [don't] rotate in same directions.
Returns
On success, DYNA_OK is returned.
On error, the appropriate < 0 negated Dynamixel Error Code is returned.

Definition at line 184 of file DynaServoEX106P.cxx.

References DYNA_ECODE_BAD_VAL, DYNA_EX106P_ADDR_DRIVE_MODE, DYNA_OK, DYNA_TRY_COMM, DYNA_TRY_EXPR, DYNA_TRY_IS_MASTER, DynaServo::GetServoId(), DynaServo::IsLinkedMaster(), DynaEX106PCfgExt_T::m_bDriveModeIsMaster, DynaEX106PCfgExt_T::m_bDriveModeIsNormal, m_cfgExt, DynaServo::m_comm, DynaServo::m_link, DynaServo::m_nServoId, DynaServo::CrossLink_T::m_pServoMate, PackDriveMode(), DynaComm::vSyncWrite(), and DynaComm::Write8().

Referenced by GetStateExt().

185 {
186  uint_t uVal1, uVal2; // working values
187  DynaServoEX106P *pServoMate; // servo mate
188  int rc; // return code
189 
191  DYNA_TRY_IS_MASTER(this);
192 
193  uVal1 = PackDriveMode(bIsMaster, bIsNormal);
194 
195  //
196  // Linked pair
197  //
198  if( IsLinkedMaster() )
199  {
200  DYNA_TRY_EXPR((bIsMaster), DYNA_ECODE_BAD_VAL,
201  "Linked master servo %d: Drive mode must also be master.", m_nServoId);
202 
203  pServoMate = (DynaServoEX106P *)(m_link.m_pServoMate);
204 
205  uVal2 = PackDriveMode(false, bIsNormal);
206 
208  m_nServoId, uVal1,
209  pServoMate->GetServoId(), uVal2);
210 
211  if( rc == DYNA_OK )
212  {
214  m_cfgExt.m_bDriveModeIsNormal = bIsNormal;
215 
216  pServoMate->m_cfgExt.m_bDriveModeIsMaster = false;
217  pServoMate->m_cfgExt.m_bDriveModeIsNormal = bIsNormal;
218  }
219  }
220 
221  //
222  // Solitary servo
223  //
224  else
225  {
227 
228  if( rc == DYNA_OK )
229  {
230  m_cfgExt.m_bDriveModeIsMaster = bIsMaster;
231  m_cfgExt.m_bDriveModeIsNormal = bIsNormal;
232  }
233  }
234 
235  return rc;
236 }
bool IsLinkedMaster() const
Test if this servo is a linked master.
Definition: DynaServo.h:236
#define DYNA_OK
not an error, success
Definition: Dynamixel.h:78
virtual int vSyncWrite(uint_t uAddr, uint_t uValSize, uint_t uCount,...)
Synchronous write 8/16-bit values to a list of Dynamixel servos.
Definition: DynaComm.cxx:420
#define DYNA_TRY_EXPR(expr, ecode, efmt,...)
Test if the servo is in the required mode(s) exception macro.
#define DYNA_TRY_IS_MASTER(pservo)
Test if the servo is a master servo.
DynaEX106PCfgExt_T m_cfgExt
configuration extension data
EX-106+ Dynamixel Servo Class.
virtual int Write8(int nServoId, uint_t uAddr, byte_t byVal)=0
Write an 8-bit value to Dynamixel servo control table.
CrossLink_T m_link
servo cross linkage
Definition: DynaServo.h:840
int m_nServoId
servo id
Definition: DynaServo.h:836
virtual uint_t GetServoId() const
Get servo id.
Definition: DynaServo.h:155
DynaComm & m_comm
attached Dynamixel bus comm. object
Definition: DynaServo.h:835
uint_t PackDriveMode(bool bIsMaster, bool bIsNormal)
Pack drive mode.
#define DYNA_EX106P_ADDR_DRIVE_MODE
EEPROM drive mode (RW)
Definition: EX.h:233
#define DYNA_ECODE_BAD_VAL
bad value
Definition: Dynamixel.h:85
bool m_bDriveModeIsMaster
master (slave) servo
bool m_bDriveModeIsNormal
normal (reverse) rotation to each other
#define DYNA_TRY_COMM(comm)
Test if bus communication is available exception macro.
virtual const DynaEX106PCfgExt_T& DynaServoEX106P::GetConfigurationExt ( )
inlinevirtual

Get servo extended configuration.

Returns
Reference to shadowed configuration extension data.

Definition at line 158 of file DynaServoEX106P.h.

References m_cfgExt.

159  {
160  return m_cfgExt;
161  }
DynaEX106PCfgExt_T m_cfgExt
configuration extension data
virtual const DynaEX106PStateExt_T& DynaServoEX106P::GetStateExt ( )
inlinevirtual

Get servo extended state.

Returns
Reference to shadowed state extension data.

Definition at line 168 of file DynaServoEX106P.h.

References CfgReadDriveMode(), CfgWriteDriveMode(), Dump(), m_stateExt, Read(), ReadSensedCurrent(), SyncCfg(), SyncState(), and Write().

169  {
170  return m_stateExt;
171  }
DynaEX106PStateExt_T m_stateExt
state extension data
void DynaServoEX106P::Init ( int  nServoid,
uint_t  uFwVer 
)
protected

Initialize servo class instance.

Parameters
nServoIdServo Id.
uFwVerServo firmware version.

Definition at line 344 of file DynaServoEX106P.cxx.

References DYNA_MODEL_NUM, DynaServo::Init(), InitCfg(), InitSpec(), and InitState().

345 {
346  DynaServo::Init(nServoId, DYNA_MODEL_NUM, uFwVer);
347 
348  InitSpec(); // this class
349  InitCfg(); // this class
350  InitState(); // this class
351 }
void InitSpec()
Initialize servo fixed specification data.
void InitCfg()
Initialize servo configuration data.
static const int DYNA_MODEL_NUM
void Init(int nServoId, uint_t uModelNum, uint_t uFwVer)
Initialize servo class instance.
Definition: DynaServo.cxx:406
void InitState()
Initialize servo state data.
uint_t DynaServoEX106P::PackDriveMode ( bool  bIsMaster,
bool  bIsNormal 
)
protected

Pack drive mode.

Parameters
bIsMasterThis servo is [not] the master.
bIsNormalServos [don't] rotate in same directions.
Returns
Returns packed value.

Definition at line 413 of file DynaServoEX106P.cxx.

References DYNA_EX106P_DRIVE_MODE_MS_MASTER, DYNA_EX106P_DRIVE_MODE_MS_SLAVE, DYNA_EX106P_DRIVE_MODE_NR_NORM, and DYNA_EX106P_DRIVE_MODE_NR_REV.

Referenced by CfgWriteDriveMode().

414 {
415  uint_t uVal;
416 
417  uVal = bIsMaster? DYNA_EX106P_DRIVE_MODE_MS_MASTER:
419 
420  uVal |= bIsNormal? DYNA_EX106P_DRIVE_MODE_NR_NORM:
422 
423  return uVal;
424 }
#define DYNA_EX106P_DRIVE_MODE_MS_SLAVE
dual joint slave
Definition: EX.h:238
#define DYNA_EX106P_DRIVE_MODE_NR_REV
dual joint reverse rotation
Definition: EX.h:241
#define DYNA_EX106P_DRIVE_MODE_MS_MASTER
dual joint master
Definition: EX.h:237
#define DYNA_EX106P_DRIVE_MODE_NR_NORM
dual joint normal rotation
Definition: EX.h:239
int DynaServoEX106P::Read ( uint_t  uAddr,
uint_t *  pVal 
)
virtual

Read a raw value from the servo EEPROM/RAM control table.

Warning
The shadowed configuration and state data are not update.
Linked servos are not kept in sync.
Parameters
uAddrControl table address.
[out]pValRead raw value.

doc_return_std

Reimplemented from DynaServoGeneric.

Definition at line 267 of file DynaServoEX106P.cxx.

References DYNA_EX106P_ADDR_CURRENT_LSB, DYNA_EX106P_ADDR_DRIVE_MODE, DYNA_TRY_ADDR, DYNA_TRY_COMM, DynaServo::m_comm, DynaServo::m_nServoId, DynaServoGeneric::Read(), DynaComm::Read16(), and DynaComm::Read8().

Referenced by GetStateExt().

268 {
270  DYNA_TRY_ADDR(uAddr);
271 
272  switch( uAddr )
273  {
275  return m_comm.Read16(m_nServoId, uAddr, pVal);
276 
278  return m_comm.Read8(m_nServoId, uAddr, pVal);
279 
280  default:
281  return DynaServoGeneric::Read(uAddr, pVal);
282  }
283 }
virtual int Read8(int nServoId, uint_t uAddr, byte_t *pVal)=0
Read an 8-bit value from Dynamixel servo control table.
#define DYNA_TRY_ADDR(addr)
Test if servo address is valid.
virtual int Read16(int nServoId, uint_t uAddr, ushort_t *pVal)=0
Read a 16-bit value from Dynamixel servo control table.
int m_nServoId
servo id
Definition: DynaServo.h:836
virtual int Read(uint_t uAddr, uint_t *pVal)
DynaComm & m_comm
attached Dynamixel bus comm. object
Definition: DynaServo.h:835
#define DYNA_EX106P_ADDR_CURRENT_LSB
sensed current draw (lsb)
Definition: EX.h:298
#define DYNA_EX106P_ADDR_DRIVE_MODE
EEPROM drive mode (RW)
Definition: EX.h:233
#define DYNA_TRY_COMM(comm)
Test if bus communication is available exception macro.
int DynaServoEX106P::ReadSensedCurrent ( uint_t *  pMilliAmps,
uint_t *  pTorqueDir 
)
virtual

Read from the servo configuration EEPROM the sensed current data.

If this servo is the master in a linked pair of servos, both servos' configuration data are read.

Control Table:
dyna_ex106p_memmap_drive_mode.
Parameters
[out]pMillAmpsSensed mAmps.
[out]pTorqueDirSensed applied torque direction.
Returns
On success, DYNA_OK is returned.
On error, the appropriate < 0 negated Dynamixel Error Code is returned.

Definition at line 238 of file DynaServoEX106P.cxx.

References DYNA_EX106P_ADDR_CURRENT_LSB, DYNA_OK, DYNA_TRY_COMM, DynaServo::IsLinkedMaster(), DynaServo::m_comm, DynaServo::m_link, DynaServo::m_nServoId, DynaServo::CrossLink_T::m_pServoMate, m_stateExt, DynaEX106PStateExt_T::m_uSensedCurrentMilliAmps, DynaEX106PStateExt_T::m_uSensedCurrentTorqueDir, DynaComm::Read16(), ReadSensedCurrent(), and UnpackSensedCurrent().

Referenced by GetStateExt(), ReadSensedCurrent(), and SyncState().

239 {
240  uint_t uVal1, uVal2; // working values
241  DynaServoEX106P *pServoMate; // servo mate
242  int rc; // return code
243 
245 
247 
248  if( rc == DYNA_OK )
249  {
252 
255 
256  if( IsLinkedMaster() )
257  {
258  pServoMate = (DynaServoEX106P *)(m_link.m_pServoMate);
259 
260  rc = pServoMate->ReadSensedCurrent(&uVal1, &uVal2);
261  }
262  }
263 
264  return rc;
265 }
bool IsLinkedMaster() const
Test if this servo is a linked master.
Definition: DynaServo.h:236
#define DYNA_OK
not an error, success
Definition: Dynamixel.h:78
uint_t m_uSensedCurrentTorqueDir
sensed applied torque direction
virtual int Read16(int nServoId, uint_t uAddr, ushort_t *pVal)=0
Read a 16-bit value from Dynamixel servo control table.
EX-106+ Dynamixel Servo Class.
CrossLink_T m_link
servo cross linkage
Definition: DynaServo.h:840
DynaEX106PStateExt_T m_stateExt
state extension data
virtual int ReadSensedCurrent(uint_t *pMilliAmps, uint_t *pTorqueDir)
Read from the servo configuration EEPROM the sensed current data.
int m_nServoId
servo id
Definition: DynaServo.h:836
DynaComm & m_comm
attached Dynamixel bus comm. object
Definition: DynaServo.h:835
#define DYNA_EX106P_ADDR_CURRENT_LSB
sensed current draw (lsb)
Definition: EX.h:298
int UnpackSensedCurrent(uint_t uVal, uint_t *pMilliAmps, uint_t *pTorqueDir)
Unpack sensed current.
uint_t m_uSensedCurrentMilliAmps
sensed current milli-amperes
#define DYNA_TRY_COMM(comm)
Test if bus communication is available exception macro.
int DynaServoEX106P::SyncCfg ( )
virtual

Synchronize the shadowed configuration to the servo control table EEPROM configuration.

Returns
On success, DYNA_OK is returned.
On error, the appropriate < 0 negated Dynamixel Error Code is returned.

Reimplemented from DynaServoGeneric.

Definition at line 303 of file DynaServoEX106P.cxx.

References CfgReadDriveMode(), DYNA_OK, DYNA_TRY_COMM, DynaServo::m_comm, and DynaServoGeneric::SyncCfg().

Referenced by GetStateExt().

304 {
305  bool bVal1, bVal2; // working booleans
306 
308 
310 
311  CfgReadDriveMode(&bVal1, &bVal2);
312 
313  return DYNA_OK;
314 }
#define DYNA_OK
not an error, success
Definition: Dynamixel.h:78
virtual int CfgReadDriveMode(bool *pIsMaster, bool *pIsNormal)
Read from the servo configuration EEPROM the drive mode.
virtual int SyncCfg()
Synchronize the shadowed configuration to the servo control table EEPROM configuration.
DynaComm & m_comm
attached Dynamixel bus comm. object
Definition: DynaServo.h:835
#define DYNA_TRY_COMM(comm)
Test if bus communication is available exception macro.
int DynaServoEX106P::SyncState ( )
virtual

Synchronize the shadowed state data to the servo control table RAM state.

Returns
On success, DYNA_OK is returned.
On error, the appropriate < 0 negated Dynamixel Error Code is returned.

Reimplemented from DynaServoGeneric.

Definition at line 316 of file DynaServoEX106P.cxx.

References DYNA_OK, DYNA_TRY_COMM, DynaServo::m_comm, ReadSensedCurrent(), and DynaServoGeneric::SyncState().

Referenced by GetStateExt().

317 {
318  uint_t uVal1, uVal2; // working values
319 
321 
323 
324  ReadSensedCurrent(&uVal1, &uVal2);
325 
326  return DYNA_OK;
327 }
#define DYNA_OK
not an error, success
Definition: Dynamixel.h:78
virtual int SyncState()
Synchronize the shadowed state data to the servo control table RAM state.
virtual int ReadSensedCurrent(uint_t *pMilliAmps, uint_t *pTorqueDir)
Read from the servo configuration EEPROM the sensed current data.
DynaComm & m_comm
attached Dynamixel bus comm. object
Definition: DynaServo.h:835
#define DYNA_TRY_COMM(comm)
Test if bus communication is available exception macro.
int DynaServoEX106P::UnpackDriveMode ( uint_t  uVal,
bool *  pIsMaster,
bool *  pIsNormal 
)
protected

Unpack drive mode.

Parameters
uValPacked field.
[out]pIsMasterThis servo is [not] the master).
[out]pIsNormalServos [don't] rotate in same directions.
Returns
On success, DYNA_OK is returned.
On error, the appropriate < 0 negated Dynamixel Error Code is returned.

Definition at line 426 of file DynaServoEX106P.cxx.

References DYNA_EX106P_DRIVE_MODE_MS_SLAVE, DYNA_EX106P_DRIVE_MODE_NR_REV, and DYNA_OK.

Referenced by CfgReadDriveMode().

429 {
430  *pIsMaster = uVal & DYNA_EX106P_DRIVE_MODE_MS_SLAVE? false: true;
431 
432  *pIsNormal = uVal & DYNA_EX106P_DRIVE_MODE_NR_REV? false: true;
433 
434  return DYNA_OK;
435 }
#define DYNA_OK
not an error, success
Definition: Dynamixel.h:78
#define DYNA_EX106P_DRIVE_MODE_MS_SLAVE
dual joint slave
Definition: EX.h:238
#define DYNA_EX106P_DRIVE_MODE_NR_REV
dual joint reverse rotation
Definition: EX.h:241
int DynaServoEX106P::UnpackSensedCurrent ( uint_t  uVal,
uint_t *  pMilliAmps,
uint_t *  pTorqueDir 
)
protected

Unpack sensed current.

Parameters
uValPacked field.
[out]pMilliAmpsSensed mAmps.
[out]pTorqueDirSensed torque direction. See Dynamixel Direction Common Values.
Returns
On success, DYNA_OK is returned.
On error, the appropriate < 0 negated Dynamixel Error Code is returned.

Definition at line 437 of file DynaServoEX106P.cxx.

References DYNA_EX106P_CURRENT_M_AMP, DYNA_EX106P_CURRENT_RES_M_AMP, DYNA_EX106P_CURRENT_TORQUE_DIR, and DYNA_OK.

Referenced by ReadSensedCurrent().

440 {
442 
443  *pTorqueDir = DYNA_EX106P_CURRENT_TORQUE_DIR(uVal);
444 
445  return DYNA_OK;
446 }
#define DYNA_OK
not an error, success
Definition: Dynamixel.h:78
#define DYNA_EX106P_CURRENT_RES_M_AMP
10mA resolution
Definition: EX.h:303
#define DYNA_EX106P_CURRENT_M_AMP(val)
Current(mA) / 10.
Definition: EX.h:315
#define DYNA_EX106P_CURRENT_TORQUE_DIR(val)
Torque direction.
Definition: EX.h:322
int DynaServoEX106P::Write ( uint_t  uAddr,
uint_t  uVal 
)
virtual

Write a raw value to the servo EEPROM/RAM control table.

Warning
The shadowed configuration and state data are not updated and will hence be out of sync.
Any linked master-slave servos may get out of sync and may result in physical damage.
Parameters
uAddrControl table address.
uValRaw value to write.

doc_return_std

Reimplemented from DynaServoGeneric.

Definition at line 285 of file DynaServoEX106P.cxx.

References DYNA_EX106P_ADDR_CURRENT_LSB, DYNA_EX106P_ADDR_DRIVE_MODE, DYNA_TRY_ADDR, DYNA_TRY_COMM, DynaServo::m_comm, DynaServo::m_nServoId, DynaServoGeneric::Write(), DynaComm::Write16(), and DynaComm::Write8().

Referenced by GetStateExt().

286 {
288  DYNA_TRY_ADDR(uAddr);
289 
290  switch( uAddr )
291  {
293  return m_comm.Write16(m_nServoId, uAddr, uVal);
294 
296  return m_comm.Write8(m_nServoId, uAddr, uVal);
297 
298  default:
299  return DynaServoGeneric::Write(uAddr, uVal);
300  }
301 }
#define DYNA_TRY_ADDR(addr)
Test if servo address is valid.
virtual int Write8(int nServoId, uint_t uAddr, byte_t byVal)=0
Write an 8-bit value to Dynamixel servo control table.
virtual int Write16(int nServoId, uint_t uAddr, ushort_t uhVal)=0
Write a 16-bit value to Dynamixel servo control table.
int m_nServoId
servo id
Definition: DynaServo.h:836
DynaComm & m_comm
attached Dynamixel bus comm. object
Definition: DynaServo.h:835
#define DYNA_EX106P_ADDR_CURRENT_LSB
sensed current draw (lsb)
Definition: EX.h:298
#define DYNA_EX106P_ADDR_DRIVE_MODE
EEPROM drive mode (RW)
Definition: EX.h:233
virtual int Write(uint_t uAddr, uint_t uVal)
#define DYNA_TRY_COMM(comm)
Test if bus communication is available exception macro.

Member Data Documentation

const int DynaServoEX106P::DYNA_MODEL_NUM = DYNA_MODEL_NUM_EX106P
static

modem number

Definition at line 115 of file DynaServoEX106P.h.

Referenced by Init(), and DynaServo::New().


The documentation for this class was generated from the following files: