Hekateros  3.4.3
RoadNarrows Robotics Robot Arm Project
hekateros::HekSpec Class Reference

Robotic specification. More...

#include <hekSpec.h>

Public Member Functions

 HekSpec ()
 Constructor.
 
 ~HekSpec ()
 Destructor.
 
int set (int eProdId, uint_t uHwVer)
 Set product fixed specification. More...
 
void clear ()
 Clear product fixed specification.
 
int getProdFamily ()
 Get specification's product family id. More...
 
int getProdId ()
 Get specification's product id. More...
 
uint_t getProdHwVer ()
 Get specification's product hardware version number. More...
 
int getNumLinks ()
 Get specification's number of links. More...
 
int getDoF ()
 Get specification's degrees of freedom. More...
 
int getNumOpticalLimits ()
 Get specification's number of optical limits. More...
 
int getNumServos ()
 Get specification's number of servos. More...
 
HekSpecLink_TgetLinkSpecAt (int index)
 Get link spec at the given index. More...
 
HekSpecJoint_TgetJointSpecAt (int index)
 Get joint spec at the given index. More...
 
HekSpecJoint_TgetJointSpec (std::string &strName)
 Get joint spec associated joint name. More...
 
HekSpecJoint_TgetJointSpec (int nServoId)
 Get joint spec associated with servo id. More...
 
HekSpecServo_TgetServoSpecAt (int index)
 Get servo spec at the given index. More...
 
HekSpecServo_TgetServoSpec (int nServoId)
 Get servo spec associated with servo id. More...
 
bool hasServo (int nServoId)
 Test if servo id is in the servo specifications. More...
 

Protected Attributes

int m_eProdFamily
 product family
 
int m_eProdId
 product id
 
uint_t m_uHwVer
 hardware version
 
int m_nNumLinks
 number of links
 
int m_nDoF
 degrees of freedom
 
int m_nNumOptLimits
 number of optical limits
 
int m_nNumServos
 number of servos
 
std::vector< HekSpecLink_Tm_vecSpecLinks
 vector of link specs
 
std::vector< HekSpecJoint_Tm_vecSpecJoints
 vector of joint specs
 
std::vector< HekSpecServo_Tm_vecSpecServos
 vector of servo specs
 

Friends

class HekDesc
 
class HekRobot
 

Detailed Description

Robotic specification.

Definition at line 232 of file hekSpec.h.

Member Function Documentation

int hekateros::HekSpec::getDoF ( )
inline

Get specification's degrees of freedom.

Returns
Returns DoF.

Definition at line 303 of file hekSpec.h.

304  {
305  return m_nDoF;
306  }
int m_nDoF
degrees of freedom
Definition: hekSpec.h:403
HekSpecJoint_T* hekateros::HekSpec::getJointSpec ( std::string &  strName)

Get joint spec associated joint name.

Parameters
strNameJoint name (primary key).
Returns
If found, returns pointer to spec. Otherwise returns NULL.
HekSpecJoint_T * HekSpec::getJointSpec ( int  nServoId)

Get joint spec associated with servo id.

Parameters
nServoIdServo id (secondary key).
Returns
If found, returns pointer to spec. Otherwise returns NULL.

Definition at line 275 of file hekSpec.cxx.

276 {
277  vector<HekSpecJoint_T>::iterator iter;
278 
279  for(iter = m_vecSpecJoints.begin(); iter != m_vecSpecJoints.end(); ++iter)
280  {
281  if( iter->m_nMasterServoId == nServoId )
282  {
283  return &(*iter);
284  }
285  }
286 
287  return NULL;
288 }
std::vector< HekSpecJoint_T > m_vecSpecJoints
vector of joint specs
Definition: hekSpec.h:407
HekSpecJoint_T* hekateros::HekSpec::getJointSpecAt ( int  index)
inline

Get joint spec at the given index.

Parameters
indexJoint index.
Returns
If found, returns pointer to spec. Otherwise returns NULL.

Definition at line 347 of file hekSpec.h.

Referenced by hekateros::HekRobot::convertSpecs().

348  {
349  return index < m_vecSpecJoints.size()? &m_vecSpecJoints.at(index): NULL;
350  }
std::vector< HekSpecJoint_T > m_vecSpecJoints
vector of joint specs
Definition: hekSpec.h:407
HekSpecLink_T* hekateros::HekSpec::getLinkSpecAt ( int  index)
inline

Get link spec at the given index.

Parameters
indexLink index.
Returns
If found, returns pointer to spec. Otherwise returns NULL.

Definition at line 335 of file hekSpec.h.

336  {
337  return index < m_vecSpecLinks.size()? &m_vecSpecLinks.at(index): NULL;
338  }
std::vector< HekSpecLink_T > m_vecSpecLinks
vector of link specs
Definition: hekSpec.h:406
int hekateros::HekSpec::getNumLinks ( )
inline

Get specification's number of links.

Returns
Returns number of links.

Definition at line 293 of file hekSpec.h.

294  {
295  return m_nNumLinks;
296  }
int m_nNumLinks
number of links
Definition: hekSpec.h:402
int hekateros::HekSpec::getNumOpticalLimits ( )
inline

Get specification's number of optical limits.

Returns
Returns number of optical limits.

Definition at line 313 of file hekSpec.h.

314  {
315  return m_nNumOptLimits;
316  }
int m_nNumOptLimits
number of optical limits
Definition: hekSpec.h:404
int hekateros::HekSpec::getNumServos ( )
inline

Get specification's number of servos.

Returns
Returns number of servos.

Definition at line 323 of file hekSpec.h.

Referenced by hekateros::HekDescEE::getNumServos(), and hekateros::HekDescArm::getNumServos().

324  {
325  return m_nNumServos;
326  }
int m_nNumServos
number of servos
Definition: hekSpec.h:405
int hekateros::HekSpec::getProdFamily ( )
inline

Get specification's product family id.

Returns
Returns family id.

Definition at line 263 of file hekSpec.h.

264  {
265  return m_eProdFamily;
266  }
int m_eProdFamily
product family
Definition: hekSpec.h:399
uint_t hekateros::HekSpec::getProdHwVer ( )
inline

Get specification's product hardware version number.

Returns
Returns version number.

Definition at line 283 of file hekSpec.h.

284  {
285  return m_uHwVer;
286  }
uint_t m_uHwVer
hardware version
Definition: hekSpec.h:401
int hekateros::HekSpec::getProdId ( )
inline

Get specification's product id.

Returns
Returns product id. See HekProdId.

Definition at line 273 of file hekSpec.h.

274  {
275  return m_eProdId;
276  }
int m_eProdId
product id
Definition: hekSpec.h:400
HekSpecServo_T * HekSpec::getServoSpec ( int  nServoId)

Get servo spec associated with servo id.

Parameters
nServoIdServo id (key).
Returns
If found, returns pointer to spec. Otherwise returns NULL.

Definition at line 290 of file hekSpec.cxx.

Referenced by hekateros::HekRobot::convertSpecs().

291 {
292  vector<HekSpecServo_T>::iterator iter;
293 
294  for(iter = m_vecSpecServos.begin(); iter != m_vecSpecServos.end(); ++iter)
295  {
296  if( iter->m_nServoId == nServoId )
297  {
298  return &(*iter);
299  }
300  }
301 
302  return NULL;
303 }
std::vector< HekSpecServo_T > m_vecSpecServos
vector of servo specs
Definition: hekSpec.h:408
HekSpecServo_T* hekateros::HekSpec::getServoSpecAt ( int  index)
inline

Get servo spec at the given index.

Parameters
indexServo index.
Returns
If found, returns pointer to spec. Otherwise returns NULL.

Definition at line 377 of file hekSpec.h.

378  {
379  return index < m_vecSpecServos.size()? &m_vecSpecServos.at(index): NULL;
380  }
std::vector< HekSpecServo_T > m_vecSpecServos
vector of servo specs
Definition: hekSpec.h:408
bool HekSpec::hasServo ( int  nServoId)

Test if servo id is in the servo specifications.

Returns
Returns true or false.

Definition at line 305 of file hekSpec.cxx.

Referenced by hekateros::HekDescEE::hasServo(), and hekateros::HekDescArm::hasServo().

306 {
307  vector<HekSpecServo_T>::iterator iter;
308 
309  for(iter = m_vecSpecServos.begin(); iter != m_vecSpecServos.end(); ++iter)
310  {
311  if( iter->m_nServoId == nServoId )
312  {
313  return true;
314  }
315  }
316  return false;
317 }
std::vector< HekSpecServo_T > m_vecSpecServos
vector of servo specs
Definition: hekSpec.h:408
int HekSpec::set ( int  eProdId,
uint_t  uHwVer 
)

Set product fixed specification.

Parameters
eProdId

Definition at line 81 of file hekSpec.cxx.

References HEK_ARM_FAMILY, HEK_VER_MAJOR, HEK_VER_MINOR, HEK_VER_REV, and HEK_VERSION.

82 {
83  const HekSpecLink_T *pSpecLinks;
84  const HekSpecJoint_T *pSpecJoints;
85  const HekSpecServo_T *pSpecServos;
86  int i;
87 
88  clear();
89 
90  switch( eProdId )
91  {
92  //
93  // Arms
94  //
95  case HekProdArm5LBetaId: // defunct
96  break;
97  case HekProdArm4SId:
98  break;
99  case HekProdArm4LId:
105  if( uHwVer < HEK_VERSION(1, 2, 0) )
106  {
107  pSpecLinks = HekProdArm4LSpecLinks;
108  pSpecJoints = HekProdArm4LSpecJoints_1_1;
109  pSpecServos = HekProdArm4LSpecServos_1_1;
110  }
111  else
112  {
113  LOGWARN("Unsupported 4L v%u.%u.%u, defaulting to v1.1 specs.",
114  HEK_VER_MAJOR(uHwVer), HEK_VER_MINOR(uHwVer), HEK_VER_REV(uHwVer));
115  pSpecLinks = HekProdArm4LSpecLinks;
116  pSpecJoints = HekProdArm4LSpecJoints_1_1;
117  pSpecServos = HekProdArm4LSpecServos_1_1;
118  }
119  LOGDIAG3("Hekateros 4L v%u.%u.%u specification loaded.",
120  HEK_VER_MAJOR(uHwVer), HEK_VER_MINOR(uHwVer), HEK_VER_REV(uHwVer));
121  break;
122  case HekProdArm5SId:
123  break;
124  case HekProdArm5LId:
130  if( uHwVer < HEK_VERSION(1, 2, 0) )
131  {
132  pSpecLinks = HekProdArm5LSpecLinks;
133  pSpecJoints = HekProdArm5LSpecJoints_1_1;
134  pSpecServos = HekProdArm5LSpecServos_1_1;
135  }
136  else if( uHwVer < HEK_VERSION(1, 3, 0) )
137  {
138  pSpecLinks = HekProdArm5LSpecLinks;
139  pSpecJoints = HekProdArm5LSpecJoints_1_2;
140  pSpecServos = HekProdArm5LSpecServos_1_2;
141  }
142  else if( uHwVer < HEK_VERSION(1, 4, 0) )
143  {
144  if( uHwVer == HEK_VERSION(1, 3, 5) ) // special SIUE arm hybrid
145  {
146  pSpecLinks = HekProdArm5LSpecLinks;
147  pSpecJoints = HekProdArm5LSpecJoints_1_3_5;
148  pSpecServos = HekProdArm5LSpecServos_1_3_5;
149  }
150  else
151  {
152  pSpecLinks = HekProdArm5LSpecLinks;
153  pSpecJoints = HekProdArm5LSpecJoints_1_3;
154  pSpecServos = HekProdArm5LSpecServos_1_3;
155  }
156  }
157  else if( uHwVer < HEK_VERSION(1, 5, 0) )
158  {
159  pSpecLinks = HekProdArm5LSpecLinks;
160  pSpecJoints = HekProdArm5LSpecJoints_1_4;
161  pSpecServos = HekProdArm5LSpecServos_1_4;
162  }
163  else if( uHwVer < HEK_VERSION(2, 2, 0) )
164  {
165  pSpecLinks = HekProdArm5LSpecLinks;
166  pSpecJoints = HekProdArm5LSpecJoints_2_0;
167  pSpecServos = HekProdArm5LSpecServos_2_0;
168  }
169  else
170  {
171  LOGWARN("Unsupported 5L v%u.%u.%u, defaulting to v1.3 specs.",
172  HEK_VER_MAJOR(uHwVer), HEK_VER_MINOR(uHwVer), HEK_VER_REV(uHwVer));
173  pSpecLinks = HekProdArm5LSpecLinks;
174  pSpecJoints = HekProdArm5LSpecJoints_1_3;
175  pSpecServos = HekProdArm5LSpecServos_1_3;
176  }
177  LOGDIAG3("Hekateros 5L v%u.%u.%u specification loaded.",
178  HEK_VER_MAJOR(uHwVer), HEK_VER_MINOR(uHwVer), HEK_VER_REV(uHwVer));
179  break;
180 
181  //
182  // End Effectors
183  //
184  case HekProdEEGraboidId:
190  if( uHwVer < HEK_VERSION(1, 1, 0) )
191  {
192  pSpecLinks = HekProdEEGraboidSpecLinks;
193  pSpecJoints = HekProdEEGraboidSpecJoints_1_0;
194  pSpecServos = HekProdEEGraboidSpecServos_1_0;
195  }
196  else if( uHwVer < HEK_VERSION(1, 2, 0) )
197  {
198  pSpecLinks = HekProdEEGraboidSpecLinks;
199  pSpecJoints = HekProdEEGraboidSpecJoints_1_1;
200  pSpecServos = HekProdEEGraboidSpecServos_1_1;
201  }
202  else
203  {
204  LOGWARN("Unsupported Graboid EE v%u.%u.%u, "
205  "defaulting to v1.1 specs.",
206  HEK_VER_MAJOR(uHwVer), HEK_VER_MINOR(uHwVer), HEK_VER_REV(uHwVer));
207  pSpecLinks = HekProdEEGraboidSpecLinks;
208  pSpecJoints = HekProdEEGraboidSpecJoints_1_1;
209  pSpecServos = HekProdEEGraboidSpecServos_1_1;
210  }
211  LOGDIAG3("Graboid EE v%u.%u.%u specification loaded.",
212  HEK_VER_MAJOR(uHwVer), HEK_VER_MINOR(uHwVer), HEK_VER_REV(uHwVer));
213  break;
214 
215  // error
216  default:
217  LOGERROR("0x%08x: Unknown or unsupported product id.", eProdId);
218  return -HEK_ECODE_BAD_VAL;
219  }
220 
221  if( pSpecLinks != NULL )
222  {
223  for(i=0; i<m_nNumLinks; ++i)
224  {
225  m_vecSpecLinks.push_back(pSpecLinks[i]);
226  }
227  }
228 
229  if( pSpecJoints != NULL )
230  {
231  for(i=0; i<m_nDoF; ++i)
232  {
233  m_vecSpecJoints.push_back(pSpecJoints[i]);
234  }
235  }
236 
237  if( pSpecServos != NULL )
238  {
239  for(i=0; i<m_nNumServos; ++i)
240  {
241  m_vecSpecServos.push_back(pSpecServos[i]);
242  }
243  }
244 
245  m_eProdId = eProdId;
246  m_uHwVer = uHwVer;
247 
248  return HEK_OK;
249 }
const int HekProdArm5LBetaId
product id
#define HEK_VER_REV(ver)
Get revision number from version.
Definition: hekateros.h:213
const HekSpecLink_T HekProdArm4LSpecLinks[]
Specification of links.
Definition: hekProdArm4L.h:82
const HekSpecServo_T HekProdArm5LSpecServos_1_3[]
Specification of servos, v1.3.
Definition: hekProdArm5L.h:99
const int HekProdArm5LNumOptLimits
number of optical limits
Definition: hekProdArm5L.h:75
const HekSpecServo_T HekProdArm4LSpecServos_1_1[]
Specification of servos, v1.1.
Definition: hekProdArm4L.h:92
static const int HEK_OK
not an error, success
Definition: hekateros.h:70
int m_nNumLinks
number of links
Definition: hekSpec.h:402
const HekSpecJoint_T HekProdArm5LSpecJoints_1_1[]
Specification of joints, v1.1.
Definition: hekProdArm5L.h:84
const int HekProdEEGraboidId
prod id
const HekSpecLink_T HekProdEEGraboidSpecLinks[]
Specification of links.
std::vector< HekSpecJoint_T > m_vecSpecJoints
vector of joint specs
Definition: hekSpec.h:407
std::vector< HekSpecLink_T > m_vecSpecLinks
vector of link specs
Definition: hekSpec.h:406
const HekSpecServo_T HekProdEEGraboidSpecServos_1_1[]
Specification of servos, v1.1.
const int HekProdEEGraboidNumServos
number of servos
const int HekProdArm4LNumLinks
number of fixed links
Definition: hekProdArm4L.h:74
const int HekProdArm5LNumServos
number of servos
Definition: hekProdArm5L.h:76
#define HEK_VER_MAJOR(ver)
Get version major number from version.
Definition: hekateros.h:195
const int HekProdArm4LId
product id
Definition: hekProdArm4L.h:72
const int HekProdEEGraboidDoF
degrees of freedom
const HekSpecServo_T HekProdArm5LSpecServos_1_3_5[]
Specification of servos, v1.4.
Definition: hekProdArm5L.h:105
const HekSpecJoint_T HekProdArm5LSpecJoints_2_0[]
Specification of joints, v2.0.
Definition: hekProdArm5L.h:114
const int HekProdArm5LNumLinks
number of fixed links
Definition: hekProdArm5L.h:73
void clear()
Clear product fixed specification.
Definition: hekSpec.cxx:251
const HekSpecJoint_T HekProdArm5LSpecJoints_1_3[]
Specification of joints, v1.3.
Definition: hekProdArm5L.h:96
#define HEK_ARM_FAMILY
only 1 family of arm products so define here
Definition: hekProdArm.h:56
int m_eProdId
product id
Definition: hekSpec.h:400
const int HekProdArm4LDoF
degrees of freedom
Definition: hekProdArm4L.h:75
int m_eProdFamily
product family
Definition: hekSpec.h:399
const HekSpecLink_T HekProdArm5LSpecLinks[]
Specification of links.
Definition: hekProdArm5L.h:81
const HekSpecServo_T HekProdArm5LSpecServos_1_1[]
Specification of servos, v1.1.
Definition: hekProdArm5L.h:87
const int HekProdArm4LNumServos
number of servos
Definition: hekProdArm4L.h:77
const HekSpecJoint_T HekProdEEGraboidSpecJoints_1_0[]
Specification of joints, v1.0.
uint_t m_uHwVer
hardware version
Definition: hekSpec.h:401
const int HekProdEEGraboidNumLinks
number of fixed links
int m_nNumOptLimits
number of optical limits
Definition: hekSpec.h:404
const HekSpecJoint_T HekProdArm5LSpecJoints_1_3_5[]
Specification of joints, v1.3.5.
Definition: hekProdArm5L.h:102
const int HekProdEEGraboidNumOptLimits
number of optical limits
int m_nDoF
degrees of freedom
Definition: hekSpec.h:403
const int HekProdArm4LNumOptLimits
number of optical limits
Definition: hekProdArm4L.h:76
#define HEK_VER_MINOR(ver)
Get version minor number from version.
Definition: hekateros.h:204
const int HekProdEEGraboidFamily
family
const HekSpecJoint_T HekProdArm5LSpecJoints_1_4[]
Specification of joints, v1.4.
Definition: hekProdArm5L.h:108
const HekSpecJoint_T HekProdArm4LSpecJoints_1_1[]
Specification of joints, v1.1.
Definition: hekProdArm4L.h:87
const HekSpecServo_T HekProdEEGraboidSpecServos_1_0[]
Specification of servos, v1.0.
const HekSpecServo_T HekProdArm5LSpecServos_2_0[]
Specification of servos, v2.0.
Definition: hekProdArm5L.h:117
int m_nNumServos
number of servos
Definition: hekSpec.h:405
const HekSpecJoint_T HekProdEEGraboidSpecJoints_1_1[]
Specification of joints, v1.1.
#define HEK_VERSION(major, minor, revision)
Convert version triplet to integer equivalent.
Definition: hekateros.h:185
const int HekProdArm5LId
product id
Definition: hekProdArm5L.h:71
const int HekProdArm5LDoF
degrees of freedom
Definition: hekProdArm5L.h:74
static const int HEK_ECODE_BAD_VAL
bad value general error
Definition: hekateros.h:75
Robotic joint specification.
Definition: hekSpec.h:139
const HekSpecServo_T HekProdArm5LSpecServos_1_4[]
Specification of servos, v1.4.
Definition: hekProdArm5L.h:111
const int HekProdArm5SId
product id
Definition: hekProdArm5S.h:73
Robotic servo specification.
Definition: hekSpec.h:199
const HekSpecServo_T HekProdArm5LSpecServos_1_2[]
Specification of servos, v1.2.
Definition: hekProdArm5L.h:93
std::vector< HekSpecServo_T > m_vecSpecServos
vector of servo specs
Definition: hekSpec.h:408
const HekSpecJoint_T HekProdArm5LSpecJoints_1_2[]
Specification of joints, v1.2.
Definition: hekProdArm5L.h:90
const int HekProdArm4SId
product id
Definition: hekProdArm4S.h:73

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