![]() |
Dynamixel
2.9.5
RoadNarrows Robotics Dynamixel Package
|
BotSense IP Proxied Dynamixel Bus Communications Class. More...
#include <DynaCommBotSense.h>
Public Member Functions | |
| DynaCommBotSense () | |
| Default constructor. | |
| DynaCommBotSense (const char *sSerialDevName, int nBaudRate, const char *sBsProxyHostName=BSPROXY_URI_HOSTNAME_DFT, int nBsProxyIPPort=BSPROXY_LISTEN_PORT_DFT) | |
| Initialization constructor. More... | |
| virtual | ~DynaCommBotSense () |
| Destructor. | |
| const char * | GetSerialDeviceName () |
| Get the Dynamixel Bus serial device name. More... | |
| const char * | GetProxyServerHostName () |
| Get the BotSense proxy server host name. More... | |
| const int | GetProxyServerPort () const |
| Get the BotSense proxy server port. More... | |
| const BsClient_P | GetProxyClient () const |
| Get this BotSense proxy client. More... | |
| virtual int | GetResourceId () const |
| Get System-unique resource identifier. More... | |
| virtual int | Open (const char *sSerialDevName, int nBaudRate) |
| Open serial communication to dynamixel bus. More... | |
| virtual int | Open (const char *sSerialDevName, int nBaudRate, const char *sBsProxyHostName=BSPROXY_URI_HOSTNAME_DFT, int nBsProxyIPPort=BSPROXY_LISTEN_PORT_DFT) |
| Open serial communication to dynamixel bus. More... | |
| virtual int | Open () |
| (Re)Open serial communication to dynamixel bus. More... | |
| virtual int | Close () |
| Close serial communication to dynamixel bus and connection to BotSense proxy server. More... | |
| virtual int | SetBaudRate (int nNewBaudRate) |
| virtual int | SetHalfDuplexCtl (int nSignal, HalfDuplexTxFunc_T fnEnableTx=NULL, HalfDuplexRxFunc_T fnEnableRx=NULL) |
| virtual int | SetMsgTracing (bool bEnabled) |
| virtual int | Read8 (int nServoId, uint_t uAddr, byte_t *pVal) |
| Read an 8-bit value from Dynamixel servo control table. More... | |
| virtual int | Write8 (int nServoId, uint_t uAddr, byte_t byVal) |
| Write an 8-bit value to Dynamixel servo control table. More... | |
| virtual int | Read16 (int nServoId, uint_t uAddr, ushort_t *pVal) |
| Read a 16-bit value from Dynamixel servo control table. More... | |
| virtual int | Write16 (int nServoId, uint_t uAddr, ushort_t uhVal) |
| Write a 16-bit value to Dynamixel servo control table. More... | |
| virtual int | SyncWrite (uint_t uAddr, uint_t uValSize, DynaSyncWriteTuple_T tuples[], uint_t uCount) |
| Synchronous Write 8/16-bit values to a list of Dynamixel servos. More... | |
| virtual bool | Ping (int nServoId) |
| Ping the servo. More... | |
| virtual int | Reset (int nServoId) |
| Reset a servo back to default values. More... | |
Public Member Functions inherited from DynaComm | |
| DynaComm () | |
| DynaComm (const char *sUri, int nBaudRate) | |
| virtual | ~DynaComm () |
| Destructor. | |
| const char * | GetDeviceUri () const |
| const int | GetBaudRate () const |
| virtual int | Read8 (int nServoId, uint_t uAddr, uint_t *pVal) |
| Read an 8-bit value from Dynamixel servo control table. More... | |
| virtual int | Write8 (int nServoId, uint_t uAddr, uint_t uVal) |
| Write an 8-bit value to Dynamixel servo control table. More... | |
| virtual int | Read16 (int nServoId, uint_t uAddr, uint_t *pVal) |
| Read a 16-bit value from Dynamixel servo control table. More... | |
| virtual int | Write16 (int nServoId, uint_t uAddr, uint_t uVal) |
| Write a 16-bit value to Dynamixel servo control table. More... | |
| virtual int | vSyncWrite (uint_t uAddr, uint_t uValSize, uint_t uCount,...) |
| Synchronous write 8/16-bit values to a list of Dynamixel servos. More... | |
| virtual bool | IsOpen () |
| Test if Dynamixel Bus is open. More... | |
| virtual uint_t | GetAlarms () |
| Get current alarms. More... | |
| virtual void | ClearAlarms () |
| Clear current alarms. | |
| virtual uint_t | GetBusStatus () |
| Get the Dynamixel Bus status. More... | |
Protected Attributes | |
| char * | m_sSerialDevName |
| proxied serial device name | |
| char * | m_sBsProxyHostName |
| BotSense proxy server domain/IP address. | |
| int | m_nBsProxyIPPort |
| BotSense proxy server IP port number. | |
| BsClient_P | m_pBsClient |
| BotSense client. | |
| BsVConnHnd_T | m_hndBsVConn |
| virtual connection to proxied device | |
| bool | m_bBsTrace |
| do [not] trace messaging | |
Protected Attributes inherited from DynaComm | |
| char * | m_sDevUri |
| dynamixel bus device URI | |
| int | m_nBaudRate |
| baud rate | |
| bool | m_bIsOpen |
| dynamixel bus communication is [not] open | |
| uint_t | m_uBusStatus |
| bus comminication status | |
| uint_t | m_uAlarms |
| servo alarms from last I/O operation | |
| shm_mutex_t | m_mutexComm |
| synchonization mutex | |
Additional Inherited Members | |
Public Types inherited from DynaComm | |
| typedef void(* | HalfDuplexTxFunc_T) (void *pArg) |
| Half-duplex control transmit function type. | |
| typedef void(* | HalfDuplexRxFunc_T) (void *pArg, size_t uNumTxBytes) |
| Half-duplex control receive function type. | |
Static Public Member Functions inherited from DynaComm | |
| static DynaComm * | New (const char *sUri, int nBaudRate) |
| Archetype constructor to create a new Dynamixel bus communication derived instance. More... | |
| static std::string | GetAlarmsString (const uint_t uAlarms, const std::string &strSep="; ") |
| Get a formatted servo alarms string associated with the alarms. More... | |
| static std::string | GetAlarmsShortString (const uint_t uAlarms, const std::string &strSep=",") |
| Get a formatted servo alarms short string associated with the alarms. More... | |
| static const char * | GetBusStatusString (uint_t uBusStatus) |
| Get the string describing the Dynamixel servo communication status. More... | |
| static int | BaudRateToNum (int nBaudRate) |
| Map baud rate to Dynamixel baud number. More... | |
| static int | BaudNumToRate (int nBaudRate) |
| Map baud number to Dynamixel baud rate. More... | |
| static int | BaudRateAt (int nIndex) |
| Get the baud rate associated with the given index. More... | |
| static int | BaudNumAt (int nIndex) |
| Get the baud number associated with the given index. More... | |
Static Protected Attributes inherited from DynaComm | |
| static const key_t | ShmKey = 0x70add12a |
| shared memory key More... | |
BotSense IP Proxied Dynamixel Bus Communications Class.
The host with the direct serial connection acts as the bsProxy server.
Definition at line 77 of file DynaCommBotSense.h.
| DynaCommBotSense::DynaCommBotSense | ( | const char * | sSerialDevName, |
| int | nBaudRate, | ||
| const char * | sBsProxyHostName = BSPROXY_URI_HOSTNAME_DFT, |
||
| int | nBsProxyIPPort = BSPROXY_LISTEN_PORT_DFT |
||
| ) |
Initialization constructor.
The given proxied serial device is opened at the baud rate on the host of the given BotSense proxy server.
| sSerialDevName | Proxied serial device name. |
| nBaudRate | Proxied serial device baud rate. |
| sBsProxyHostName | BotSense proxy server host name (domain name or IP address). |
| nBsProxyIPPort | BotSense proxy server IP port number. |
Definition at line 89 of file DynaCommBotSense.cxx.
References m_bBsTrace, m_hndBsVConn, DynaComm::m_nBaudRate, m_nBsProxyIPPort, m_pBsClient, m_sBsProxyHostName, DynaComm::m_sDevUri, m_sSerialDevName, newstr(), and Open().
|
virtual |
Close serial communication to dynamixel bus and connection to BotSense proxy server.
Implements DynaComm.
Definition at line 219 of file DynaCommBotSense.cxx.
References DYNA_OK, DynaComm::m_bIsOpen, m_hndBsVConn, and m_pBsClient.
Referenced by Open(), and ~DynaCommBotSense().
|
inline |
Get this BotSense proxy client.
Definition at line 142 of file DynaCommBotSense.h.
References m_pBsClient.
|
inline |
Get the BotSense proxy server host name.
Definition at line 122 of file DynaCommBotSense.h.
References m_sBsProxyHostName.
|
inline |
Get the BotSense proxy server port.
Definition at line 132 of file DynaCommBotSense.h.
References m_nBsProxyIPPort.
|
inlinevirtual |
Get System-unique resource identifier.
Implements DynaComm.
Definition at line 152 of file DynaCommBotSense.h.
References m_hndBsVConn.
|
inline |
Get the Dynamixel Bus serial device name.
Definition at line 112 of file DynaCommBotSense.h.
References m_sSerialDevName.
|
inlinevirtual |
Open serial communication to dynamixel bus.
The given proxied serial device is opened at the baud rate on the local host with default port number.
| sSerialDevName | Proxied serial device name. |
| nBaudRate | Proxied serial device baud rate. |
Implements DynaComm.
Definition at line 168 of file DynaCommBotSense.h.
References Close(), DynaCommBotSense(), Open(), Ping(), Read16(), Read8(), Reset(), SetBaudRate(), SetHalfDuplexCtl(), SetMsgTracing(), SyncWrite(), Write16(), and Write8().
|
virtual |
Open serial communication to dynamixel bus.
The given proxied serial device is opened at the baud rate on the host of the given BotSense proxy server.
| sSerialDevName | Proxied serial device name. |
| nBaudRate | Proxied serial device baud rate. |
| sBsProxyHostName | BotSense proxy server host name (domain name or IP address). |
| sBsProxyHostName | BotSense proxy server host. |
| nBsProxyIPPort | BotSense proxy server IP port number. |
Definition at line 134 of file DynaCommBotSense.cxx.
References Close(), m_hndBsVConn, DynaComm::m_nBaudRate, m_nBsProxyIPPort, m_sBsProxyHostName, m_sSerialDevName, newstr(), and Open().
|
virtual |
(Re)Open serial communication to dynamixel bus.
Implements DynaComm.
Definition at line 162 of file DynaCommBotSense.cxx.
References Close(), DYNA_ECODE_BAD_VAL, DYNA_ECODE_BOTSENSE, DYNA_LOG_ERROR, DYNA_OK, m_bBsTrace, DynaComm::m_bIsOpen, m_hndBsVConn, DynaComm::m_nBaudRate, m_nBsProxyIPPort, m_pBsClient, m_sBsProxyHostName, and m_sSerialDevName.
Referenced by DynaCommBotSense(), and Open().
|
virtual |
Ping the servo.
| nServoId | Servo id. |
Implements DynaComm.
Definition at line 405 of file DynaCommBotSense.cxx.
References DYNA_ECODE_BOTSENSE, DYNA_LOG_ERROR, DYNA_TRY_COMM, m_hndBsVConn, DynaComm::m_mutexComm, and m_pBsClient.
Referenced by Open().
|
virtual |
Read a 16-bit value from Dynamixel servo control table.
| nServoId | Servo id. | |
| uAddr | Servo control table address. | |
| [out] | pVal | Value read. |
Implements DynaComm.
Definition at line 323 of file DynaCommBotSense.cxx.
References DYNA_ECODE_BOTSENSE, DYNA_LOG_ERROR, DYNA_OK, DYNA_TRY_COMM, m_hndBsVConn, DynaComm::m_mutexComm, m_pBsClient, and DynaComm::m_uAlarms.
Referenced by Open().
|
virtual |
Read an 8-bit value from Dynamixel servo control table.
| nServoId | Servo id. | |
| uAddr | Servo control table address. | |
| [out] | pVal | Value read. |
Implements DynaComm.
Definition at line 271 of file DynaCommBotSense.cxx.
References DYNA_ECODE_BOTSENSE, DYNA_LOG_ERROR, DYNA_OK, DYNA_TRY_COMM, m_hndBsVConn, DynaComm::m_mutexComm, m_pBsClient, and DynaComm::m_uAlarms.
Referenced by Open().
|
virtual |
Reset a servo back to default values.
| nServoId | Servo id. |
Implements DynaComm.
Definition at line 430 of file DynaCommBotSense.cxx.
References DYNA_ECODE_BOTSENSE, DYNA_LOG_ERROR, DYNA_OK, DYNA_TRY_COMM, m_hndBsVConn, DynaComm::m_mutexComm, and m_pBsClient.
Referenced by Open().
|
virtual |
Set the Dynamixel Bus new baud rate.
| nNewBaudRate | New baudrate. |
Implements DynaComm.
Definition at line 231 of file DynaCommBotSense.cxx.
References DYNA_OK, DYNA_TRY_RC, DynaComm::m_bIsOpen, m_hndBsVConn, DynaComm::m_nBaudRate, and m_pBsClient.
Referenced by Open().
|
virtual |
Set Dynamixel Bus half-duplex software control.
The Dynamixel 3-wire bus is half-duplex. Hardware may automatically control toggling between transmit and receive (e.g. RoadNarrows DynaUSB dongle). If there is no hardware support, then software must provide the tx/rx toggle functions.
| nSignal | Signal assign to toggle. |
| fnEnableTx | Enable transmit function. |
| fnEnableRx | Enable receive function. |
Implements DynaComm.
Definition at line 247 of file DynaCommBotSense.cxx.
References DYNA_OK, DYNA_TRY_RC, DynaComm::m_bIsOpen, m_hndBsVConn, and m_pBsClient.
Referenced by Open().
|
virtual |
Enable/disable botsense message tracing.
| bEnable | Enable [disable]. |
Definition at line 264 of file DynaCommBotSense.cxx.
References DYNA_OK, and m_bBsTrace.
Referenced by Open().
|
virtual |
Synchronous Write 8/16-bit values to a list of Dynamixel servos.
| uAddr | Servo control table write address. |
| uValSize | Value storage size at addtess. 1 or 2 bytes. |
| tuples | Array of servo id, write value tuples. |
| uCount | Number of tuples. |
Implements DynaComm.
Definition at line 375 of file DynaCommBotSense.cxx.
References DYNA_ECODE_BOTSENSE, DYNA_LOG_ERROR, DYNA_OK, DYNA_TRY_COMM, m_hndBsVConn, DynaComm::m_mutexComm, and m_pBsClient.
Referenced by Open().
|
virtual |
Write a 16-bit value to Dynamixel servo control table.
| nServoId | Servo id. |
| uAddr | Servo control table address. |
| uhVal | Value written. |
Implements DynaComm.
Definition at line 349 of file DynaCommBotSense.cxx.
References DYNA_ECODE_BOTSENSE, DYNA_LOG_ERROR, DYNA_OK, DYNA_TRY_COMM, m_hndBsVConn, DynaComm::m_mutexComm, m_pBsClient, and DynaComm::m_uAlarms.
Referenced by Open().
|
virtual |
Write an 8-bit value to Dynamixel servo control table.
| nServoId | Servo id. |
| uAddr | Servo control table address. |
| byVal | Value written. |
Implements DynaComm.
Definition at line 297 of file DynaCommBotSense.cxx.
References DYNA_ECODE_BOTSENSE, DYNA_LOG_ERROR, DYNA_OK, DYNA_TRY_COMM, m_hndBsVConn, DynaComm::m_mutexComm, m_pBsClient, and DynaComm::m_uAlarms.
Referenced by Open().