Dynamixel  2.9.5
RoadNarrows Robotics Dynamixel Package
DynaShellCmdList Class Reference

List command. More...

Inheritance diagram for DynaShellCmdList:
DynaShellCmd

Public Member Functions

void Exec (DynaShell &shell, int argc, char *argv[])
 List servo chain info. 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 char * TabCompletion (DynaShell &shell, const char *sText, size_t uTextLen, int nState, const char *sContext)
 Default command tab completion generator. More...
 
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...
 

Additional Inherited Members

- 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...
 
- 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

List command.

Definition at line 440 of file dynashell_cmd_if.cxx.

Member Function Documentation

void DynaShellCmdList::Exec ( DynaShell shell,
int  argc,
char *  argv[] 
)
inlinevirtual

List servo chain info.

Parameters
shellDynamixel shell.
argcCommand argument count.
argvArray of arguments.

Implements DynaShellCmd.

Definition at line 465 of file dynashell_cmd_if.cxx.

References DYNA_ID_NONE, DYNA_MODE_SERVO, DynaServo::GetFirmwareVersion(), DynaChain::GetLinkedMateId(), DynaServo::GetModelName(), DynaServo::GetModelNumber(), DynaChain::GetServo(), DynaServo::GetServoMode(), DynaChain::IsLinkedMaster(), DynaChain::IsLinkedSlave(), DynaChain::IterNext(), DynaChain::IterStart(), DynaShell::m_pDynaChain, DynaShell::Response(), and TRY.

466  {
467  int nServoId;
468  const DynaServo *pServo;
469  int iter;
470 
471  TRY( ChkArgCnt(shell, argc) );
472  TRY( ChkComm(shell) );
473  TRY( ChkChain(shell) );
474 
475  for(nServoId = shell.m_pDynaChain->IterStart(&iter);
476  nServoId != DYNA_ID_NONE;
477  nServoId = shell.m_pDynaChain->IterNext(&iter))
478  {
479  pServo = shell.m_pDynaChain->GetServo(nServoId);
480  shell.Response("Servo %3d: %7s, model 0x%04x, fwver 0x%02x",
481  nServoId, pServo->GetModelName(),
482  pServo->GetModelNumber(), pServo->GetFirmwareVersion());
483  if( pServo->GetServoMode() == DYNA_MODE_SERVO )
484  {
485  shell.Response(", servo mode");
486  }
487  else
488  {
489  shell.Response(", continuous mode");
490  }
491  if( shell.m_pDynaChain->IsLinkedMaster(nServoId) )
492  {
493  shell.Response(", linked master of %d",
494  shell.m_pDynaChain->GetLinkedMateId(nServoId));
495  }
496  else if( shell.m_pDynaChain->IsLinkedSlave(nServoId) )
497  {
498  shell.Response(", linked slave of %d",
499  shell.m_pDynaChain->GetLinkedMateId(nServoId));
500  }
501  shell.Response("\n");
502  }
503  }
virtual uint_t GetServoMode() const
Get the servo operational mode.
Definition: DynaServo.h:165
int GetLinkedMateId(int nServoId) const
Get linked mate.
Definition: DynaChain.h:238
bool ChkChain(DynaShell &shell)
Check that the servo chain exists.
#define DYNA_MODE_SERVO
servo mode with limited rotation
Definition: Dynamixel.h:170
bool IsLinkedMaster(int nServoId) const
Test if this servo is a linked master.
Definition: DynaChain.h:196
virtual uint_t GetFirmwareVersion() const
Get servo firmware version.
Definition: DynaServo.h:135
Dynamixel Servo Abstract Base Class.
Definition: DynaServo.h:78
void Response(const char *sFmt,...)
Print formatted success response.
Definition: dynashell.cxx:763
virtual int IterStart(int *pIter)
Start iteration over of entire servo chain.
Definition: DynaChain.cxx:1008
virtual DynaServo * GetServo(int nServoId)
Definition: DynaChain.h:129
virtual bool ChkArgCnt(DynaShell &shell, int argc)
Check that the argument count is within the class (min,max).
bool IsLinkedSlave(int nServoId) const
Test if this servo is a linked slave.
Definition: DynaChain.h:211
#define TRY(boolexpr,...)
Try boolean expression.
Definition: dynashell_cmd.h:89
virtual uint_t GetModelNumber() const
Get servo model number.
Definition: DynaServo.h:125
bool ChkComm(DynaShell &shell)
Check that Dynamixel communication exists and is open.
#define DYNA_ID_NONE
no servo id
Definition: Dynamixel.h:145
virtual int IterNext(int *pIter)
Next iteration over of entire servo chain.
Definition: DynaChain.cxx:1020
DynaChain * m_pDynaChain
dynamixel chain
Definition: dynashell.h:360
virtual const char * GetModelName() const
Get servo model name string.
Definition: DynaServo.h:145

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