Dynamixel  2.9.5
RoadNarrows Robotics Dynamixel Package
DynaShellCmdWriteWord Class Reference

Write byte value to servo at address. More...

Inheritance diagram for DynaShellCmdWriteWord:
DynaShellCmdWriteByte DynaShellCmd

Protected Member Functions

virtual void doExec (DynaShell &shell, uint_t uAddr, DynaSyncWriteTuple_T tup[], uint_t uCount)
 Write word. More...
 
- Protected Member Functions inherited from DynaShellCmd
virtual void PrintSynopses (int indent, int width)
 Print synsopses. More...
 
virtual void PrintBlock (int col, int indent, int width, const char *sText)
 Print a block of indented text of width. More...
 
virtual void PrintDelim (int width, const char cDelim)
 
char * eow (const char *s)
 Find end of word. More...
 

Additional Inherited Members

- Public Member Functions inherited from DynaShellCmdWriteByte
virtual void Exec (DynaShell &shell, int argc, char *argv[])
 Execute write byte command on servos. More...
 
virtual char * TabCompletion (DynaShell &shell, const char *sText, size_t uTextLen, int nState, const char *sContext)
 Command tab completion generator. More...
 
- Public Member Functions inherited from DynaShellCmd
 DynaShellCmd (int nArgCntMin=0, int nArgCntMax=0)
 Default constructor.
 
virtual ~DynaShellCmd ()
 Default destructor.
 
const char * GetCmdName ()
 Get dynamixel shell command name. More...
 
const char * GetCmdHelpBrief ()
 Get shell command name brief description. More...
 
virtual void PrintHelp (int indent=0, int width=80)
 Print command help with the description aligned at the given indentation. More...
 
int GetPublishedLevel () const
 
const char * GetPublishedName () const
 
int SetPublishedInfo (int nLevel, const char *sParent=NULL)
 
virtual bool ChkArgCnt (DynaShell &shell, int argc)
 Check that the argument count is within the class (min,max). More...
 
bool ChkArgCnt0 (DynaShell &shell, int argc)
 Check that the argument count is zero. More...
 
bool ChkArgCntEQ (DynaShell &shell, int argc, int eq)
 Check that the argument count is equal to the required. More...
 
bool ChkArgCntGE (DynaShell &shell, int argc, int min)
 Check argument count against minimum required. More...
 
bool ChkArgCntLE (DynaShell &shell, int argc, int max)
 Check argument count against maximum allowed. More...
 
bool ChkComm (DynaShell &shell)
 Check that Dynamixel communication exists and is open. More...
 
bool ChkChain (DynaShell &shell)
 Check that the servo chain exists. More...
 
bool ChkChainNotEmpty (DynaShell &shell)
 Check that the servo chain exists and is not empty. More...
 
bool ChkChainHasServo (DynaShell &shell, int nServoId)
 Check that the given servo is present in the chain. More...
 
bool ChkChainIsMasterServo (DynaShell &shell, int nServoId)
 Check that the given servo is a master. More...
 
bool ToInt (DynaShell &shell, const char *sArg, int *pVal)
 Convert command argument to integer. More...
 
bool ToUInt (DynaShell &shell, const char *sArg, uint_t *pVal)
 Convert command argument to unsigned integer. More...
 
bool ToDouble (DynaShell &shell, const char *sArg, double *pVal)
 Convert command argument to double. More...
 
bool ToBool (DynaShell &shell, const char *sArg, bool *pVal)
 Convert command argument to boolean. More...
 
- Protected Attributes inherited from DynaShellCmdWriteByte
int m_nTabIter
 tab completion: servo id iterator
 
int m_nTabServoId
 tab completion: current servo id
 
bool m_bTabIncChain
 tab completion: [do not] include chain keyword
 
- Protected Attributes inherited from DynaShellCmd
const char * m_sCmdName
 command name
 
const char * m_sCmdHelpBrief
 command help brief
 
const char * m_sCmdHelpArgs
 command help arguments
 
const char * m_sCmdHelpDesc
 command help description
 
const int m_nArgCntMin
 minimum argument count
 
const int m_nArgCntMax
 maximum argument count (0 if not max)
 
int m_nPubLevel
 command's published level (depth)
 
char * m_sPubName
 command's published name
 

Detailed Description

Write byte value to servo at address.

Definition at line 2703 of file dynashell_cmd_servo.cxx.

Member Function Documentation

virtual void DynaShellCmdWriteWord::doExec ( DynaShell shell,
uint_t  uAddr,
DynaSyncWriteTuple_T  tup[],
uint_t  uCount 
)
inlineprotectedvirtual

Write word.

Parameters
shellDynamixel shell.
uAddrWrite address.
tupArray of (servo id, value) 2-tuples.
uCountNumber of tuples.

Reimplemented from DynaShellCmdWriteByte.

Definition at line 2745 of file dynashell_cmd_servo.cxx.

References DYNA_OK, DynaShell::Error(), DynaShell::m_pDynaComm, DynaShell::Ok(), DynaComm::SyncWrite(), and DynaComm::Write16().

2749  {
2750  int rc;
2751 
2752  if( uCount == 1 )
2753  {
2754  rc = shell.m_pDynaComm->Write16(tup[0].m_nServoId, uAddr, tup[0].m_uVal);
2755 
2756  if( rc != DYNA_OK )
2757  {
2758  shell.Error(rc,
2759  "Servo %d: Failed to write word 0x%04x to 0x%02x.",
2760  tup[0].m_nServoId, tup[0].m_uVal, uAddr);
2761  return;
2762  }
2763  }
2764  else
2765  {
2766  rc = shell.m_pDynaComm->SyncWrite(uAddr, 2, tup, uCount);
2767 
2768  if( rc != DYNA_OK )
2769  {
2770  shell.Error(rc,
2771  "Failed to syncwrite to 0x%02x for %u servos.",
2772  uAddr, uCount);
2773  return;
2774  }
2775  }
2776 
2777  shell.Ok();
2778  }
#define DYNA_OK
not an error, success
Definition: Dynamixel.h:78
DynaComm * m_pDynaComm
dynamixel bus communication
Definition: dynashell.h:359
virtual int Write16(int nServoId, uint_t uAddr, ushort_t uhVal)=0
Write a 16-bit value to Dynamixel servo control table.
virtual void Ok()
Print standard ok success response.
Definition: dynashell.h:425
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.
void Error(int rc, const char *sFmt,...)
Raise error on dynamixel error code.
Definition: dynashell.cxx:808

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