frame.cpp
Go to the documentation of this file.
1 
19 // TODO: split into several files
20 
21 #include <math.h>
22 #include <iostream>
23 #include <cstdlib>
24 #include <cstring>
25 
26 #include "frame.h"
27 #include "log.h"
28 
29 using namespace std;
30 
31 #undef DEBUG_MESSAGES_FRAME_CPP
32 
33 namespace robotLibPbD {
34 
35 bool CFrameContainer::xmlToFrame(CFrame *frame, TiXmlElement* frameNode, bool create)
36 {
37  DataPairs dataPairs;
38  return xmlToFrame(frame, frameNode, dataPairs, create);
39 }
40 
41 
42 int CFrameContainer::compareBase(CFrame* first, CFrame* second)
43 {
44  std::vector<CFrame*> firstFrames, secondFrames;
45 
46  while (first != NULL)
47  {
48  firstFrames.push_back(first);
49  first = first->getBase();
50  }
51 
52  while (second != NULL)
53  {
54  secondFrames.push_back(second);
55  second = second->getBase();
56  }
57 
58  for (unsigned int i=0; i<firstFrames.size(); i++)
59  for (unsigned int j=0; j<secondFrames.size(); j++)
60  {
61  if (firstFrames[i] == secondFrames[j])
62  {
63 
64  return firstFrames.size()-1 - i;
65  }
66  }
67 
68  return -1;
69 }
70 
71 
72 void CFrameContainer::resolve(std::vector<std::string> &in, std::vector<CFrame*> &out)
73 {
74  out.clear();
75  for (unsigned int i=0; i<in.size(); i++)
76  {
77  int id = getFrameByName(in[i].c_str(), false);
78  if (id >= 0)
79  out.push_back(getFrame(id));
80  }
81 }
82 
83 
84  void CFrame::setDofs(const std::vector<double> &dofs_min, const std::vector<double> &dofs_max)
85  {
86  this->dofs_min.clear();
87  this->dofs_min = dofs_min;
88  this->dofs_max.clear();
89  this->dofs_max = dofs_max;
90  }
91 
92 bool CFrameContainer::xmlToFrame(CFrame *frame, TiXmlElement* frameNode, DataPairs &additionalData, bool create)
93 {
94  // get min max
95  std::vector<double> dofs_min(6), dofs_max(6);
96  const char* dofs[6] = { "x", "y", "z", "rx", "ry", "rz" };
97  for (unsigned int i=0; i<6 && i<dofs_min.size() && i<dofs_max.size(); i++)
98  {
99  dofs_min[i] = CConfiguration::getAttributeDouble(frameNode, printToString("min_%s", dofs[i]).c_str(), 0.0);
100  dofs_max[i] = CConfiguration::getAttributeDouble(frameNode, printToString("max_%s", dofs[i]).c_str(), 0.0);
101  //LOG_VERBOSE("min: %g max: %g\n", dofs_min[i], dofs_max[i]);
102  }
103  frame->setDofs(dofs_min, dofs_max);
104 
105 
106  frame->setData(CConfiguration::getAttributeBoolean(frameNode, "data", false));
107 
108  double a,b,g,x,y,z, qx,qy,qz,qw;
109  a = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "a", "0.0")).c_str());
110  b = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "b", "0.0")).c_str());
111  g = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "g", "0.0")).c_str());
112  x = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "x", "0.0")).c_str());
113  y = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "y", "0.0")).c_str());
114  z = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "z", "0.0")).c_str());
115 
116 
117  qx = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "qx", "0.0")).c_str());
118  qy = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "qy", "0.0")).c_str());
119  qz = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "qz", "0.0")).c_str());
120  qw = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "qw", "0.0")).c_str());
121 
122  if (qx != 0.0 || qw != 0.0 || qw != 0.0 || qw != 0.0)
123  {
124  CVec quater;
125  CMatrix pose;
126 
127  quater.x = qx;
128  quater.y = qy;
129  quater.z = qz;
130  quater.w = qw;
131  CMathLib::matrixFromQuaternion(quater, pose);
132 
133  CVec tmp;
134  CMathLib::getOrientation(pose, tmp, tmp);
135  a = tmp.x;
136  b = tmp.y;
137  g = tmp.z;
138 
139  a *= 180.0/M_PI;
140  b *= 180.0/M_PI;
141  g *= 180.0/M_PI;
142  }
143  else if (a == 0 && b == 0 && g == 0)
144  {
145  CMatrix mat, test;
146  CVec tmp;
147  double angle;
148  tmp.x = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "rx", "0.0")).c_str());
149  tmp.y = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "ry", "0.0")).c_str());
150  tmp.z = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "rz", "0.0")).c_str());
151  angle = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "ra", "0.0")).c_str());
152 
153  CMathLib::getMatrixFromRotation(mat, tmp, angle);
154  CMathLib::getOrientation(mat, tmp, tmp);
155  a = tmp.x;
156  b = tmp.y;
157  g = tmp.z;
158 
159  CMathLib::getRotation(test, tmp);
160  test.invert();
161  test.mul(test, mat);
162 
163  double dist = test.length();
164  if (dist > 0.01)
165  {
166  LOG_VERBOSE("Error: xmlToFrame, matrix conversion failed, distance is %g\n", dist);
167  a = 0.0;
168  b = 0.0;
169  g = 0.0;
170  }
171 
172  a *= 180.0/M_PI;
173  b *= 180.0/M_PI;
174  g *= 180.0/M_PI;
175  }
176 
177  CMatrix pose;
178  pose.set(1.0, 0.0, 0.0, 0.0,
179  0.0, 1.0, 0.0, 0.0,
180  0.0, 0.0, 1.0, 0.0,
181  0.0, 0.0, 0.0, 1.0);
182  CMathLib::getRotation(pose, a*M_PI/180.0, b*M_PI/180.0, g*M_PI/180.0);
183 
184  if (a == 0 && b == 0 && g == 0)
185  {
186  pose.a[0] = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "a0", "1.0")).c_str());
187  pose.a[1] = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "a1", "0.0")).c_str());
188  pose.a[2] = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "a2", "0.0")).c_str());
189 
190  pose.a[4] = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "a4", "0.0")).c_str());
191  pose.a[5] = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "a5", "1.0")).c_str());
192  pose.a[6] = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "a6", "0.0")).c_str());
193 
194  pose.a[8] = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "a8", "0.0")).c_str());
195  pose.a[9] = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "a9", "0.0")).c_str());
196  pose.a[10] = atof(additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "a10", "1.0")).c_str());
197  }
198 
199  pose.a[12] = x;
200  pose.a[13] = y;
201  pose.a[14] = z;
202  frame->setPose(pose);
203 
204  char buffer[255];
205  sprintf(buffer, "%s", additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "name", "")).c_str());
206  frame->setName(buffer);
207 
208  // frame type
209  frame->setFrameType(CFrame::FRAME_POSITION);
210  sprintf(buffer, "%s", CConfiguration::getAttributeString(frameNode, "type", ""));
211  if (strcasecmp(buffer, "velocity") == 0)
212  {
213  //LOG_VERBOSE("Frame: Type = VELOCITY\n");
214  frame->setFrameType(CFrame::FRAME_VELOCITY);
215  }
216  sprintf(buffer, "%s", additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "base", "")).c_str());
217 
218  std::string tmp = buffer;
219  std::vector<std::string> tokens;
220  tokenize(tmp, tokens, " ");
221  if (tokens.size() > 0)
222  tmp = tokens.back();
223  tokens.clear();
224 
225  sprintf(buffer, "%s", tmp.c_str());
226 
227  tokenize(tmp, tokens, ":");
228  if (tokens.size() > 1)
229  {
230  if (strcasecmp(tokens[0].c_str(), "geometry") == 0)
231  {
232  frame->setBaseType(CFrame::BASE_GEOMETRY);
233  frame->setBaseName(tokens[1].c_str());
234  } else frame->setBaseName(buffer);
235  } else frame->setBaseName(buffer);
236 
237 
238  frame->setBase(NULL);
239 
240  switch (frame->getBaseType())
241  {
242  case CFrame::BASE_NORMAL:
243  default:
244  {
245  if (strcasecmp(buffer, "") == 0)
246  create = false;
247 
248  // create referenced base frame if it doesnt exist yet
249  int i = getFrameByName(buffer, create);
250  if (i >= 0)
251  frame->setBase(frames[i]);
252  }
253  }
254  return true;
255 }
256 
257 
258 void CFrameContainer::clear()
259 {
260  for (unsigned int i=0; i<frames.size(); i++)
261  {
262  frames[i]->setBase(NULL);
263  }
264 
265  for (unsigned int i=0; i<frames.size(); i++)
266  {
267  delete frames[i];
268  }
269 
270  frames.clear();
271 }
272 
273 bool CFrameContainer::xmlToFrameCombination(CFrameCombination *frame, TiXmlElement* frameNode, DataPairs &additionalData, bool create)
274 {
275  double a,b,g,x,y,z;
276  a = CConfiguration::getAttributeDouble(frameNode, "a", 0.0);
277  b = CConfiguration::getAttributeDouble(frameNode, "b", 0.0);
278  g = CConfiguration::getAttributeDouble(frameNode, "g", 0.0);
279  x = CConfiguration::getAttributeDouble(frameNode, "x", 0.0);
280  y = CConfiguration::getAttributeDouble(frameNode, "y", 0.0);
281  z = CConfiguration::getAttributeDouble(frameNode, "z", 0.0);
282 
283  if (a == 0 && b == 0 && g == 0)
284  {
285  CMatrix mat, test;
286  CVec tmp;
287  double angle;
288  tmp.x = CConfiguration::getAttributeDouble(frameNode, "rx", 0.0);
289  tmp.y = CConfiguration::getAttributeDouble(frameNode, "ry", 0.0);
290  tmp.z = CConfiguration::getAttributeDouble(frameNode, "rz", 0.0);
291  angle = CConfiguration::getAttributeDouble(frameNode, "ra", 0.0);
292  CMathLib::getMatrixFromRotation(mat, tmp, angle);
293  CMathLib::getOrientation(mat, tmp, tmp);
294  a = tmp.x;
295  b = tmp.y;
296  g = tmp.z;
297 
298  CMathLib::getRotation(test, tmp);
299  test.invert();
300  test.mul(test, mat);
301 
302  double dist = test.length();
303  if (dist > 0.01)
304  {
305  LOG_VERBOSE("Error: xmlToFrame, matrix conversion failed, distance is %g\n", dist);
306  a = 0.0;
307  b = 0.0;
308  g = 0.0;
309  }
310  }
311 
312 
313  CMatrix pose;
314  pose.set(1.0, 0.0, 0.0, 0.0,
315  0.0, 1.0, 0.0, 0.0,
316  0.0, 0.0, 1.0, 0.0,
317  0.0, 0.0, 0.0, 1.0);
318  CMathLib::getRotation(pose, a*M_PI/180.0, b*M_PI/180.0, g*M_PI/180.0);
319 
320  pose.a[12] = x;
321  pose.a[13] = y;
322  pose.a[14] = z;
323  frame->setPose(pose);
324 
325  char buffer[255];
326  sprintf(buffer, "%s", additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "name", "")).c_str());
327  frame->setName(buffer);
328 
329  // frame type
330  frame->setFrameType(CFrame::FRAME_POSITION);
331  sprintf(buffer, "%s", CConfiguration::getAttributeString(frameNode, "type", ""));
332  if (strcasecmp(buffer, "velocity") == 0)
333  {
334  //printf("Frame: Type = VELOCITY\n");
335  frame->setFrameType(CFrame::FRAME_VELOCITY);
336  }
337  sprintf(buffer, "%s", additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "base", "")).c_str());
338 
339  std::string tmp = buffer;
340  std::vector<std::string> tokens;
341  tokenize(tmp, tokens, " ");
342  if (tokens.size() > 0)
343  tmp = tokens.back();
344  tokens.clear();
345 
346  sprintf(buffer, "%s", tmp.c_str());
347 
348  tokenize(tmp, tokens, ":");
349  if (tokens.size() > 1)
350  {
351  if (strcasecmp(tokens[0].c_str(), "geometry") == 0)
352  {
353  frame->setBaseType(CFrame::BASE_GEOMETRY);
354  frame->setBaseName(tokens[1].c_str());
355  } else frame->setBaseName(buffer);
356  } else frame->setBaseName(buffer);
357 
358 
359  frame->setBase(NULL);
360 
361  switch (frame->getBaseType())
362  {
363  case CFrame::BASE_NORMAL:
364  default:
365  {
366  if (strcasecmp(buffer, "") == 0)
367  create = false;
368 
369  // create referenced base frame if it doesnt exist yet
370  int i = getFrameByName(buffer, create);
371  if (i >= 0)
372  frame->setBase(frames[i]);
373  }
374  }
375 
376  sprintf(buffer, "%s", additionalData.resolveString(CConfiguration::getAttributeString(frameNode, "baseOrientation", "")).c_str());
377  frame->setBaseOrientation(NULL);
378 
379  if (strcasecmp(buffer, "") == 0)
380  create = false;
381 
382  // create referenced base frame if it doesnt exist yet
383  int i = getFrameByName(buffer, create);
384  if (i >= 0)
385  {
386  frame->setBaseOrientationName(buffer);
387  frame->setBaseOrientation(frames[i]);
388  }
389  return true;
390 }
391 
392 
393 CFrame* CFrame::getByName(char* str)
394 {
395  if (hasName(str))
396  return this;
397  else
398  return NULL;
399 }
400 
401 
402 void CFrame::removeParent(CFrame *parent)
403 {
404 #ifdef DEBUG_MESSAGES_FRAME_CPP
405  LOG_VERBOSE("Frame: removing frame %s of %s: ", parent->getName(), getName());
406 #endif
407 
408  std::vector<CFrame*> tmp = parents;
409  parents.clear();
410  for (unsigned int i=0; i<tmp.size(); i++)
411  if (tmp[i] != parent)
412  parents.push_back(tmp[i]);
413 #ifdef DEBUG_MESSAGES_FRAME_CPP
414  else
415  {
416  LOG_VERBOSE("found frame to remove: ");
417  }
418 
419  LOG_VERBOSE("(");
420  for (unsigned int i=0; i<parents.size(); i++)
421  LOG_VERBOSE("%s ", parents[i]->getName());
422  LOG_VERBOSE(")\n");
423 #endif
424 }
425 
426 void CFrame::addParent(CFrame *parent)
427 {
428 #ifdef DEBUG_MESSAGES_FRAME_CPP
429  LOG_VERBOSE("Frame: adding parent %s of %s ", parent->getName(), getName());
430 #endif
431 
432  if (parent != NULL && getParentId(parent) < 0)
433  {
434 #ifdef DEBUG_MESSAGES_FRAME_CPP
435  LOG_VERBOSE("added %s: ", parent->getName());
436 #endif
437  parents.push_back(parent);
438  }
439 #ifdef DEBUG_MESSAGES_FRAME_CPP
440  else
441  {
442  LOG_VERBOSE("%s already included: ", parent->getName());
443  }
444  LOG_VERBOSE("(");
445  for (unsigned int i=0; i<parents.size(); i++)
446  LOG_VERBOSE("%s ", parents[i]->getName());
447  LOG_VERBOSE(")\n");
448 #endif
449 }
450 
451 void* CFrame::getCopy()
452 {
453  CFrame* ptr = new CFrame();
454  ptr->setName(getName());
455  ptr->setBase(getBase());
456  ptr->setBaseName(getBaseName());
457  ptr->setBaseType(getBaseType());
458  ptr->setPose(getPose());
459  ptr->setFrameType(getFrameType());
460  ptr->setTime(getTime());
461  if (_isLocked)
462  ptr->lock();
463  else
464  ptr->unlock();
465 
466  return (void*) ptr;
467 }
468 
469 void* CFrameCombination::getCopy()
470 {
472  ptr->setName(getName());
473  ptr->setBase(getBase());
474  ptr->setBaseName(getBaseName());
475  ptr->setBaseType(getBaseType());
476 
477  ptr->setBaseOrientationName(getBaseOrientationName());
478  ptr->setBaseOrientation(getBaseOrientation());
479 
480 
481  ptr->setPose(getPose());
482  ptr->setFrameType(getFrameType());
483  ptr->setTime(getTime());
484  if (_isLocked)
485  ptr->lock();
486  else
487  ptr->unlock();
488 
489  return (void*) ptr;
490 }
491 
492 
493  void CFrame::getDofs(std::vector<double> &dofs_min, std::vector<double> &dofs_max)
494  {
495  dofs_max.clear();
496  dofs_max = this->dofs_max;
497  dofs_min.clear();
498  dofs_min = this->dofs_min;
499  }
500 
501  void CFrame::getDofs(std::vector<unsigned int> &dofs)
502  {
503  dofs.clear();
504  for (unsigned int i=0; i<dofs_min.size() && i<dofs_max.size(); i++)
505  if (fabsf(dofs_max[i] - dofs_min[i]) > 1.0e-8)
506  dofs.push_back(i);
507  }
508 
509 CFrame::CFrame()
510 {
511  childs.reserve(20);
512  frameType = FRAME_POSITION;
513  base = NULL;
514  name = "";
515  _isValid = false;
516  baseName = "";
517  time = -1;
518  baseType = BASE_NORMAL;
519  _isData = false;
520  _isLocked = false;
521  counter = baseCounter = 0;
522 
523  dofs_min.resize(6, 0.0);
524  dofs_max.resize(6, 0.0);
525 }
526 
527 
528 void CFrame::invalidateAll()
529 {
530  invalidate();
531 
532  if (base != NULL)
533  base->invalidateAll();
534 }
535 
536 CFrame::CFrame(char* str)
537 {
538  _isData = false;
539  childs.reserve(20);
540  frameType = FRAME_POSITION;
541  base = NULL;
542  name = str;
543  _isValid = false;
544  baseName = "";
545  time = -1;
546  baseType = BASE_NORMAL;
547  _isLocked = false;
548  counter = baseCounter = 0;
549 }
550 
551 CFrame::~CFrame()
552 {
553 #ifdef DEBUG_MESSAGES_FRAME_CPP
554  LOG_VERBOSE("Frame: freeing %s\n", getName());
555 #endif
556  setBase(NULL);
557 }
558 
559 /*
560 CMatrix CFrame::getRelativeToBase()
561 {
562  CFrame *frame = this;
563  relativePose = pose;
564  while (frame->base != NULL)
565  {
566  frame = frame->base;
567  relativePose.mul( frame->pose, relativePose);
568  }
569 
570  isValid = true;
571 
572  return relativePose;
573 }*/
574 
575 
576 void CFrame::setRelativePose(const CMatrix &value)
577 {
578  if (_isLocked)
579  return;
580 
581  relativePose = value;
582  _isValid = true;
583  _isUpdated = true;
584 }
585 
586 
587 void CFrame::setBase(CFrame* base)
588 {
589  if (this->base != base)
590  {
591  if (this->base != NULL)
592  this->base->removeParent(this);
593 
594  this->base = base;
595 
596  if (this->base != NULL)
597  this->base->addParent(this);
598 
599  if (_isValid)
600  invalidate();
601  }
602 }
603 
604 
605 bool CFrame::hasName(char* str)
606 {
607  return (strcasecmp(str, name.c_str()) == 0);
608 }
609 
610 void CFrame::setName(const char* str)
611 {
612  name = str;
613 }
614 
615 void CFrame::update()
616 {
617 
618 }
619 
620 
621 CFrame* CKinematicChain::getLastFrame()
622 {
623  int id = getLength();
624  if (id > 0)
625  return frames[id-1];
626  return NULL;
627 }
628 
629 CFrame* CKinematicChain::getFrame(unsigned int id)
630 {
631  if (id < getLength())
632  return frames[id];
633 
634  return NULL;
635 }
636 
637 CDh& CKinematicChain::getDhParameters(unsigned int id)
638 {
639  if (id >= getLength())
640  LOG_VERBOSE("Error: this needs fixing (CKinematicChain::getDhParameters)\n");
641 
642  return dhParameters[id];
643 }
644 
645 CFrame* CKinematicChain::getByName(char* str)
646 {
647  char buffer[255];
648  strcpy(buffer, str);
649  char* delimiter = strchr(buffer, '_');
650 
651  if (delimiter == NULL)
652  {
653  return NULL;
654  } else
655  {
656  *delimiter = 0;
657  delimiter++;
658 
659  int number = atoi(delimiter);
660  std::cout << "chain: " << str << " number: " << number << "\n";
661 
662  //return this;
663  if ((number >= 0) && (number < length))
664  {
665  return frames[number];
666  }
667  }
668 
669  return NULL;
670 }
671 
672 
673 void CKinematicChain::loadFromXml(CConfiguration &config, TiXmlElement* kinChainsNode, CFrameContainer &container)
674 {
675  if (kinChainsNode == NULL)
676  return;
677 
678  char text[1024];
679  int len = CConfiguration::getAttributeInteger(kinChainsNode, "len", 0);
680 
681  std::vector<TiXmlElement*> result;
682  result.clear();
683  config.findNodes("dh", result, kinChainsNode);
684 
685  if ((int)result.size() != len)
686  {
687  len = result.size();
688  LOG_VERBOSE("Error: different size of dh entries, using %d\n", len);
689  }
690 
691  if (len <= 0)
692  {
693  LOG_ERROR("Error: kinematic chain has length 0\n");
694  exit(0);
695  }
696 
697  sprintf(text, "%s", CConfiguration::getAttributeString(kinChainsNode, "name", ""));
698  name = text;
699 
700 
701  char buffer[1024], baseName[1024];
702  sprintf(buffer, "%s", CConfiguration::getAttributeString(kinChainsNode, "base", ""));
703  sprintf(baseName, "%s", buffer);
704  CFrame* base = NULL;
705  // create referenced base frame if it doesnt exist yet
706  int id = container.getFrameByName(buffer);
707 
708  if (id >= 0)
709  base = container.frames[id];
710 
711  setLength(len);
712 
713  totalArmLength = 0.0;
714 
715  for (unsigned int i=0; i<result.size(); i++)
716  {
717  sprintf(text, "%s_%d", name.c_str(), i);
718  id = container.getFrameByName(text, true);
719  if (id >= 0)
720  frames[i] = container.frames[id];
721  else
722  {
723  LOG_VERBOSE("CKinematicChain::loadFromXml() failed.\n");
724  return;
725  }
726 
727  dhParameters[i].speedFactor = CConfiguration::getAttributeDouble(result[i], "speed", 0.01);
728  dhParameters[i].ivModel = CConfiguration::getAttributeString(result[i], "ivmodel", "");
729  dhParameters[i].angle = 0.0;
730  bool trans = CConfiguration::getAttributeBoolean(result[i], "translational", false) || CConfiguration::getAttributeBoolean(result[i], "trans", false);
731  //printf("Frame: %s\n", trans ? "translation":"rotation");
732  dhParameters[i].rotationalDof = !trans;
733  dhParameters[i].rot_z = M_PI / 180.0 * CConfiguration::getAttributeDouble(result[i], "rotz", 0.0);
734  dhParameters[i].rot_x = M_PI / 180.0 * CConfiguration::getAttributeDouble(result[i], "rotx", 0.0);
735  dhParameters[i].trans_z = CConfiguration::getAttributeDouble(result[i], "transz", 0.0);
736  dhParameters[i].trans_x = CConfiguration::getAttributeDouble(result[i], "transx", 0.0);
737  dhParameters[i].id = CConfiguration::getAttributeInteger(result[i], "id", -1);
738  dhParameters[i].sgn = CConfiguration::getAttributeDouble(result[i], "sgn", 1.0);
739  dhParameters[i].min = M_PI / 180.0 * CConfiguration::getAttributeDouble(result[i], "min", -180.0);
740  dhParameters[i].max = M_PI / 180.0 * CConfiguration::getAttributeDouble(result[i], "max", 180.0);
741  dhParameters[i].axis.x = CConfiguration::getAttributeDouble(result[i], "x", 0.0);
742  dhParameters[i].axis.y = CConfiguration::getAttributeDouble(result[i], "y", 0.0);
743  dhParameters[i].axis.z = CConfiguration::getAttributeDouble(result[i], "z", 0.0);
744  dhParameters[i].useAxis = CConfiguration::getAttributeBoolean(result[i], "axis", false);
745  dhParameters[i].rot_z += CConfiguration::getAttributeDouble(result[i], "value", 0.0);
746 
747  if (dhParameters[i].useAxis && dhParameters[i].rotationalDof && dhParameters[i].axis.length() < 0.001)
748  {
749  CMatrix pose;
750  pose.a[0] = CConfiguration::getAttributeDouble(result[i], "a0", 1.0);
751  pose.a[1] = CConfiguration::getAttributeDouble(result[i], "a1", 0.0);
752  pose.a[2] = CConfiguration::getAttributeDouble(result[i], "a2", 0.0);
753 
754  pose.a[4] = CConfiguration::getAttributeDouble(result[i], "a4", 0.0);
755  pose.a[5] = CConfiguration::getAttributeDouble(result[i], "a5", 1.0);
756  pose.a[6] = CConfiguration::getAttributeDouble(result[i], "a6", 0.0);
757 
758  pose.a[8] = CConfiguration::getAttributeDouble(result[i], "a8", 0.0);
759  pose.a[9] = CConfiguration::getAttributeDouble(result[i], "a9", 0.0);
760  pose.a[10] = CConfiguration::getAttributeDouble(result[i], "a10", 1.0);
761 
762  double angle;
763  CMathLib::getRotationFromMatrix(pose, dhParameters[i].axis, angle);
764 
765  dhParameters[i].rot_z += angle;
766  }
767 
768  if (dhParameters[i].useAxis && dhParameters[i].rotationalDof)
769  dhParameters[i].axis.normalize();
770 
771 
772  totalArmLength += fabsf(dhParameters[i].trans_z);
773 
774  CMatrix pose;
775  pose.setDh(dhParameters[i]);
776  frames[i]->setPose(pose);
777  frames[i]->setName(text);
778 
779  if (i==0)
780  {
781  frames[i]->setBase(base);
782  frames[i]->setBaseName(baseName);
783  } else
784  {
785  frames[i]->setBase(frames[i-1]);
786  frames[i]->setBaseName(frames[i-1]->getName());
787  }
788  }
789 
790  // add tcp frame for kinematic chain
791  std::string tcpFrame = name + "_tcp";
792  int tcpFrameId = container.getFrameByName(tcpFrame.c_str(), true);
793  container.getFrame(tcpFrameId)->setBaseName(frames[getLength()-1]->getName());
794  container.getFrame(tcpFrameId)->setBase(frames[getLength()-1]);
795  LOG_VERBOSE("Frame: added frame %s for kinematic chain\n", tcpFrame.c_str());
796 
797 
798  std::string lastPoseBufferName = name + "_tcp_buffer";
799  /*
800  int lastPoseBufferId = container.getFrameByName(lastPoseBufferName.c_str(), false);
801  if (lastPoseBufferId >= 0)
802  {
803  printf("Error: buffer frame %s already exists. You have to remove it\n", lastPoseBufferName.c_str());
804  exit(0);
805  }
806  CFrameReference *newFrame = new CFrameReference(frames[getLength()-1]);
807  lastPoseBuffer = (CFrame*) newFrame;
808  container.add(lastPoseBuffer);
809  */
810  int lastPoseBufferId = container.getFrameByName(lastPoseBufferName.c_str(), true);
811  if (lastPoseBufferId < 0)
812  {
813  printf("Error: buffer frame %s couldnt be generated\n", lastPoseBufferName.c_str());
814  exit(0);
815  }
816  lastPoseBuffer = container.getFrame(lastPoseBufferId);
817 }
818 
819 
820 // Kinematic Chain Class
821 // - chain of homogenous transformation matrices based
822 CKinematicChain::CKinematicChain()
823 {
824  dhParameters = 0;
825  frames = 0;
826  length = 0;
827  totalArmLength = 0.0;
828  lastPoseBuffer = NULL;
829 }
830 
831 
832 
833 /*void CKinematicChain::getPose(CMatrix &result)
834 {
835  CMatrix b;
836 
837  if (base != NULL)
838  b = base->getRelativeToBase();
839 
840  result.mul(b, pose);
841  }*/
842 
843 CKinematicChain::~CKinematicChain()
844 {
845  setLength(0);
846 }
847 
848 
849 void CKinematicChain::setLength(int len)
850 {
851  if (length > 0)
852  {
853  if (dhParameters != NULL)
854  delete [] dhParameters;
855 
856  if (frames != NULL)
857  delete [] frames;
858 
859  frames = NULL;
860  dhParameters = NULL;
861  length = 0;
862  }
863 
864  if (len > 0)
865  {
866  dhParameters = new CDh[len];
867  if (dhParameters == NULL)
868  {
869  LOG_VERBOSE("setLength: malloc failed().\n");
870  return;
871  }
872 
873  frames = new CFrame*[len];
874  if (frames == NULL)
875  {
876  LOG_VERBOSE("setLength: malloc failed().\n");
877  return;
878  }
879 
880  length = len;
881  }
882 }
883 
884 
885 CKinematicChainContainer::CKinematicChainContainer()
886 {
887  chain = NULL;
888  length = 0;
889 }
890 
891 CKinematicChainContainer::~CKinematicChainContainer()
892 {
893  if (chain != NULL)
894  {
895  delete [] chain;
896  chain = NULL;
897  }
898  length = 0;
899 }
900 
901 
902 void CKinematicChainContainer::loadFromXml(CConfiguration &config, TiXmlElement* kinChainsNode, CFrameContainer &container)
903 {
904  //char text[255];
905  int len = CConfiguration::getAttributeInteger(kinChainsNode, "len", 0);
906  std::vector<TiXmlElement*> result;
907  result.clear();
908  config.findNodes("chain", result, kinChainsNode);
909 
910  if ((int)result.size() != len)
911  {
912  len = result.size();
913  LOG_VERBOSE("Error: different size of chain entries, using %d\n", len);
914  }
915  length = len;
916  if (chain != NULL)
917  {
918  delete [] chain;
919  chain = NULL;
920  }
921  chain = new CKinematicChain[len];
922 
923 
924  for (unsigned int i=0; i<result.size(); i++)
925  {
926  chain[i].loadFromXml(config, result[i], container);
927  }
928 }
929 
930 
931 
932 bool CFrameContainer::isRelativeTo(CFrame* first, CFrame* relative)
933 {
934  while (first != NULL)
935  {
936  if (first == relative)
937  return true;
938 
939  first = first->getBase();
940  }
941 
942  return false;
943 }
944 
945 bool CFrameContainer::getFrameByName(const char* name, CFrame* &frame)
946 {
947  char buffer[1024];
948  //int id;
949  std::string object;
950 
951 
952  object = name;
953 
954  std::vector<std::string> tokens;
955  tokenize(object, tokens, " ");
956 
957  if (tokens.size() == 0)
958  sprintf(buffer, " ");
959  else
960  sprintf(buffer, "%s", tokens.back().c_str());
961 
962  frame = NULL;
963  for (unsigned int i=0; i<frames.size(); i++)
964  if (strcasecmp(frames[i]->getName(), buffer) == 0)
965  {
966  frame = frames[i];
967  return true;
968  }
969 
970  return false;
971 }
972 
973 int CFrameContainer::getFrameByName(const char* name, bool create)
974 {
975  const char* empty ="";
976  if (strcasecmp(name, empty) == 0)
977  return -1;
978 
979  char buffer[1024];
980  std::string object = name;
981  std::vector<std::string> tokens;
982  tokenize(object, tokens, " ");
983 
984  if (tokens.size() == 0)
985  sprintf(buffer, "%s", "");
986  else
987  sprintf(buffer, "%s", tokens.back().c_str());
988 
989  for (unsigned int i=0; i<frames.size(); i++)
990  if (strcasecmp(frames[i]->getName(), buffer) == 0)
991  {
992  return (int)i;
993  }
994 
995  if (create && (strlen(buffer) > 0))
996  {
997  frames.push_back(new CFrame(buffer));
998 
999  return ((int)frames.size()) - 1;
1000  }
1001  return -1;
1002 }
1003 
1004 
1005 int CFrameContainer::add(CFrame* newFrame)
1006 {
1007  frames.push_back(newFrame);
1008  return frames.size()-1;
1009 }
1010 
1011 
1012 bool CFrameContainer::setBase(char* fr, char* b)
1013 {
1014  int frame = getFrameByName(fr, false);
1015  int base = getFrameByName(b, false);
1016 
1017  if (frame < 0)
1018  return false;
1019 
1020  if (base < 0)
1021  frames[frame]->setBase(NULL);
1022  else frames[frame]->setBase(frames[base]);
1023  return true;
1024 }
1025 
1026 
1027 void CFrameContainer::checkBaseFrames()
1028 {
1029  for (unsigned int i=0; i<frames.size(); i++)
1030  {
1031  if (frames[i]->getBase() != NULL)
1032  {
1033  int id = -1;
1034  for (unsigned int j=0; j<frames.size(); j++)
1035  {
1036  if (frames[j] == frames[i]->getBase())
1037  {
1038  id = j;
1039  break;
1040  }
1041  }
1042  if (id < 0)
1043  {
1044  LOG_VERBOSE("Removing base of frame %s\n", frames[i]->getName());
1045  frames[i]->setBase(NULL);
1046  frames[i]->setBaseName("");
1047  }
1048  }
1049  }
1050 }
1051 
1052 void CFrameContainer::updateBaseLinks()
1053 {
1054  updateBaseLinks(frames);
1055 }
1056 
1057 void CFrameContainer::updateBaseLinks(CFrame* frame)
1058 {
1059  if (frame == NULL)
1060  return;
1061 
1062  std::vector<CFrame*> frames;
1063  frames.push_back(frame);
1064  updateBaseLinks(frames);
1065 }
1066 
1067 void CFrameContainer::updateBaseLinks(std::vector<CFrame*> &frames)
1068 {
1069  for (unsigned int i=0; i<frames.size(); i++)
1070  {
1071  frames[i]->setBase(NULL);
1072  if (frames[i]->getBaseType() == CFrame::BASE_COMBINED)
1073  ((CFrameCombination*)frames[i])->setBaseOrientation(NULL);
1074 
1075  frames[i]->getParents().clear();
1076  }
1077 
1078  for (unsigned int i=0; i<frames.size(); i++)
1079  {
1080  //LOG_VERBOSE("Info: Frame is %s with base %s\n", frames[i]->getName(), frames[i]->getBaseName());
1081 
1082  if (strcasecmp(frames[i]->getBaseName(), "") != 0)
1083  {
1084  int id = getFrameByName(frames[i]->getBaseName(), false);
1085  if (id >= 0)
1086  {
1087  frames[i]->setBase(this->frames[id]);
1088  LOG_VERBOSE("Info: setting base of %s to %s\n", frames[i]->getName(), this->frames[id]->getName());
1089  }
1090  else
1091  {
1092  LOG_VERBOSE("Error: Couldnt find base named %s of frame %s\n", frames[i]->getBaseName(), frames[i]->getName());
1093  }
1094  }
1095 
1096 
1097  if (frames[i]->getBaseType() == CFrame::BASE_COMBINED)
1098  if (strcasecmp(((CFrameCombination*)frames[i])->getBaseOrientationName(), "") != 0)
1099  {
1100  int id = getFrameByName(((CFrameCombination*)frames[i])->getBaseOrientationName(), false);
1101  if (id >= 0)
1102  {
1103  ((CFrameCombination*)frames[i])->setBaseOrientation(this->frames[id]);
1104  LOG_VERBOSE("Info: setting base orientiation of %s to %s\n", frames[i]->getName(), this->frames[id]->getName());
1105  }
1106  else LOG_VERBOSE("Error: Couldnt find base named %s of frame %s\n", ((CFrameCombination*)frames[i])->getBaseOrientationName(), frames[i]->getName());
1107  }
1108  }
1109 }
1110 
1111 
1112 void CFrameContainer::loadFromFile(const char* filename)
1113 {
1114  CConfiguration config("Data");
1115  //bool okay = config.load(filename);
1116  config.load(filename);
1117 
1118  DataPairs additionalData;
1119  loadFromFile(filename, additionalData, config, true);
1120 }
1121 
1122 void CFrameContainer::loadFromFile(const char* filename, DataPairs &additionalData, CConfiguration &config, bool loadAll)
1123 {
1124  std::vector<TiXmlElement*> result;
1125  config.findNodes("Frames.Frame", result);
1126  for (unsigned int i=0; i<result.size(); i++)
1127  {
1128  if (!loadAll)
1129  if (!CConfiguration::getAttributeBoolean(result[i], "data", false))
1130  continue;
1131 
1132  int frame = getFrameByName(CConfiguration::getAttributeString(result[i], "name", ""), false);
1133 
1134  CFrame* tmp;
1135 
1136  if (frame < 0)
1137  {
1138  tmp = new CFrame();
1139  add(tmp);
1140  } else tmp = frames[frame];
1141 
1142  xmlToFrame(tmp, result[i], additionalData, false);
1143  }
1144 
1145  invalidate();
1146 }
1147 
1148 
1149 // Denavit Hartenberg Storage Class
1150 CDh::CDh()
1151 {
1152  speedFactor = 0.01;
1153  rotationalDof = true;
1154  rot_z = trans_z = rot_x = trans_x = angle = 0.0;
1155  sgn = 1.0;
1156  min = -180.0;
1157  max = 180.0;
1158  useAxis = false;
1159  axis.set(0.0, 0.0, 0.0);
1160  id = -1;
1161 }
1162 
1163 // get variable rotation angle (variable portion of theta)
1164 double CDh::getAngle()
1165 {
1166  return sgn * this->angle;
1167 }
1168 
1169 // set variable rotation angle (variable portion of theta)
1170 void CDh::setAngle(double angle)
1171 {
1172  this->angle = sgn * angle;
1173 }
1174 
1175 // set fixed dh parameters
1176 void CDh::set(double rot_z, double trans_z, double rot_x, double trans_x)
1177 {
1178  this->rot_z = rot_z;
1179  this->trans_z = trans_z;
1180  this->rot_x = rot_x;
1181  this->trans_x = trans_x;
1182 }
1183 
1184 
1185 
1186 std::string CFrameInterface::getFrameAsXml()
1187 {
1188  if (frame == NULL)
1189  return "";
1190 
1191  CVec t1, t2;
1192  CMatrix m;
1193  m = frame->getPose();
1194  CMathLib::getOrientation(m, t1, t2);
1195 
1196  char buffer[1024];
1197 
1198  if (frame->getBaseType() == CFrame::BASE_COMBINED)
1199  {
1200  sprintf(buffer, "<Frame name=\"%s\" base=\"%s\" baseOrientation=\"%s\" a=\"%g\" b=\"%g\" g=\"%g\" x=\"%g\" y=\"%g\" z=\"%g\" />\n",
1201  frame->getName(), frame->getBaseName(), ((CFrameCombination*)frame)->getBaseOrientationName(),
1202  180.0/M_PI * t1.x, 180.0/M_PI * t1.y, 180.0/M_PI * t1.z, m.a[12], m.a[13], m.a[14]);
1203  } else
1204  {
1205  sprintf(buffer, "<Frame name=\"%s\" base=\"%s\" a=\"%g\" b=\"%g\" g=\"%g\" x=\"%g\" y=\"%g\" z=\"%g\" />\n",
1206  frame->getName(), frame->getBaseName(),
1207  180.0/M_PI * t1.x, 180.0/M_PI * t1.y, 180.0/M_PI * t1.z, m.a[12], m.a[13], m.a[14]);
1208  }
1209  return buffer;
1210 };
1211 
1212 
1213 CFrameCombination::CFrameCombination()
1214 {
1215  frameType = FRAME_POSITION;
1216  base = NULL;
1217  baseOrientation = NULL;
1218  name = "";
1219  _isValid = false;
1220  baseName = "";
1221  baseOrientationName = "";
1222  time = -1;
1223  baseType = BASE_NORMAL;
1224  _isLocked = false;
1225  counter = baseCounter = 0;
1226 
1227  //LOG_VERBOSE("Created combined frame.\n");
1228 
1229  baseType = CFrame::BASE_COMBINED;
1230 }
1231 
1232 CFrameCombination::~CFrameCombination()
1233 {
1234 #ifdef DEBUG_MESSAGES_FRAME_CPP
1235  LOG_VERBOSE("FrameCombination: freeing %s\n", getName());
1236 #endif
1237  setBaseOrientation(NULL);
1238  setBase(NULL);
1239 }
1240 
1241 
1242 
1243 CFrame* CFrameCombination::getBaseOrientation()
1244 {
1245  return baseOrientation;
1246 }
1247 
1248 void CFrameCombination::setBaseOrientation(CFrame* baseOrientation)
1249 {
1250  if (this->baseOrientation != baseOrientation)
1251  {
1252  if (this->baseOrientation != NULL && this->baseOrientation != this->base)
1253  this->baseOrientation->removeParent(this);
1254 
1255  this->baseOrientation = baseOrientation;
1256 
1257  if (baseOrientation != NULL)
1258  baseOrientation->addParent(this);
1259 
1260  if (_isValid)
1261  invalidate();
1262  }
1263 }
1264 
1265 
1266 void CFrameCombination::invalidateAll()
1267 {
1268  invalidate();
1269 
1270  if (base != NULL)
1271  base->invalidateAll();
1272 
1273  if (baseOrientation != NULL)
1274  baseOrientation->invalidateAll();
1275 }
1276 
1277 
1278 
1279 
1280 CFrameReference::CFrameReference(CFrame *reference)
1281 {
1282  this->reference = reference;
1283 }
1284 
1285 CFrameReference::CFrameReference()
1286 {
1287  reference = NULL;
1288 }
1289 
1290 
1291 
1292 void CFrame::invalidate()
1293 {
1294  // _isUpdated = false;
1295  _isValid = false;
1296 
1297  //printf("Frame: Invalidating %s\n", name.c_str());
1298  /*
1299  if (_isLocked)// || time >= 0)
1300  return;
1301 
1302  _isValid = false; */
1303 
1304  for (unsigned int i=0; i<parents.size(); i++)
1305  parents[i]->invalidate();
1306 }
1307 
1308 
1309 
1310 // test
1311 
1312 
1313  /*
1314 void CFrame::getRelativeToBase(CMatrix &mat)
1315 {
1316  if (_isValid || _isLocked)
1317  {
1318  mat = relativePose;
1319  return;
1320  }
1321 
1322  if (getBase() == NULL)
1323  {
1324  mat = relativePose = pose;
1325  return;
1326  }
1327 
1328  childs.clear();
1329  CFrame *frame = getBase();
1330  while (frame != NULL)
1331  {
1332  childs.push_back(frame);
1333  if (frame->_isValid || frame->_isLocked)
1334  {
1335  break;
1336  }
1337  frame = frame->getBase();
1338  }
1339 
1340  childs.back()->getRelativeToBase(tmpMatrix);
1341  for (int i=(int)childs.size()-2; i>= 0; i--)
1342  {
1343  childs[i]->relativePose.mulNoAlloc(childs[i+1]->relativePose, childs[i]->pose);
1344  childs[i]->_isValid = true;
1345  }
1346 
1347  relativePose.mulNoAlloc(childs[0]->relativePose, pose);
1348 
1349  _isValid = true;
1350 
1351  mat = relativePose;
1352 }
1353 
1354 CMatrix CFrame::getRelativeToBase()
1355  {
1356  CMatrix tmpMatrix;
1357  getRelativeToBase(tmpMatrix);
1358  return tmpMatrix;
1359  }
1360  */
1361 /*
1362 void CFrame::getRelativeToBase(CMatrix &mat)
1363 {
1364  if (_isValid || _isLocked)
1365  {
1366  mat = relativePose;
1367  return;
1368  }
1369 
1370  if (getBase() != NULL)
1371  {
1372  getBase()->getRelativeToBase(tmpMatrix);
1373  relativePose.mulNoAlloc(tmpMatrix, pose);
1374  } else relativePose = pose;
1375 
1376  _isValid = true;
1377 
1378  mat = relativePose;
1379 }
1380 
1381 CMatrix CFrame::getRelativeToBase()
1382  {
1383 
1384  if (_isValid || _isLocked)
1385  {
1386  return relativePose;
1387  }
1388 
1389  if (getBase() != NULL)
1390  {
1391  getBase()->getRelativeToBase(tmpMatrix);
1392  relativePose.mulNoAlloc(tmpMatrix, pose);
1393  } else relativePose = pose;
1394 
1395  _isValid = true;
1396 
1397  return relativePose;
1398  }
1399 */
1400 
1401 }
PRECISION z
Definition: vecmath.h:60
Denavit Hartenberg Link information.
Definition: frame.h:241
std::string printToString(const char *format,...)
Definition: utils.cpp:149
virtual void setBase(CFrame *base)
Definition: frame.cpp:587
bool getFrameByName(const char *name, CFrame *&frame)
Definition: frame.cpp:945
void setDh(const robotLibPbD::CDh &dh)
Creates Denavit Hartenberg matrix.
Definition: vecmath.cpp:156
void mul(const CMatrix &first, const CMatrix &second)
Assigns product of two matrices to matrix.
Definition: vecmath.h:380
Frame in cartesian space.
Definition: frame.h:169
Kinematic chain.
Definition: frame.h:266
PRECISION a[16]
Definition: vecmath.h:190
static const char * getAttributeString(TiXmlElement *node, const char *str, const char *def="")
void tokenize(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters)
virtual void setBaseOrientationName(const char *str)
Definition: frame.h:183
PRECISION length() const
Definition: vecmath.cpp:355
virtual void setBaseOrientation(CFrame *base)
Definition: frame.cpp:1248
PRECISION w
Definition: vecmath.h:60
void resolveString(std::string input, std::string &output)
Definition: datapairs.cpp:284
Data Storage Class (Attribute-Value Pairs)
Definition: datapairs.h:33
bool setData(bool value)
Definition: frame.h:96
void loadFromXml(CConfiguration &config, TiXmlElement *kinChainsNode, CFrameContainer &container)
Transforms <CHAIN> (xml object) into kinematic chain object.
Definition: frame.cpp:673
Homogenous vector.
Definition: vecmath.h:57
virtual void setBaseName(const char *str)
Definition: frame.h:104
std::vector< CFrame * > frames
Definition: frame.h:199
virtual void setTime(double time)
Definition: frame.h:133
Homogenous matrix.
Definition: vecmath.h:187
bool load(const char *cfgFile)
virtual void setBaseType(unsigned int type)
Definition: frame.h:108
virtual char * getName()
Definition: frame.h:103
void set(PRECISION a0, PRECISION a4, PRECISION a8, PRECISION a12, PRECISION a1, PRECISION a5, PRECISION a9, PRECISION a13, PRECISION a2, PRECISION a6, PRECISION a10, PRECISION a14, PRECISION a3=0.0f, PRECISION a7=0.0f, PRECISION a11=0.0f, PRECISION a15=1.0f)
Definition: vecmath.cpp:144
virtual void setPose(const CMatrix &pose)
Definition: frame.h:120
#define LOG_VERBOSE(format,...)
Definition: log.h:34
Robot types with implemented inverse kinematics.
Definition: frame.h:39
virtual CFrame * getBase()
Definition: frame.h:482
void addParent(CFrame *parent)
Definition: frame.cpp:426
CFrame * getFrame(unsigned int id)
Definition: frame.h:224
void findNodes(const char *name, std::vector< TiXmlElement * > &result, TiXmlElement *start, unsigned int level)
virtual void setName(const char *str)
Definition: frame.cpp:610
static bool getAttributeBoolean(TiXmlElement *node, const char *str, bool def=false)
static int getAttributeInteger(TiXmlElement *node, const char *str, int def=0)
PRECISION y
Definition: vecmath.h:60
virtual void setFrameType(unsigned int type)
Definition: frame.h:113
void setDofs(const std::vector< double > &dofs_min, const std::vector< double > &dofs_max)
Definition: frame.cpp:84
Configuration file wrapper.
Definition: configuration.h:34
#define LOG_ERROR(format,...)
Definition: log.h:36
void invert()
Inverts the matrix (only for homogenous matrices)
Definition: vecmath.h:461
PRECISION x
Definition: vecmath.h:60
static double getAttributeDouble(TiXmlElement *node, const char *str, double def=0.0)
virtual unsigned int getBaseType()
Definition: frame.h:109
void removeParent(CFrame *parent)
Definition: frame.cpp:402


asr_kinematic_chain_optimizer
Author(s): Aumann Florian, Heller Florian, Jäkel Rainer, Wittenbeck Valerij
autogenerated on Mon Jun 10 2019 12:35:36