![]() |
Dynamixel
2.9.5
RoadNarrows Robotics Dynamixel Package
|
The libDynamixel internal declarations. More...
#include <errno.h>
#include "rnr/rnrconfig.h"
#include "rnr/new.h"
#include "rnr/log.h"
#include "Dynamixel/Dynamixel.h"
#include "Dynamixel/DynaError.h"
Go to the source code of this file.
Macros | |
#define | DYNA_LOG_ERROR(ecode, efmt, ...) |
Log Error. More... | |
#define | DYNA_LOG_SYS_ERROR(ecode, efmt, ...) |
Log System Error. More... | |
#define | DYNA_LOG_COMM_ERROR(estat, efmt, ...) |
Log Error. More... | |
#define | DYNA_LOG_BUF(sPreface, buf, uCount, sFmt) |
Log buffer of infrared readings. More... | |
#define | DYNA_LOG_SERVO_ALARMS(id, alarms) |
Log servo alarms. More... | |
#define | DYNA_TRY_RC(rc, fmt, ...) |
Test if Dynamixel return code is not an error. More... | |
#define | DYNA_TRY_COMM(comm) |
Test if bus communication is available exception macro. More... | |
#define | DYNA_TRY_SERVO_ID(id) |
Testing if the servo id is in range exception macro. More... | |
#define | DYNA_TRY_IS_MASTER(pservo) |
Test if the servo is a master servo. More... | |
#define | DYNA_TRY_IS_UNLINKED(pservo) |
Test if the servo is unlinked. More... | |
#define | DYNA_TRY_SERVO_HAS_MODE(pservo, mode) |
Test if the servo has one of the required modes exception macro. More... | |
#define | DYNA_TRY_SERVO_IN_MODE(pservo, mode) |
Test if the servo is in the given mode. More... | |
#define | DYNA_TRY_SERVO_HAS_POS_CTL(pservo) |
Test if the servo has positiion control. More... | |
#define | DYNA_TRY_SERVO_HAS_AGENT(pservo) |
Test if the servo has a proxy agent. More... | |
#define | DYNA_TRY_ADDR(addr) |
Test if servo address is valid. More... | |
#define | DYNA_TRY_SERVO_IN_CHAIN(pchain, id) |
Test if the servo id is valid and present in chain exception macro. More... | |
#define | DYNA_TRY_EXPR(expr, ecode, efmt, ...) |
Test if the servo is in the required mode(s) exception macro. More... | |
Functions | |
char * | newstr (const char *s) |
Allocate new duplicated string. More... | |
int | DynaMapDxlToEcode (int nDxlError) |
Map DXL library error code to Dynamixel error code. More... | |
The libDynamixel internal declarations.
Definition in file DynaLibInternal.h.
#define DYNA_LOG_BUF | ( | sPreface, | |
buf, | |||
uCount, | |||
sFmt | |||
) |
Log buffer of infrared readings.
sPreface | Preface string. |
buf | Buffer contents to log. |
uCount | Number of entries to log. |
sFmt | Buffer entry format string. |
Definition at line 112 of file DynaLibInternal.h.
#define DYNA_LOG_COMM_ERROR | ( | estat, | |
efmt, | |||
... | |||
) |
Log Error.
estat | Errored communication status code. |
efmt | Error output format string literal. |
... | Error variable arguments. |
Definition at line 97 of file DynaLibInternal.h.
#define DYNA_LOG_ERROR | ( | ecode, | |
efmt, | |||
... | |||
) |
Log Error.
ecode | Package Error Codes error code. |
efmt | Error output format string literal. |
... | Error variable arguments. |
Definition at line 73 of file DynaLibInternal.h.
Referenced by DynaChain::AddNewServo(), DynaChain::ChainEntryNew(), DynaServoGeneric::InitState(), DynaChain::LinkServos(), DynaServo::New(), DynaComm::New(), DynaCommSerial::Open(), DynaCommBotSense::Open(), DynaBgThread::Pause(), DynaCommBotSense::Ping(), DynaCommSerial::Read16(), DynaCommBotSense::Read16(), DynaCommSerial::Read8(), DynaCommBotSense::Read8(), DynaServo::ReadBaudRate(), DynaServoGeneric::ReadControlMethod(), DynaCommSerial::Reset(), DynaCommBotSense::Reset(), DynaBgThread::Resume(), DynaBgThread::Run(), DynaCommSerial::SetBaudRate(), DynaBgThread::Stop(), DynaCommSerial::SyncWrite(), DynaCommBotSense::SyncWrite(), DynaCommSerial::Write16(), DynaCommBotSense::Write16(), DynaCommSerial::Write8(), DynaCommBotSense::Write8(), DynaServo::WriteBaudRate(), and DynaServoGeneric::WriteControlMethod().
#define DYNA_LOG_SERVO_ALARMS | ( | id, | |
alarms | |||
) |
Log servo alarms.
id | Servo id. |
alarms | Alarm bits fields. |
Definition at line 131 of file DynaLibInternal.h.
Referenced by DynaCommSerial::Read16(), DynaCommSerial::Read8(), DynaCommSerial::Reset(), DynaServoGeneric::SyncState(), DynaCommSerial::Write16(), and DynaCommSerial::Write8().
#define DYNA_LOG_SYS_ERROR | ( | ecode, | |
efmt, | |||
... | |||
) |
Log System Error.
ecode | Package Error Codes error code. |
efmt | Error output format string literal. |
... | Error variable arguments. |
Definition at line 85 of file DynaLibInternal.h.
Referenced by DynaCommSerial::SetBaudRate().
#define DYNA_TRY_ADDR | ( | addr | ) |
Test if servo address is valid.
If the try fails, an appropriate error is logged and the calling function is immediately exited by invoking a return with the < 0 error code.
[in] | addr | Servo control table address. |
Definition at line 349 of file DynaLibInternal.h.
Referenced by DynaServoEX106P::Read(), DynaServoGeneric::Read(), DynaServoEX106P::Write(), and DynaServoGeneric::Write().
#define DYNA_TRY_COMM | ( | comm | ) |
Test if bus communication is available exception macro.
If the try fails, an appropriate error is logged and the calling function is immediately exited by invoking a return with the < 0 error code.
[in] | comm | Dynamixel bus communication object. |
Definition at line 171 of file DynaLibInternal.h.
Referenced by DynaChain::AddNewServo(), DynaChain::AddNewServosByScan(), DynaServoGeneric::AgentWriteGoalPos(), DynaServoGeneric::AgentWriteGoalSpeed(), DynaServoGeneric::AgentWriteGoalSpeedPos(), DynaServoGeneric::CfgReadAlarmShutdownMask(), DynaServoEX106P::CfgReadDriveMode(), DynaServoGeneric::CfgReadMaxTorqueLimit(), DynaServoGeneric::CfgReadRotationLimits(), DynaServoGeneric::CfgReadServoMode(), DynaServoGeneric::CfgReadTemperatureLimit(), DynaServoGeneric::CfgReadVoltageLimits(), DynaServoGeneric::CfgWriteAlarmShutdownMask(), DynaServoEX106P::CfgWriteDriveMode(), DynaServoGeneric::CfgWriteMaxTorqueLimit(), DynaServoGeneric::CfgWriteRotationLimits(), DynaServoGeneric::CfgWriteServoMode(), DynaServoGeneric::CfgWriteServoModeContinuous(), DynaServoGeneric::CfgWriteTemperatureLimit(), DynaServoGeneric::CfgWriteVoltageLimits(), DynaChain::ChainEntryNew(), DynaServoGeneric::EStop(), DynaChain::EStop(), DynaServoGeneric::Freeze(), DynaChain::Freeze(), DynaServoGeneric::MoveAtSpeed(), DynaChain::MoveAtSpeed(), DynaServoGeneric::MoveAtSpeedTo(), DynaChain::MoveAtSpeedTo(), DynaServoGeneric::MoveTo(), DynaChain::MoveTo(), DynaCommSerial::Ping(), DynaCommBotSense::Ping(), DynaServo::Ping(), DynaServoGeneric::Ping(), DynaServoEX106P::Read(), DynaServoGeneric::Read(), DynaCommSerial::Read16(), DynaCommBotSense::Read16(), DynaCommSerial::Read8(), DynaCommBotSense::Read8(), DynaServo::ReadBaudRate(), DynaServoGeneric::ReadControlMethod(), DynaServoGeneric::ReadCurLoad(), DynaServoGeneric::ReadCurPos(), DynaServoGeneric::ReadCurSpeed(), DynaServoGeneric::ReadDynamics(), DynaServo::ReadFirmwareVersion(), DynaServoGeneric::ReadGoalPos(), DynaServoGeneric::ReadGoalSpeed(), DynaServoGeneric::ReadHealth(), DynaServoGeneric::ReadIsMoving(), DynaServoGeneric::ReadLed(), DynaServoGeneric::ReadMaxTorqueLimit(), DynaServo::ReadModelNumber(), DynaServoEX106P::ReadSensedCurrent(), DynaServo::ReadServoId(), DynaServoGeneric::ReadTorqueEnable(), DynaServoGeneric::Release(), DynaChain::Release(), DynaServoGeneric::ReloadMaxTorqueLimit(), DynaCommSerial::Reset(), DynaCommBotSense::Reset(), DynaServo::Reset(), DynaServoGeneric::Reset(), DynaServoGeneric::Stop(), DynaChain::Stop(), DynaServoEX106P::SyncCfg(), DynaServoGeneric::SyncCfg(), DynaChain::SyncMoveAtSpeed(), DynaChain::SyncMoveAtSpeedTo(), DynaChain::SyncMoveTo(), DynaServoEX106P::SyncState(), DynaServoGeneric::SyncState(), DynaCommSerial::SyncWrite(), DynaCommBotSense::SyncWrite(), DynaChain::SyncWriteGoalPos(), DynaChain::SyncWriteGoalSpeed(), DynaChain::SyncWriteTorqueEnable(), DynaChain::vSyncMoveAtSpeed(), DynaChain::vSyncMoveAtSpeedTo(), DynaChain::vSyncWriteGoalPos(), DynaChain::vSyncWriteGoalSpeed(), DynaServoEX106P::Write(), DynaServoGeneric::Write(), DynaCommSerial::Write16(), DynaCommBotSense::Write16(), DynaCommSerial::Write8(), DynaCommBotSense::Write8(), DynaServo::WriteBaudRate(), DynaServoGeneric::WriteControlMethod(), DynaServoGeneric::WriteCtlMethodCompliance(), DynaServoGeneric::WriteCtlMethodPid(), DynaServoGeneric::WriteGoalPos(), DynaServoGeneric::WriteGoalSpeed(), DynaServoGeneric::WriteLed(), DynaServoGeneric::WriteMaxTorqueLimit(), DynaServo::WriteServoId(), and DynaServoGeneric::WriteTorqueEnable().
#define DYNA_TRY_EXPR | ( | expr, | |
ecode, | |||
efmt, | |||
... | |||
) |
Test if the servo is in the required mode(s) exception macro.
If the check is false, an appropriate error is logged and the calling function immediately returns with the appropriate < 0 error code.
expr | Expression to evaluate |
ecode | CogniBoost error code. |
efmt | Error output format string literal. |
... | Variable arguments. |
Definition at line 401 of file DynaLibInternal.h.
Referenced by DynaServoGeneric::AgentWriteGoalSpeed(), DynaServoGeneric::AgentWriteGoalSpeedPos(), DynaServoGeneric::CalcMatesGoalPos(), DynaServoEX106P::CfgWriteDriveMode(), DynaServoGeneric::CfgWriteMaxTorqueLimit(), DynaServoGeneric::CfgWriteRotationLimits(), DynaServoGeneric::CfgWriteTemperatureLimit(), DynaServoGeneric::CfgWriteVoltageLimits(), DynaChain::LinkServos(), DynaChain::SyncWriteGoalPos(), DynaChain::SyncWriteGoalSpeed(), DynaChain::UnlinkServos(), DynaServoGeneric::WriteCtlMethodCompliance(), DynaServoGeneric::WriteCtlMethodPid(), DynaServoGeneric::WriteGoalPos(), DynaServoGeneric::WriteGoalSpeed(), and DynaServoGeneric::WriteMaxTorqueLimit().
#define DYNA_TRY_IS_MASTER | ( | pservo | ) |
Test if the servo is a master servo.
If the try fails, an appropriate error is logged and the calling function is immediately exited by invoking a return with the < 0 error code.
[in] | pservo | Pointer to DynaServo derived object. |
Definition at line 210 of file DynaLibInternal.h.
Referenced by DynaServoGeneric::AgentWriteGoalPos(), DynaServoGeneric::AgentWriteGoalSpeed(), DynaServoGeneric::AgentWriteGoalSpeedPos(), DynaServoGeneric::CfgWriteAlarmShutdownMask(), DynaServoEX106P::CfgWriteDriveMode(), DynaServoGeneric::CfgWriteMaxTorqueLimit(), DynaServoGeneric::CfgWriteRotationLimits(), DynaServoGeneric::CfgWriteServoMode(), DynaServoGeneric::CfgWriteServoModeContinuous(), DynaServoGeneric::CfgWriteTemperatureLimit(), DynaServoGeneric::CfgWriteVoltageLimits(), DynaServoGeneric::EStop(), DynaServoGeneric::Freeze(), DynaServoGeneric::MoveAtSpeed(), DynaChain::MoveAtSpeed(), DynaServoGeneric::MoveAtSpeedTo(), DynaChain::MoveAtSpeedTo(), DynaServoGeneric::MoveTo(), DynaChain::MoveTo(), DynaServoGeneric::Release(), DynaServoGeneric::ReloadMaxTorqueLimit(), DynaServoGeneric::Stop(), DynaChain::SyncMoveAtSpeed(), DynaChain::SyncMoveAtSpeedTo(), DynaChain::SyncMoveTo(), DynaChain::SyncWriteGoalPos(), DynaChain::SyncWriteGoalSpeed(), DynaChain::vSyncMoveAtSpeed(), DynaServoGeneric::WriteControlMethod(), DynaServoGeneric::WriteCtlMethodCompliance(), DynaServoGeneric::WriteCtlMethodPid(), DynaServoGeneric::WriteGoalPos(), DynaServoGeneric::WriteGoalSpeed(), DynaServoGeneric::WriteLed(), DynaServoGeneric::WriteMaxTorqueLimit(), and DynaServoGeneric::WriteTorqueEnable().
#define DYNA_TRY_IS_UNLINKED | ( | pservo | ) |
Test if the servo is unlinked.
If the try fails, an appropriate error is logged and the calling function is immediately exited by invoking a return with the < 0 error code.
[in] | pservo | Pointer to DynaServo derived object. |
Definition at line 231 of file DynaLibInternal.h.
#define DYNA_TRY_RC | ( | rc, | |
fmt, | |||
... | |||
) |
Test if Dynamixel return code is not an error.
If the try fails, an appropriate error is logged and the calling function is immediately exited by invoking a return with the < 0 error code.
[in] | comm | Dynamixel bus communication object. |
Definition at line 152 of file DynaLibInternal.h.
Referenced by DynaServoGeneric::CalcMatesGoalPos(), DynaCommBotSense::SetBaudRate(), DynaCommBotSense::SetHalfDuplexCtl(), and DynaChain::SyncWriteGoalPos().
#define DYNA_TRY_SERVO_HAS_AGENT | ( | pservo | ) |
Test if the servo has a proxy agent.
The proxy agent is required to do position control for servos in continuous mode, since the servos do not support this function.
If the try fails, an appropriate error is logged and the calling function is immediately exited by invoking a return with the < 0 error code.
[in] | pservo | Pointer to DynaServo derived object. |
Definition at line 328 of file DynaLibInternal.h.
Referenced by DynaServoGeneric::AgentWriteGoalPos(), DynaServoGeneric::AgentWriteGoalSpeed(), and DynaServoGeneric::AgentWriteGoalSpeedPos().
#define DYNA_TRY_SERVO_HAS_MODE | ( | pservo, | |
mode | |||
) |
Test if the servo has one of the required modes exception macro.
If the try fails, an appropriate error is logged and the calling function is immediately exited by invoking a return with the < 0 error code.
[in] | pservo | Pointer to DynaServo derived object. |
[in] | mode | Required servo modes mask. |
Definition at line 253 of file DynaLibInternal.h.
Referenced by DynaServoGeneric::CfgWriteServoModeContinuous().
#define DYNA_TRY_SERVO_HAS_POS_CTL | ( | pservo | ) |
Test if the servo has positiion control.
A servo has position control if:
If the try fails, an appropriate error is logged and the calling function is immediately exited by invoking a return with the < 0 error code.
[in] | pservo | Pointer to DynaServo derived object. |
Definition at line 303 of file DynaLibInternal.h.
Referenced by DynaServoGeneric::AgentWriteGoalPos(), DynaServoGeneric::AgentWriteGoalSpeed(), DynaServoGeneric::AgentWriteGoalSpeedPos(), DynaServoGeneric::MoveAtSpeedTo(), DynaChain::MoveAtSpeedTo(), DynaServoGeneric::MoveTo(), DynaServoGeneric::ReadCurPos(), DynaChain::SyncMoveAtSpeedTo(), and DynaChain::SyncMoveTo().
#define DYNA_TRY_SERVO_ID | ( | id | ) |
Testing if the servo id is in range exception macro.
If the try fails, an appropriate error is logged and the calling function is immediately exited by invoking a return with the < 0 error code.
[in] | id | Servo id. |
Definition at line 190 of file DynaLibInternal.h.
Referenced by DynaChain::AddNewServo(), DynaChain::ChainEntryDelete(), DynaChain::ChainEntryNew(), DynaServo::Ping(), DynaServo::ReadBaudRate(), DynaServo::ReadFirmwareVersion(), DynaServo::ReadModelNumber(), DynaServo::ReadServoId(), DynaServo::Reset(), DynaServo::WriteBaudRate(), and DynaServo::WriteServoId().
#define DYNA_TRY_SERVO_IN_CHAIN | ( | pchain, | |
id | |||
) |
Test if the servo id is valid and present in chain exception macro.
If the try fails, an appropriate error is logged and the calling function is immediately exited by invoking a return with the < 0 error code.
[in] | pchain | Pointer to DynaChain object. |
[in] | id | Servo id. |
Definition at line 373 of file DynaLibInternal.h.
Referenced by DynaChain::LinkServos(), DynaChain::MoveAtSpeed(), DynaChain::MoveAtSpeedTo(), DynaChain::MoveTo(), DynaChain::RemoveServo(), DynaChain::SyncMoveAtSpeed(), DynaChain::SyncMoveAtSpeedTo(), DynaChain::SyncMoveTo(), DynaChain::SyncWriteGoalPos(), DynaChain::SyncWriteGoalSpeed(), DynaChain::UnlinkServos(), and DynaChain::vSyncMoveAtSpeed().
#define DYNA_TRY_SERVO_IN_MODE | ( | pservo, | |
mode | |||
) |
Test if the servo is in the given mode.
If the try fails, an appropriate error is logged and the calling function is immediately exited by invoking a return with the < 0 error code.
[in] | pservo | Pointer to DynaServo derived object. |
[in] | mode | Required servo modes mask. |
Definition at line 276 of file DynaLibInternal.h.
Referenced by DynaServoGeneric::MoveAtSpeed(), DynaChain::SyncMoveAtSpeed(), and DynaChain::vSyncMoveAtSpeed().
int DynaMapDxlToEcode | ( | int | nDxlError | ) |
Map DXL library error code to Dynamixel error code.
nDxlError | DXL error code. |
Definition at line 117 of file DynaError.cxx.
References DXL_COMM_RXCORRUPT, DXL_COMM_RXFAIL, DXL_COMM_RXTIMEOUT, DXL_COMM_TXERROR, DXL_COMM_TXFAIL, DYNA_ECODE_ECOMM, DYNA_ECODE_RX_BAD_PKT, DYNA_ECODE_RX_FAIL, DYNA_ECODE_RX_TIMEOUT, DYNA_ECODE_TX_ERROR, and DYNA_ECODE_TX_FAIL.
Referenced by newstr(), DynaCommSerial::Read16(), DynaCommSerial::Read8(), DynaCommSerial::Reset(), DynaCommSerial::SyncWrite(), DynaCommSerial::Write16(), and DynaCommSerial::Write8().
|
inline |
Allocate new duplicated string.
s | String to duplicate. |
Definition at line 432 of file DynaLibInternal.h.
References DynaMapDxlToEcode().
Referenced by DynaComm::DynaComm(), DynaCommBotSense::DynaCommBotSense(), DynaCommSerial::DynaCommSerial(), DynaServo::Init(), DynaShellCmdLoadRecording::Init(), DynaServoAX12::InitSpec(), DynaServoRX24F::InitSpec(), DynaServoRX10::InitSpec(), DynaServoRX28::InitSpec(), DynaServoRX64::InitSpec(), DynaServoMX28::InitSpec(), DynaServoMX64::InitSpec(), DynaServoMX12W::InitSpec(), DynaServoMX106::InitSpec(), DynaServoEX106P::InitSpec(), DynaServoGeneric::InitSpec(), DynaCommSerial::Open(), DynaCommBotSense::Open(), DynaRecording::SetDate(), DynaShellCmdLoadRecording::SetDateField(), and DynaShellCmd::SetPublishedInfo().