59 #include "rnr/rnrconfig.h" 98 int nFldNum = m_nFieldCnt;
99 m_field[nFldNum].m_nPos = nPos;
100 m_field[nFldNum].m_nSpeed = nSpeed;
123 for(i=0; i<m_nFieldCnt; ++i)
152 m_vecServoInfo.clear();
157 m_nSamplePeriod = nSamplePeriod;
161 for(nRecNum=0; nRecNum<MaxRecords; ++nRecNum)
163 m_record[nRecNum].ResetFieldCount();
180 if( (m_nRecordCnt >= MaxRecords) || (GetNumOfServosInRecording() == 0) )
186 nRecNum = m_nRecordCnt;
187 m_record[nRecNum].ResetFieldCount();
215 nFieldCnt = m_record[nRecNum].GetFieldCount();
221 else if( nRecNum >= m_nRecordCnt )
223 LOGERROR(
"Record number %d >= record count = %d.", nRecNum, m_nRecordCnt);
226 else if( nFieldCnt >= GetNumOfServosInRecording() )
228 LOGERROR(
"Record %d field count %d at maximum.", nRecNum, nFieldCnt);
231 else if( !HasServoAt(nFieldCnt, nServoId) )
233 LOGERROR(
"Servo %d not found in recording header at field position %d.",
234 nServoId, nFieldCnt);
239 return m_record[nRecNum].AddField(nPos, nSpeed);
259 if( m_mapIIdx.find(nServoId) != m_mapIIdx.end() )
271 m_vecServoInfo.push_back(info);
272 m_mapIIdx[nServoId] = (int)m_vecServoInfo.size() - 1;
295 m_sDate =
new char[n];
297 if( (localtime_r(&tnow, &bdtime) == NULL) ||
298 (strftime(m_sDate, n,
"%a %b %H:%M:%S %Y", &bdtime) == 0) )
300 strcpy(m_sDate,
"Unknown Date");
RoadNarrows Dynamixel Bus Communications Abstract Base Class Interface.
char * newstr(const char *s)
Allocate new duplicated string.
#define DYNA_OK
not an error, success
Record Field Tuple Structure Type.
virtual int AddRecord()
Add a new empty record to the recording.
Dynamixel shell utilities.
virtual int AddFieldTuple(int nRecNum, int nServoId, int nPos, int nSpeed)
Add new recording field tuple.
#define DELOBJ(p)
Delete an allocated object convenience macro.
RoadNarrows Dynamixel Servo Chain Container Base Class Interface.
DynaRecord & operator=(const DynaRecord &rhs)
Assignment operator.
Key Recorded Servo Information Structure Type.
#define DYNA_ID_NUMOF
number of unique servo id's
FieldTuple_T m_field[DYNA_ID_NUMOF]
one record of field data
virtual void SetDate(const char *sDate)
static const FieldTuple_T NoField
#define DYNA_ECODE_RSRC
no resource
The Dynamixel Recording Class.
virtual void Init(int nSamplePeriod, const char *sDate=NULL)
(Re)Initialize recording.
static const int END
past-the-end mark
RoadNarrows Dynamixel Top-Level Package Header File.
uint_t m_uModelNum
servo model number
virtual int RegisterServoInfo(int nServoId, uint_t uModelNum)
Register servo information in recording header.
#define DYNA_ECODE_BAD_VAL
bad value
int m_nFieldCnt
number of field tuples
The simple dynashell declarations.
virtual int AddField(int nPos, int nSpeed)
Add a field tuple to the record.