![]() |
Dynamixel
2.9.5
RoadNarrows Robotics Dynamixel Package
|
Record dynamixel chain movements. More...
Public Member Functions | |
DynaShellCmdPlay () | |
Default constructor. | |
virtual | ~DynaShellCmdPlay () |
Default destructor. | |
virtual void | Exec (DynaShell &shell, int argc, char *argv[]) |
Execute playback of recording. More... | |
virtual char * | TabCompletion (DynaShell &shell, const char *sText, size_t uTextLen, int nState, const char *sContext) |
Command tab completion generator. More... | |
![]() | |
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 Types | |
typedef vector< vector< uint_t > > | VecCurves |
Protected Member Functions | |
void | Play (DynaShell &shell) |
Play back the previously recorded Dynamixel chain motion sequence. More... | |
int | SetRecordGoals (DynaShell &shell, int nRecNum) |
Set record goals. More... | |
int | ControlToGoals (DynaShell &shell, int nRecNum, double dt) |
Control the servos speed to reach the goal positions, hopefully at the end of the sampled period and with the sampled speed. More... | |
void | Init (DynaShell &shell) |
void | SmoothRecordingCurves (DynaShell &shell) |
void | BSplineCurve (DynaShell &shell, int nFldNum) |
void | PidInit (DynaShell &shell) |
Initialize servo PIDs. More... | |
int | PidSetPoint (DynaShell &shell, int nServoId, int nGoalPos, int nGoalSpeed) |
Specify (new) PID goal position setpoint. More... | |
void | Cleanup (DynaShell &shell) |
Clean up any allocated playback resources. More... | |
bool | MoveToStart (DynaShell &shell) |
void | SecureArm (DynaShell &shell) |
Secure arm in safe postition if posible. More... | |
void | PlotInit (DynaShell &shell) |
Initialize plot data output. More... | |
void | PlotWriteData (DynaShell &shell, int nRecNum, double dt, int nServoId, int nCurPos) |
Write plot data to plot file. More... | |
void | WaitStop (DynaShell &shell) |
Wait until all servos in chain have stopped moving utility function. More... | |
![]() | |
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 | |
int | m_nNumSubSamplePts |
sub-sample playback control period (msec) | |
double | m_fSpeedPct |
playback speed as a % of recorded speed | |
double | m_fSamplePeriod |
playback sample period (seconds) | |
double | m_fSubSamplePeriod |
control sub-sample period (seconds) | |
double | m_dt |
playback delta time (seconds) | |
VecCurves | m_vecCurves |
vector of fitted smooth curves | |
double | m_fTAccum |
accumulated time | |
FILE * | m_fpPlot |
plot data file pointer | |
int | m_nPlotLineCnt |
plotted data line count | |
int | m_nTabIndex |
tab completion: keyword index | |
![]() | |
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 | |
Record dynamixel chain movements.
Definition at line 1496 of file dynashell_cmd_train.cxx.
|
inlineprotected |
Clean up any allocated playback resources.
shell | Dynamixel shell. |
Definition at line 2123 of file dynashell_cmd_train.cxx.
|
inlineprotected |
Control the servos speed to reach the goal positions, hopefully at the end of the sampled period and with the sampled speed.
shell | Dynamixel shell. |
nRecNum | Record number in the recording. |
dt | Delta time (seconds). |
Definition at line 1861 of file dynashell_cmd_train.cxx.
References DYNA_ID_NUMOF, DYNA_OK, DynaStrError(), DynaRecording::END, DynaRecording::FirstField(), DynaRecording::GetNumOfRecords(), DynaRecording::GetSamplePeriod(), DynaChain::GetServo(), DynaRecording::GetServoId(), DynaSpeedTuple_T::m_nServoId, DynaSpeedTuple_T::m_nSpeed, DynaShell::m_pDynaChain, DynaShell::m_pRecording, DynaRecording::NextField(), and DynaChain::SyncWriteGoalSpeed().
|
inlinevirtual |
Execute playback of recording.
shell | Dynamixel shell. |
argc | Command argument count. |
argv | Array of arguments. |
Implements DynaShellCmd.
Definition at line 1537 of file dynashell_cmd_train.cxx.
References DYNA_ID_NONE, DynaShell::Error(), DynaServo::GetModelNumber(), DynaChain::GetNumberOfMastersInChain(), DynaRecording::GetNumOfRecords(), DynaRecording::GetNumOfServosInRecording(), DynaChain::GetServo(), DynaRecording::GetServoModelNumber(), DynaRecording::HasServo(), DynaChain::IterNextMaster(), DynaChain::IterStartMaster(), DynaShell::m_pDynaChain, DynaShell::m_pRecording, and TRY.
|
inlineprotected |
Initialize servo PIDs.
shell | Dynamixel shell. |
Definition at line 2064 of file dynashell_cmd_train.cxx.
References DYNA_ID_NONE, DynaChain::GetServo(), DynaChain::IterNextMaster(), DynaChain::IterStartMaster(), and DynaShell::m_pDynaChain.
|
inlineprotected |
Specify (new) PID goal position setpoint.
shell | Dynamixel shell. |
nServoId | Servo Id. |
uGoalPos | Goal odometer position. |
nGoalSpeed | Goal speed. Direction is important since a position may be obtained in two rotation directions. |
Definition at line 2090 of file dynashell_cmd_train.cxx.
References DYNA_DIR_CCW, DYNA_DIR_CW, DYNA_OK, DynaStrError(), DynaChain::GetServo(), and DynaShell::m_pDynaChain.
|
inlineprotected |
Play back the previously recorded Dynamixel chain motion sequence.
shell | Dynamixel shell. |
Definition at line 1727 of file dynashell_cmd_train.cxx.
References DYNA_OK, DynaRecording::END, DynaRecording::FirstRecord(), DynaRecording::GetDate(), DynaRecording::GetNumOfRecords(), DynaShell::m_pRecording, DynaRecording::NextRecord(), DynaShell::Response(), and waitkey().
|
inlineprotected |
Initialize plot data output.
shell | Dynamixel shell. |
Definition at line 2154 of file dynashell_cmd_train.cxx.
References DynaRecording::GetDate(), DynaRecording::GetNumOfRecords(), DynaRecording::GetSamplePeriod(), and DynaShell::m_pRecording.
|
inlineprotected |
Write plot data to plot file.
shell | Dynamixel shell. |
nRecNum | Record number. |
dt | Playback delta time step (seconds). |
nServoid | Servo Id. |
nCurPos | Servo current position. |
Definition at line 2188 of file dynashell_cmd_train.cxx.
References DynaChain::GetServo(), and DynaShell::m_pDynaChain.
|
inlineprotected |
Secure arm in safe postition if posible.
pDynaChain | Pointer to Dynamixel chain handle. |
Definition at line 2144 of file dynashell_cmd_train.cxx.
References DynaChain::Freeze(), and DynaShell::m_pDynaChain.
|
inlineprotected |
Set record goals.
shell | Dynamixel shell. |
nRecNum | Record number in the recording. |
Definition at line 1800 of file dynashell_cmd_train.cxx.
References DYNA_ID_NUMOF, DYNA_OK, DynaStrError(), DynaRecording::END, DynaRecording::FirstField(), DynaRecording::GetField(), DynaRecording::GetServoId(), DynaRecord::FieldTuple_T::m_nPos, DynaPosTuple_T::m_nPos, DynaPosTuple_T::m_nServoId, DynaRecord::FieldTuple_T::m_nSpeed, DynaShell::m_pDynaChain, DynaShell::m_pRecording, DynaRecording::NextField(), and DynaChain::SyncMoveTo().
|
inlinevirtual |
Command tab completion generator.
Completes NULL 100 <plot_file>
shell | Dynamixel shell. |
sText | Partial text string to complete. |
uTextLen | Length of text. |
nState | Generator state. If FIRST, then initialize any statics. |
sContext | Generator context (i.e. canonical command path). |
Reimplemented from DynaShellCmd.
Definition at line 1671 of file dynashell_cmd_train.cxx.
References ReadLine::dupstr(), ReadLine::FileCompletionGenerator(), ReadLine::FIRST, and ReadLine::wc().
|
inlineprotected |
Wait until all servos in chain have stopped moving utility function.
shell | Dynamixel shell. |
Definition at line 2216 of file dynashell_cmd_train.cxx.
References DYNA_ID_NONE, DYNA_OK, DynaChain::GetNumberInChain(), DynaChain::GetServo(), DynaChain::IterNext(), DynaChain::IterStart(), and DynaShell::m_pDynaChain.