Dynamixel  2.9.5
RoadNarrows Robotics Dynamixel Package
dynashell_cmd.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // Package: Dynamixel
4 //
5 // Program: dynashell
6 //
7 // File: dynashell_cmd.h
8 //
9 /*! \file
10  *
11  * $LastChangedDate: 2015-01-12 10:56:06 -0700 (Mon, 12 Jan 2015) $
12  * $Rev: 3845 $
13  *
14  * \brief The dynashell Command Class Interface.
15  *
16  * \author Robin Knight (robin.knight@roadnarrows.com)
17  *
18  * \copyright
19  * \h_copy 2011-2017. RoadNarrows LLC.\n
20  * http://www.roadnarrows.com\n
21  * All Rights Reserved
22  */
23 /*
24  * @EulaBegin@
25  *
26  * Unless otherwise stated explicitly, all materials contained are copyrighted
27  * and may not be used without RoadNarrows LLC's written consent,
28  * except as provided in these terms and conditions or in the copyright
29  * notice (documents and software) or other proprietary notice provided with
30  * the relevant materials.
31  *
32  * IN NO EVENT SHALL THE AUTHOR, ROADNARROWS LLC, OR ANY
33  * MEMBERS/EMPLOYEES/CONTRACTORS OF ROADNARROWS OR DISTRIBUTORS OF THIS SOFTWARE
34  * BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR
35  * CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
36  * DOCUMENTATION, EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN
37  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38  *
39  * THE AUTHORS AND ROADNARROWS LLC SPECIFICALLY DISCLAIM ANY WARRANTIES,
40  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
41  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN
42  * "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO
43  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
44  *
45  * @EulaEnd@
46  */
47 ////////////////////////////////////////////////////////////////////////////////
48 
49 #ifndef _DYNASHELL_CMD_H
50 #define _DYNASHELL_CMD_H
51 
52 #include <stdio.h>
53 #include <stdlib.h>
54 #include <stdarg.h>
55 
56 #include <cstring>
57 #include <iostream>
58 #include <fstream>
59 
60 #include "rnr/rnrconfig.h"
61 #include "rnr/log.h"
62 
63 #include "Dynamixel/Dynamixel.h"
64 #include "Dynamixel/DynaComm.h"
65 #include "Dynamixel/DynaServo.h"
66 #include "Dynamixel/DynaChain.h"
67 
68 #include "dynashell.h"
69 
70 using namespace std;
71 
72 
73 // ----------------------------------------------------------------------------
74 // DynaShellCmd Class
75 // ----------------------------------------------------------------------------
76 
77 /*!
78  * \brief Dynamixel shell command abstract base class.
79  */
81 {
82  /*!
83  * \brief Try boolean expression.
84  *
85  * \param boolexpr Boolean C/C++ expression.
86  *
87  * \return Returns from calling function if expression evaluates to false.
88  */
89  #define TRY(boolexpr, ...) do { if( !(boolexpr) ) { return; } } while(0)
90 
91 public:
92  /*!
93  * \brief Default constructor.
94  */
95  DynaShellCmd(int nArgCntMin=0, int nArgCntMax=0) :
96  m_nArgCntMin(nArgCntMin),
97  m_nArgCntMax(nArgCntMax)
98  {
99  m_sCmdName = "";
100  m_sCmdHelpBrief = "";
101  m_sCmdHelpArgs = "";
102  m_sCmdHelpDesc = "";
103  m_nPubLevel = 0;
104  m_sPubName = NULL;
105  }
106 
107  /*!
108  * \brief Default destructor.
109  */
110  virtual ~DynaShellCmd() { }
111 
112  /*!
113  * \brief Get dynamixel shell command name.
114  *
115  * \return Command name string.
116  */
117  const char *GetCmdName() { return m_sCmdName; }
118 
119  /*!
120  * \brief Get shell command name brief description.
121  *
122  * \return Command name string.
123  */
124  const char *GetCmdHelpBrief() { return m_sCmdHelpBrief; }
125 
126  /*!
127  * \brief Execute command abstract function.
128  *
129  * \param shell Embedding dynamixel shell.
130  * \param argc Command argument count.
131  * \param argv Array of arguments.
132  */
133  virtual void Exec(DynaShell &shell, int argc, char *argv[]) = 0;
134 
135  virtual void PrintHelp(int indent=0, int width=80);
136 
137  /*!
138  * Get the command's published level.
139  *
140  * The root level is 0.
141  *
142  * \return Published level.
143  */
144  int GetPublishedLevel() const
145  {
146  return m_nPubLevel;
147  }
148 
149  /*!
150  * Get the command's published name.
151  *
152  * \return Published name.
153  */
154  const char *GetPublishedName() const
155  {
156  return m_sPubName;
157  }
158 
159  /*!
160  * Set the command's published information.
161  *
162  * \param nLevel Published level. The root level is 0.
163  * \param sParent Parent to which this command was published.
164  */
165  int SetPublishedInfo(int nLevel, const char *sParent=NULL)
166  {
167  m_nPubLevel = nLevel;
168 
169  if( m_sPubName != NULL )
170  {
171  delete[] m_sPubName;
172  }
173  if( sParent == NULL )
174  {
175  m_sPubName = newstr(m_sCmdName);
176  }
177  else
178  {
179  m_sPubName = new char[strlen(sParent)+1+strlen(m_sCmdName)+1];
180  sprintf(m_sPubName, "%s %s", sParent, m_sCmdName);
181  }
182  }
183 
184  /*!
185  * \brief Default command tab completion generator.
186  *
187  * The default is no completion.
188  *
189  * \param shell Dynamixel shell.
190  * \param sText Partial text string to complete.
191  * \param uTextLen Length of text.
192  * \param nState Generator state. If FIRST,then initialize any statics.
193  * \param sContext Generator context (i.e. canonical command path).
194  *
195  * \return
196  * If a first/next match is made, return allocated completed match.\n
197  * Otherwise return NULL.
198  */
199  virtual char *TabCompletion(DynaShell &shell,
200  const char *sText,
201  size_t uTextLen,
202  int nState,
203  const char *sContext)
204  {
205  //return ReadLine::FileCompletionGenerator(sText, nState);
206  return NULL;
207  }
208 
209  /*!
210  * \brief Check that the argument count is within the class (min,max).
211  *
212  * \param shell Dynamixel shell.
213  * \param argc Argument count.
214  *
215  * \return
216  * Returns true if the check passed.\n
217  * Otherwise a shell error is printed and false is returned.
218  */
219  virtual bool ChkArgCnt(DynaShell &shell, int argc)
220  {
221  if( (m_nArgCntMin == 0) && (m_nArgCntMax == 0) )
222  {
223  return ChkArgCnt0(shell, argc);
224  }
225  else if( m_nArgCntMin == m_nArgCntMax )
226  {
227  return ChkArgCntEQ(shell, argc, m_nArgCntMin);
228  }
229 
230  if( (m_nArgCntMin > 0) && !ChkArgCntGE(shell, argc, m_nArgCntMin) )
231  {
232  return false;
233  }
234 
235  if( (m_nArgCntMax > 0) && !ChkArgCntLE(shell, argc, m_nArgCntMax) )
236  {
237  return false;
238  }
239 
240  return true;
241  }
242 
243  /*!
244  * \brief Check that the argument count is zero.
245  *
246  * \param shell Dynamixel shell.
247  * \param argc Argument count.
248  *
249  * \return
250  * Returns true if the check passed.\n
251  * Otherwise a shell error is printed and false is returned.
252  */
253  bool ChkArgCnt0(DynaShell &shell, int argc)
254  {
255  if( argc != 0 )
256  {
257  shell.Error("Command has no arguments.");
258  return false;
259  }
260  return true;
261  }
262 
263  /*!
264  * \brief Check that the argument count is equal to the required.
265  *
266  * \param shell Dynamixel shell.
267  * \param argc Argument count.
268  * \param min Required minimum count.
269  *
270  * \return
271  * Returns true if the check passed.\n
272  * Otherwise a shell error is printed and false is returned.
273  */
274  bool ChkArgCntEQ(DynaShell &shell, int argc, int eq)
275  {
276  if( argc != eq )
277  {
278  shell.Error("Argument count %d != required %d.", argc, eq);
279  return false;
280  }
281  return true;
282  }
283 
284  /*!
285  * \brief Check argument count against minimum required.
286  *
287  * \param shell Dynamixel shell.
288  * \param argc Argument count.
289  * \param min Required minimum count.
290  *
291  * \return
292  * Returns true if the check passed.\n
293  * Otherwise a shell error is printed and false is returned.
294  */
295  bool ChkArgCntGE(DynaShell &shell, int argc, int min)
296  {
297  if( argc < min )
298  {
299  shell.Error("Argument count %d < minimum %d.", argc, min);
300  return false;
301  }
302  return true;
303  }
304 
305  /*!
306  * \brief Check argument count against maximum allowed.
307  *
308  * \param shell Dynamixel shell.
309  * \param argc Argument count.
310  * \param min Maximum count.
311  *
312  * \return
313  * Returns true if the check passed.\n
314  * Otherwise a shell error is printed and false is returned.
315  */
316  bool ChkArgCntLE(DynaShell &shell, int argc, int max)
317  {
318  if( argc > max )
319  {
320  shell.Error("Argument count %d > maximum %d.", argc, max);
321  return false;
322  }
323  return true;
324  }
325 
326  /*!
327  * \brief Check that Dynamixel communication exists and is open.
328  *
329  * \param shell Dynamixel shell.
330  *
331  * \return
332  * Returns true if the check passed.\n
333  * Otherwise a shell error is printed and false is returned.
334  */
335  bool ChkComm(DynaShell &shell)
336  {
337  if( (shell.m_pDynaComm == NULL) || !shell.m_pDynaComm->IsOpen() )
338  {
339  shell.Error("No open dynamixel communication.");
340  return false;
341  }
342  return true;
343  }
344 
345  /*!
346  * \brief Check that the servo chain exists.
347  *
348  * \param shell Dynamixel shell.
349  *
350  * \return
351  * Returns true if the check passed.\n
352  * Otherwise a shell error is printed and false is returned.
353  */
354  bool ChkChain(DynaShell &shell)
355  {
356  if( shell.m_pDynaChain == NULL )
357  {
358  shell.Error("No dynamixel chain.");
359  return false;
360  }
361  return true;
362  }
363 
364  /*!
365  * \brief Check that the servo chain exists and is not empty
366  *
367  * \param shell Dynamixel shell.
368  *
369  * \return
370  * Returns true if the check passed.\n
371  * Otherwise a shell error is printed and false is returned.
372  */
374  {
375  if( !ChkChain(shell) )
376  {
377  return false;
378  }
379 
380  if( shell.m_pDynaChain->GetNumberInChain() == 0 )
381  {
382  shell.Error("No servos in dynamixel chain. Try scanning.");
383  return false;
384  }
385  return true;
386  }
387 
388  /*!
389  * \brief Check that the given servo is present in the chain.
390  *
391  * \param shell Dynamixel shell.
392  * \param nServoId Servo id.
393  *
394  * \return
395  * Returns true if the check passed.\n
396  * Otherwise a shell error is printed and false is returned.
397  */
398  bool ChkChainHasServo(DynaShell &shell, int nServoId)
399  {
400  if( !ChkChainNotEmpty(shell) )
401  {
402  return false;
403  }
404 
405  if( !shell.m_pDynaChain->HasServo(nServoId) )
406  {
407  shell.Error("Servo %d not found in chain.", nServoId);
408  return false;
409  }
410  return true;
411  }
412 
413  /*!
414  * \brief Check that the given servo is a master.
415  *
416  * \param shell Dynamixel shell.
417  * \param nServoId Servo id.
418  *
419  * \return
420  * Returns true if the check passed.\n
421  * Otherwise a shell error is printed and false is returned.
422  */
423  bool ChkChainIsMasterServo(DynaShell &shell, int nServoId)
424  {
425  if( !ChkChainHasServo(shell, nServoId) )
426  {
427  return false;
428  }
429 
430  if( !shell.m_pDynaChain->GetServo(nServoId)->IsMaster() )
431  {
432  shell.Error("Servo %d not a master.", nServoId);
433  return false;
434  }
435  return true;
436  }
437 
438  /*!
439  * \brief Convert command argument to integer.
440  *
441  * \param shell Dynamixel shell.
442  * \param sArg String argument to convert.
443  * \param [out] pVal Converted argument.
444  *
445  * \return Returns true on success, otherwise a shell error is printed and
446  * false is returned.
447  */
448  bool ToInt(DynaShell &shell, const char *sArg, int *pVal)
449  {
450  char *t;
451 
452  *pVal = (int)strtol(sArg, &t, 0);
453 
454  if( *t != 0 )
455  {
456  shell.Error("Argument value \"%s\": Not an integer.", sArg);
457  return false;
458  }
459  return true;
460  }
461 
462  /*!
463  * \brief Convert command argument to unsigned integer.
464  *
465  * \param shell Dynamixel shell.
466  * \param sArg String argument to convert.
467  * \param [out] pVal Converted argument.
468  *
469  * \return Returns true on success, otherwise a shell error is printed and
470  * false is returned.
471  */
472  bool ToUInt(DynaShell &shell, const char *sArg, uint_t *pVal)
473  {
474  return ToInt(shell, sArg, (int *)pVal);
475  }
476 
477  /*!
478  * \brief Convert command argument to double.
479  *
480  * \param shell Dynamixel shell.
481  * \param sArg String argument to convert.
482  * \param [out] pVal Converted argument.
483  *
484  * \return Returns true on success, otherwise a shell error is printed and
485  * false is returned.
486  */
487  bool ToDouble(DynaShell &shell, const char *sArg, double *pVal)
488  {
489  if( sscanf(sArg, "%lf", pVal) != 1 )
490  {
491  shell.Error("Argument value \"%s\": Not a floating-point number.", sArg);
492  return false;
493  }
494  return true;
495  }
496 
497  /*!
498  * \brief Convert command argument to boolean.
499  *
500  * \param shell Dynamixel shell.
501  * \param sArg String argument to convert.
502  * \param [out] pVal Converted argument.
503  *
504  * \return Returns true on success, otherwise a shell error is printed and
505  * false is returned.
506  */
507  bool ToBool(DynaShell &shell, const char *sArg, bool *pVal)
508  {
509  int i;
510  char *t;
511 
512  if( !strcasecmp(sArg, "t") || !strcasecmp(sArg, "true") )
513  {
514  *pVal = true;
515  return true;
516  }
517  else if( !strcasecmp(sArg, "f") || !strcasecmp(sArg, "false") )
518  {
519  *pVal = false;
520  return true;
521  }
522 
523  i = (int)strtol(sArg, &t, 0);
524 
525  if( *t != 0 )
526  {
527  shell.Error("Argument value \"%s\": Not an boolean.", sArg);
528  return false;
529  }
530 
531  *pVal = i? true: false;
532 
533  return true;
534  }
535 
536 protected:
537  const char *m_sCmdName; ///< command name
538  const char *m_sCmdHelpBrief; ///< command help brief
539  const char *m_sCmdHelpArgs; ///< command help arguments
540  const char *m_sCmdHelpDesc; ///< command help description
541  const int m_nArgCntMin; ///< minimum argument count
542  const int m_nArgCntMax; ///< maximum argument count (0 if not max)
543  int m_nPubLevel; ///< command's published level (depth)
544  char *m_sPubName; ///< command's published name
545 
546  virtual void PrintSynopses(int indent, int width);
547  virtual void PrintBlock(int col, int indent, int width, const char *sText);
548  virtual void PrintDelim(int width, const char cDelim);
549  char *eow(const char *s);
550 };
551 
552 
553 // -----------------------------------------------------------------------------
554 // DynaShellCmdChainIn Class
555 // -----------------------------------------------------------------------------
556 
557 /*!
558  * \brief Dynamixel chain input command abstract base class.
559  *
560  * This class supports parsing a list of (master) servos as arguments to a
561  * derived command class executinng servo 'read-like' input operations. Input
562  * operations include read and get.
563  *
564  * \par Syntax:
565  * \verbatim
566  * CMD args
567  * args ::=
568  * 'chain'
569  * | servo_list
570  * servo_list ::=
571  * servo_id
572  * | servo_list servo_id
573  * servo_id ::= INT
574  * \endverbatim
575  */
577 {
578 public:
579  /*!
580  * \brief Default constructor.
581  */
582  DynaShellCmdChainIn(bool bMasterOpOnly=false) :
584  {
585  m_bMasterOpOnly = bMasterOpOnly;
586 
587  }
588 
589  /*!
590  * \brief Default destructor.
591  */
592  virtual ~DynaShellCmdChainIn() { }
593 
594  virtual void Exec(DynaShell &shell, int argc, char *argv[]);
595 
596  virtual char *TabCompletion(DynaShell &shell,
597  const char *sText,
598  size_t uTextLen,
599  int nState,
600  const char *sContext);
601 
602 protected:
603  bool m_bMasterOpOnly; ///< is [not] a master-only supported operation
604  int m_nTabIter; ///< tab completion: servo id iterator
605  int m_nTabServoId; ///< tab completion: current servo id
606  bool m_bTabIncChain; ///< tab completion: [do not] include chain keyword
607 
608  /*!
609  * \brief Derived class specific execution function.
610  *
611  * \param shell Dynamixel shell.
612  * \param pServo Pointer to servo to perform the action on.
613  */
614  virtual void doExec(DynaShell &shell, DynaServo *pServo) = 0;
615 };
616 
617 
618 // -----------------------------------------------------------------------------
619 // DynaShellCmdChainOut Class
620 // -----------------------------------------------------------------------------
621 
622 /*!
623  * \brief Execute 2-tuple structure type.
624  */
625 typedef struct
626 {
627  int m_nServoId; ///< servo id
628  int m_nVal; ///< value
629 } ExecTup_T;
630 
631 
632 /*!
633  * \brief Dynamixel chain output command abstract base class.
634  *
635  * This class supports parsing a 2-tuple list of (master) servos as arguments
636  * to a derived command class executinng servo 'write-like' output operations.
637  * Output operations include write, move, and set.
638  *
639  * \par Syntax:
640  * \verbatim
641  * CMD args
642  * args ::=
643  * 'chain' value
644  * | tuple_list
645  * tuple_list ::=
646  * tuple
647  * | tuple_list tuple
648  * tuple ::=
649  * servo_id value
650  * servo_id ::= INT
651  * value ::= VAL_TO_UINT
652  * \endverbatim
653  */
655 {
656 public:
657  /*!
658  * \brief Default constructor.
659  */
660  DynaShellCmdChainOut(bool bMasterOpOnly=false) :
662  {
663  m_bMasterOpOnly = bMasterOpOnly;
664  }
665 
666  /*!
667  * \brief Default destructor.
668  */
669  virtual ~DynaShellCmdChainOut() { }
670 
671  virtual void Exec(DynaShell &shell, int argc, char *argv[]);
672 
673  virtual char *TabCompletion(DynaShell &shell,
674  const char *sText,
675  size_t uTextLen,
676  int nState,
677  const char *sContext);
678 
679 protected:
680  bool m_bMasterOpOnly; ///< is [not] a master-only supported operation
681  int m_nTabIter; ///< tab completion: servo id iterator
682  int m_nTabServoId; ///< tab completion: current servo id
683  bool m_bTabIncChain; ///< tab completion: [do not] include chain keyword
684 
685  /*!
686  * \brief Derived class specific execution function.
687  *
688  * \param shell Dynamixel shell.
689  * \param tup Array of (servo id, value) 2-tuples.
690  * \param uCount Number of tuples.
691  */
692  virtual void doExec(DynaShell &shell, ExecTup_T tup[], uint_t uCount) = 0;
693 
694  /*!
695  * \brief Convert command argument into unsigned integer.
696  *
697  * \param shell Dynamixel shell.
698  * \param sArg String argument to convert.
699  * \param [out] pVal Converted argument.
700  *
701  * \return Returns true on success, false otherwise.
702  */
703  virtual bool ArgToUInt(DynaShell &shell, const char *sArg, uint_t *pVal)
704  {
705  return ToUInt(shell, sArg, pVal);
706  }
707 
708  virtual bool ArgToInt(DynaShell &shell, const char *sArg, int *pVal)
709  {
710  return ToInt(shell, sArg, pVal);
711  }
712 };
713 
714 
715 // ----------------------------------------------------------------------------
716 // Prototypes
717 // ----------------------------------------------------------------------------
718 
719 extern void PublishShellCoreCommands(DynaShell &shell);
720 extern void PublishShellInterfaceCommands(DynaShell &shell);
721 extern void PublishShellServoCommands(DynaShell &shell);
722 extern void PublishShellTrainCommands(DynaShell &shell);
723 
724 
725 #endif // _DYNASHELL_CMD_H
const char * m_sCmdName
command name
RoadNarrows Dynamixel Bus Communications Abstract Base Class Interface.
char * newstr(const char *s)
Allocate new duplicated string.
virtual bool ArgToUInt(DynaShell &shell, const char *sArg, uint_t *pVal)
Convert command argument into unsigned integer.
void PublishShellServoCommands(DynaShell &shell)
Publish shell servo commands to shell.
DynaShellCmdChainOut(bool bMasterOpOnly=false)
Default constructor.
bool ChkChainNotEmpty(DynaShell &shell)
Check that the servo chain exists and is not empty.
bool ChkArgCntEQ(DynaShell &shell, int argc, int eq)
Check that the argument count is equal to the required.
bool ChkChain(DynaShell &shell)
Check that the servo chain exists.
void PublishShellInterfaceCommands(DynaShell &shell)
Publish shell dynamixel interface commands to shell.
int m_nServoId
servo id
Definition: t.py:1
DynaComm * m_pDynaComm
dynamixel bus communication
Definition: dynashell.h:359
virtual bool IsOpen()
Test if Dynamixel Bus is open.
Definition: DynaComm.h:383
virtual char * TabCompletion(DynaShell &shell, const char *sText, size_t uTextLen, int nState, const char *sContext)
Default command tab completion generator.
void PublishShellTrainCommands(DynaShell &shell)
Publish shell servo commands to shell.
bool ChkChainHasServo(DynaShell &shell, int nServoId)
Check that the given servo is present in the chain.
RoadNarrows Dynamixel Servo Chain Container Base Class Interface.
int m_nPubLevel
command&#39;s published level (depth)
const char * m_sCmdHelpDesc
command help description
Dynamixel shell command abstract base class.
Definition: dynashell_cmd.h:80
bool ChkChainIsMasterServo(DynaShell &shell, int nServoId)
Check that the given servo is a master.
#define DYNA_ID_NUMOF
number of unique servo id&#39;s
Definition: Dynamixel.h:148
virtual ~DynaShellCmdChainIn()
Default destructor.
bool ChkArgCnt0(DynaShell &shell, int argc)
Check that the argument count is zero.
virtual uint_t GetNumberInChain() const
Get the number of servos currently in chain.
Definition: DynaChain.h:140
DynaShellCmd(int nArgCntMin=0, int nArgCntMax=0)
Default constructor.
Definition: dynashell_cmd.h:95
Dynamixel Servo Abstract Base Class.
Definition: DynaServo.h:78
bool ToInt(DynaShell &shell, const char *sArg, int *pVal)
Convert command argument to integer.
Execute 2-tuple structure type.
const int m_nArgCntMax
maximum argument count (0 if not max)
void PublishShellCoreCommands(DynaShell &shell)
Publish shell core commands to shell.
int m_nTabIter
tab completion: servo id iterator
bool ToBool(DynaShell &shell, const char *sArg, bool *pVal)
Convert command argument to boolean.
char * m_sPubName
command&#39;s published name
int SetPublishedInfo(int nLevel, const char *sParent=NULL)
bool IsMaster() const
Test if this servo is a master.
Definition: DynaServo.h:223
bool m_bMasterOpOnly
is [not] a master-only supported operation
bool ToDouble(DynaShell &shell, const char *sArg, double *pVal)
Convert command argument to double.
const char * m_sCmdHelpBrief
command help brief
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).
int GetPublishedLevel() const
const char * GetCmdName()
Get dynamixel shell command name.
int m_nVal
value
virtual bool HasServo(int nServoId) const
Definition: DynaChain.h:113
RoadNarrows Dynamixel Archetype Servo Abstract Base Class.
virtual ~DynaShellCmd()
Default destructor.
Dynamixel chain input command abstract base class.
const char * m_sCmdHelpArgs
command help arguments
RoadNarrows Dynamixel Top-Level Package Header File.
bool ChkComm(DynaShell &shell)
Check that Dynamixel communication exists and is open.
const char * GetCmdHelpBrief()
Get shell command name brief description.
Dynamixel chain output command abstract base class.
int m_nTabIter
tab completion: servo id iterator
const int m_nArgCntMin
minimum argument count
const char * GetPublishedName() const
int m_nTabServoId
tab completion: current servo id
bool m_bTabIncChain
tab completion: [do not] include chain keyword
bool ChkArgCntGE(DynaShell &shell, int argc, int min)
Check argument count against minimum required.
DynaChain * m_pDynaChain
dynamixel chain
Definition: dynashell.h:360
void Error(int rc, const char *sFmt,...)
Raise error on dynamixel error code.
Definition: dynashell.cxx:808
bool ToUInt(DynaShell &shell, const char *sArg, uint_t *pVal)
Convert command argument to unsigned integer.
bool m_bMasterOpOnly
is [not] a master-only supported operation
virtual ~DynaShellCmdChainOut()
Default destructor.
The simple dynashell declarations.
bool m_bTabIncChain
tab completion: [do not] include chain keyword
bool ChkArgCntLE(DynaShell &shell, int argc, int max)
Check argument count against maximum allowed.
int m_nTabServoId
tab completion: current servo id
DynaShellCmdChainIn(bool bMasterOpOnly=false)
Default constructor.