51 #ifndef _DYNASHELL_RECORDING_H 52 #define _DYNASHELL_RECORDING_H 60 #include "rnr/rnrconfig.h" 96 static const int END = -1;
141 virtual int AddField(
int nPos,
int nSpeed);
167 return nFldNum < m_nFieldCnt? m_field[nFldNum]: NoField;
189 static const int MaxRecords = 5000;
190 static const int END = -1;
206 m_vecServoInfo.clear();
211 virtual void Init(
int nSamplePeriod,
const char *sDate = NULL);
222 return m_nRecordCnt > 0? 0: END;
243 return nRecNum < m_nRecordCnt? nRecNum: END;
246 virtual int AddRecord();
258 if( (nRecNumDst == END) || (nRecNumDst >= m_nRecordCnt) ||
259 (nRecNumSrc == END) || (nRecNumSrc >= m_nRecordCnt) )
264 m_record[nRecNumDst] = m_record[nRecNumSrc];
280 if( (nRecNum < m_nRecordCnt) && (m_record[nRecNum].GetFieldCount() > 0) )
304 if( (nFldNum == END) || (nRecNum >= m_nRecordCnt) )
311 return nFldNum < m_record[nRecNum].GetFieldCount()? nFldNum: END;
314 virtual int AddFieldTuple(
int nRecNum,
int nServoId,
int nPos,
int nSpeed);
328 const int nFldNum)
const 330 if( (nRecNum < m_nRecordCnt) &&
331 (nFldNum < m_record[nRecNum].GetFieldCount()) )
333 return m_record[nRecNum][nFldNum];
361 return (
int)m_vecServoInfo.size();
364 virtual int RegisterServoInfo(
int nServoId, uint_t uModelNum);
374 return (nFldNum < (
int)m_vecServoInfo.size())?
389 return (nFldNum < (
int)m_vecServoInfo.size()) &&
390 (m_vecServoInfo[nFldNum].m_nServoId == nServoId);
403 return m_mapIIdx.find(nServoId) != m_mapIIdx.end();
416 MapIIdx::iterator iter;
418 if( (iter = m_mapIIdx.find(nServoId)) != m_mapIIdx.end() )
420 return m_vecServoInfo[m_mapIIdx[nServoId]].m_uModelNum;
435 return m_nSamplePeriod;
445 if( nSamplePeriod < 1 )
449 m_nSamplePeriod = nSamplePeriod;
462 virtual void SetDate(
const char *sDate);
474 return m_record[nRecNum];
498 #endif // _DYNASHELL_RECORDING_H RoadNarrows Dynamixel Bus Communications Abstract Base Class Interface.
virtual int GetNumOfRecords()
Get the number of records in the recording.
char * m_sDate
recording date
#define DYNA_OK
not an error, success
#define DYNA_MODEL_NUM_GENERIC
generic, base model
Record Field Tuple Structure Type.
Dynamixel shell utilities.
virtual ~DynaRecording()
Default destructor.
DynaRecord()
Default constructor.
DynaRecord const & operator[](const int nRecNum) const
Subscript operator.
FieldTuple_T const & operator[](const int nFldNum) const
Subscript operator.
#define DELOBJ(p)
Delete an allocated object convenience macro.
RoadNarrows Dynamixel Servo Chain Container Base Class Interface.
Key Recorded Servo Information Structure Type.
virtual const int GetServoId(int nFldNum)
Get the servo id associated with the given field number.
virtual int SetSamplePeriod(int nSamplePeriod)
Set the sample period of the recording.
#define DYNA_ID_NUMOF
number of unique servo id's
virtual uint_t GetServoModelNumber(int nServoId)
Get the registered servo model number.
virtual int GetSamplePeriod() const
Get the sample period of the recording.
VecServoInfo m_vecServoInfo
vector of recorded servo information
static const FieldTuple_T NoField
virtual const char * GetDate() const
Get the recording data.
virtual bool HasServoAt(int nFldNum, int nServoId) const
Check if the given servo is associated with the given field number, as per the ordering of the regist...
int m_nRecordCnt
number of records recorded
MapIIdx m_mapIIdx
indirect index map
virtual int FirstRecord()
Get the first record number in the recording.
DynaRecording()
Default constructor.
map< int, int > MapIIdx
Indirect indexing by servo id of servo info map.
virtual int NextField(int nRecNum, int nFldNum)
Get the next field number in the record after the given field number.
virtual int GetNumOfServosInRecording()
Get the number of servos in the recording.
virtual int NextRecord(int nRecNum)
Get the next record number in the recording after the given record number.
RoadNarrows Dynamixel Top-Level Package Header File.
virtual const DynaRecord::FieldTuple_T & GetField(const int nRecNum, const int nFldNum) const
Get the given recorded field tuple.
virtual bool HasServo(int nServoId)
Check if the given servo is in the list of registered servos in the recording header.
int m_nSamplePeriod
recording sample period (ms)
#define DYNA_ID_NONE
no servo id
uint_t m_uModelNum
servo model number
virtual int FirstField(int nRecNum)
Get the first field number in the given record.
#define DYNA_ECODE_BAD_VAL
bad value
virtual int CopyRecord(int nRecNumDst, int nRecNumSrc)
Copy source record to destination record.
virtual ~DynaRecord()
Default destructor.
int m_nFieldCnt
number of field tuples
vector< ServoInfo_T > VecServoInfo
Map of record servos ids and model numbers indexed by field number.
void ResetFieldCount()
Reset the field count to zero.
int GetFieldCount() const
Get the current number of field tuples in record.
static const bool NaF(FieldTuple_T &field)
Test if field is 'Not a Field'.