59 #include "rnr/rnrconfig.h" 100 DynaComm(
const char *sUri,
int nBaudRate);
129 static DynaComm *
New(
const char *sUri,
int nBaudRate);
168 virtual int Open(
const char *sDevUri,
int nBaudRate) = 0;
175 virtual int Open() = 0;
182 virtual int Close() = 0;
220 virtual int Read8(
int nServoId, uint_t uAddr, byte_t *pVal) = 0;
231 virtual int Read8(
int nServoId, uint_t uAddr, uint_t *pVal)
252 virtual int Write8(
int nServoId, uint_t uAddr, byte_t byVal) = 0;
263 virtual int Write8(
int nServoId, uint_t uAddr, uint_t uVal)
265 byte_t val = (byte_t)uVal;
267 return Write8(nServoId, uAddr, val);
279 virtual int Read16(
int nServoId, uint_t uAddr, ushort_t *pVal) = 0;
290 virtual int Read16(
int nServoId, uint_t uAddr, uint_t *pVal)
311 virtual int Write16(
int nServoId, uint_t uAddr, ushort_t uhVal) = 0;
322 virtual int Write16(
int nServoId, uint_t uAddr, uint_t uVal)
324 ushort_t val = (ushort_t)uVal;
326 return Write16(nServoId, uAddr, val);
341 virtual int vSyncWrite(uint_t uAddr, uint_t uValSize, uint_t uCount, ...);
365 virtual bool Ping(
int nServoId) = 0;
376 virtual int Reset(
int nServoId) = 0;
415 const std::string &strSep=
"; ");
427 const std::string &strSep=
",");
508 #endif // _DYNA_COMM_H uint_t m_uAlarms
servo alarms from last I/O operation
static int BaudNumToRate(int nBaudRate)
Map baud number to Dynamixel baud rate.
char * m_sDevUri
dynamixel bus device URI
#define DYNA_OK
not an error, success
virtual int vSyncWrite(uint_t uAddr, uint_t uValSize, uint_t uCount,...)
Synchronous write 8/16-bit values to a list of Dynamixel servos.
static int BaudNumAt(int nIndex)
Get the baud number associated with the given index.
virtual ~DynaComm()
Destructor.
static int BaudRateAt(int nIndex)
Get the baud rate associated with the given index.
virtual int Reset(int nServoId)=0
Reset a servo back to default values.
virtual bool IsOpen()
Test if Dynamixel Bus is open.
const char * GetDeviceUri() const
#define DYNA_ALARM_NONE
no alarms
static const key_t ShmKey
shared memory key
static const char * GetBusStatusString(uint_t uBusStatus)
Get the string describing the Dynamixel servo communication status.
virtual int Read8(int nServoId, uint_t uAddr, byte_t *pVal)=0
Read an 8-bit value from Dynamixel servo control table.
virtual int SetBaudRate(int nNewBaudRate)=0
Set the Dynamixel Bus new baud rate.
virtual int Read16(int nServoId, uint_t uAddr, ushort_t *pVal)=0
Read a 16-bit value from Dynamixel servo control table.
shm_mutex_t m_mutexComm
synchonization mutex
virtual bool Ping(int nServoId)=0
Ping the servo.
bool m_bIsOpen
dynamixel bus communication is [not] open
static std::string GetAlarmsShortString(const uint_t uAlarms, const std::string &strSep=",")
Get a formatted servo alarms short string associated with the alarms.
virtual int Write8(int nServoId, uint_t uAddr, uint_t uVal)
Write an 8-bit value to Dynamixel servo control table.
virtual int Write8(int nServoId, uint_t uAddr, byte_t byVal)=0
Write an 8-bit value to Dynamixel servo control table.
virtual int Read16(int nServoId, uint_t uAddr, uint_t *pVal)
Read a 16-bit value from Dynamixel servo control table.
static DynaComm * New(const char *sUri, int nBaudRate)
Archetype constructor to create a new Dynamixel bus communication derived instance.
virtual uint_t GetAlarms()
Get current alarms.
virtual int Write16(int nServoId, uint_t uAddr, ushort_t uhVal)=0
Write a 16-bit value to Dynamixel servo control table.
virtual int GetResourceId() const =0
Get system-unique resource identifier.
virtual int SetHalfDuplexCtl(int nSignal, HalfDuplexTxFunc_T fnEnableTx=NULL, HalfDuplexRxFunc_T fnEnableRx=NULL)=0
void(* HalfDuplexRxFunc_T)(void *pArg, size_t uNumTxBytes)
Half-duplex control receive function type.
void(* HalfDuplexTxFunc_T)(void *pArg)
Half-duplex control transmit function type.
uint_t m_uBusStatus
bus comminication status
virtual void ClearAlarms()
Clear current alarms.
virtual int Open()=0
(Re)Open communication to dynamixel bus.
RoadNarrows Dynamixel Fundatmental Types.
static std::string GetAlarmsString(const uint_t uAlarms, const std::string &strSep="; ")
Get a formatted servo alarms string associated with the alarms.
virtual int SyncWrite(uint_t uAddr, uint_t uValSize, DynaSyncWriteTuple_T tuples[], uint_t uCount)=0
Synchronous Write 8/16-bit values to a list of Dynamixel servos.
RoadNarrows Dynamixel Top-Level Package Header File.
const int GetBaudRate() const
virtual int Close()=0
Close communication to dynamixel bus.
virtual int Read8(int nServoId, uint_t uAddr, uint_t *pVal)
Read an 8-bit value from Dynamixel servo control table.
virtual int Write16(int nServoId, uint_t uAddr, uint_t uVal)
Write a 16-bit value to Dynamixel servo control table.
virtual uint_t GetBusStatus()
Get the Dynamixel Bus status.
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.