Joint.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 #ifndef _Joint_H
19 #define _Joint_H
20 
21 /*******************************************************************************
22  * includes & SWIG support *
23  *******************************************************************************/
24 
25 #include <math.h>
26 #include <string.h>
27 #include <iostream>
28 #include <vector>
29 #include <stdlib.h>
30 #include <cstdio>
31 #include <stdexcept> // stdexcept header file contains runtime_error
32 #include <limits>
33 
34 /*******************************************************************************
35  * defines: *
36  *******************************************************************************/
37 
38 /* if length(Joint1 - Joint2) < JOINT_EPSILON, they are considered equal: */
39 #ifndef JOINT_EPSILON
40 #define JOINT_EPSILON .01 / 360.0
41 #endif
42 
43 //#define PI 3.141592654
44 #define DEGS_PER_RAD 57.29577951
45 #define RADS_PER_DEG 0.017453292
46 
47 /* if for some reason (faster performance) you want this class to not perform
48  rangechecking, define JOINT_NO_RANGECHECK in your config or makefile! */
49 
50 // #define JOINT_NO_RANGECHECK
51 
52 /*******************************************************************************
53  * Exception class (definition & implementation) *
54  *******************************************************************************/
55 
56 /* In addition to the standard runtime class, this one takes file and Line number arguments. */
57 class Joint_Exception : public std::runtime_error
58 {
59 public:
60  Joint_Exception(const char* _file, int _line, const char* _msg) : std::runtime_error(_msg), file(_file), line(_line)
61  {
62  msg = _msg;
63  }
64  const char* getFile() const
65  {
66  return file;
67  }
68  int getLine() const
69  {
70  return line;
71  }
72  const char* getMsg() const
73  {
74  return msg;
75  }
76 
77 private:
78  const char* file;
79  int line;
80  const char* msg;
81 };
82 
83 /* operator<< so you can use an exception e like: "cout << e" */
84 inline std::ostream& operator<<(std::ostream& _os, const Joint_Exception& e)
85 {
86  _os << "Error in " << e.getFile();
87  _os << " at line " << e.getLine() << ":" << std::endl;
88  _os << " " << e.getMsg() << std::endl;
89  return _os;
90 }
91 
92 /*******************************************************************************
93  * class definition of template class Joint *
94  *******************************************************************************/
95 
96 template <class Real>
97 class Joint
98 {
99 public:
100  /* constructors: */
101 
102  /* empty Joint, no elements: */
103  Joint();
104  /* joint of size NrJoints, zero=false: uninitialized, zero=true -> all elements zero: */
105  Joint(unsigned int NrJoints, bool zero = false);
106  /* copy constructor: */
107  Joint(const Joint& joints);
108  /* size NrJoints, content copied from d: */
109  Joint(unsigned int NrJoints, const Real d[]);
110 
111  /* destructor: */
112  virtual ~Joint();
113 
114  /* adjust the size of the Joint: */
115  void setNrJoints(unsigned int NrJoints);
116  /* make all elements zero: */
117  void zero();
118 
119  /* element access (write): */
120 
121  /* set element i to value d: */
122  void set(unsigned int i, Real d);
123  Real& operator[](unsigned int i);
124  /* set Joint to size NrJoints and copy contents from d: */
125  void set(unsigned int NrJoints, Real* d);
126  /* copy constructor: */
127  // void set(unsigned int const Joint& _rhs);
128 
129  /* element access (read): */
130 
131  /* return element i: */
132  Real get(unsigned int i) const;
133  Real operator[](unsigned int i) const;
134  /* copy Joint values to array d (d must have enough allocated memory!): */
135  void get(unsigned int NrJoints, Real* d) const;
136  /* return number of elements: */
137  unsigned int size() const;
138 
139  /* Return value of the largest/smallest component: */
140  Real getMax() const;
141  Real getMin() const;
142 
143  /* Return Index of largest/smallest component: */
144  unsigned int getMaxInd() const;
145  unsigned int getMinInd() const;
146 
147  /* calculate this + (j2-this)*f: */
148  Joint interpolate(const Joint& j2, Real f) const;
149  /* set this joint to j1 + (j2-j1)*f: */
150  static Joint interpolate(const Joint& j1, const Joint& j2, Real f);
151 
152  /* convert the Joint from Deg to Rad or vice versa: */
153  void toRad();
154  void toDeg();
155 
156  /* define various operators: */
157 
158  /* operator= */
159  Joint& operator=(const Joint& joint);
160 
161  /* if length(this - rhs) < JOINT_EPSILON, they are considered equal: */
162  bool operator==(const Joint& rhs) const;
163 
164  /* operators +, -, *, / */
165  Joint operator-(const Joint& rhs) const;
166  Joint operator+(const Joint& rhs) const;
167  Joint operator*(Real s) const;
168  Joint operator/(Real s) const;
169 
170  void operator+=(const Joint& rhs);
171  void operator-=(const Joint& rhs);
172  void operator*=(Real s);
173  void operator/=(Real s);
174 
175  /* get euklidian norm (length), squared or normal */
176  /* (not taking the root saves computation time) */
177  Real lengthSqr() const;
178  Real length() const;
179 
180  /* return string which looks like: (0.000, 1.000, 2.000, ...) */
181  /* if convert is true, the values will be converted to degrees */
182  std::string toString(bool convert = false) const;
183  /* read in the joint from a c-string, format as above: */
184  void fromString(unsigned int nrjoints, const char* str);
185  void fromString(const char* str);
186 
187  /* input / output */
188 
189  /* operator<< is not a member function and defined below the class definition */
190  /* same for operator>> */
191 
192  /* if for some reason printf should be used rather than operator<< use this: */
193  void print();
194 
195  /* for compatibility with older code: */
196  unsigned int getNrJoints() const
197  {
198  return size();
199  }
200 
201 private:
202  unsigned int m_NrJoints;
203  Real* m_Joints;
204 };
205 
208 
209 /*******************************************************************************
210  * prototypes for std input output *
211  *******************************************************************************/
212 
213 template <class Real>
214 std::ostream& operator<<(std::ostream& _os, const Joint<Real>& joint);
215 
216 template <class Real>
217 std::istream& operator>>(std::istream&, Joint<Real>& joint);
218 
219 /*******************************************************************************
220  * function for spline compatibility *
221  *******************************************************************************/
222 
223 template <class Real>
224 inline double Distance(const Joint<Real>& j1, const Joint<Real>& j2)
225 {
226  return (j1 - j2).length();
227 }
228 
229 /*******************************************************************************
230  * Inline function implementation: *
231  *******************************************************************************/
232 
233 /* empty Joint, no elements: */
234 template <class Real>
236 {
237  m_NrJoints = 0;
238  m_Joints = NULL;
239 }
240 
241 /* joint of size NrJoints, zero=false: uninitialized, zero=true -> all elements zero: */
242 template <class Real>
243 inline Joint<Real>::Joint(unsigned int NrJoints, bool _zero)
244 {
245  m_NrJoints = NrJoints;
246  m_Joints = new Real[m_NrJoints];
247 
248  if (_zero)
249  zero();
250 }
251 
252 /* copy constructor: */
253 template <class Real>
254 inline Joint<Real>::Joint(const Joint<Real>& rhs)
255 {
256  m_NrJoints = rhs.m_NrJoints;
257  m_Joints = new Real[rhs.m_NrJoints];
258 
259  for (unsigned int i = 0; i < m_NrJoints; i++)
260  m_Joints[i] = rhs.m_Joints[i];
261 }
262 
263 /* size NrJoints, content copied from d: */
264 template <class Real>
265 inline Joint<Real>::Joint(unsigned int NrJoints, const Real d[])
266 {
267  m_NrJoints = NrJoints;
268  m_Joints = new Real[m_NrJoints];
269 
270  for (unsigned int i = 0; i < m_NrJoints; i++)
271  m_Joints[i] = d[i];
272 }
273 
274 /* destructor: */
275 template <class Real>
277 {
278  if (m_Joints)
279  delete[] m_Joints;
280 }
281 
282 /* adjust the size of the Joint: */
283 template <class Real>
284 inline void Joint<Real>::setNrJoints(unsigned int NrJoints)
285 {
286  /* keep old values, if smaller than before cutoff, if larger fill with zeros: */
287 
288  Real* old_m_Joints = m_Joints;
289  m_Joints = new Real[NrJoints];
290 
291  for (unsigned int i = 0; i < NrJoints; i++)
292  {
293  if (i < m_NrJoints)
294  m_Joints[i] = old_m_Joints[i];
295  else
296  m_Joints[i] = 0.0;
297  }
298 
299  if (old_m_Joints)
300  delete[] old_m_Joints;
301 
302  m_NrJoints = NrJoints;
303 }
304 
305 /* make all elements zero: */
306 template <class Real>
307 inline void Joint<Real>::zero()
308 {
309  for (unsigned int i = 0; i < m_NrJoints; i++)
310  m_Joints[i] = 0.0;
311 }
312 
313 /* element access (write): */
314 
315 /* set element i to value d: */
316 template <class Real>
317 inline void Joint<Real>::set(unsigned int i, Real d)
318 {
319 #ifndef JOINT_NO_RANGECHECK
320  if ((m_Joints == NULL) || (i >= m_NrJoints))
321  throw Joint_Exception(__FILE__, __LINE__, "tried to acces an element out of Joint range!");
322 #endif
323  m_Joints[i] = d;
324 }
325 
326 template <class Real>
327 inline Real& Joint<Real>::operator[](unsigned int i)
328 {
329 #ifndef JOINT_NO_RANGECHECK
330  if ((m_Joints == NULL) || (i >= m_NrJoints))
331  throw Joint_Exception(__FILE__, __LINE__, "tried to acces an element out of Joint range!");
332 #endif
333  return m_Joints[i];
334 }
335 
336 /* set Joint to size NrJoints and copy contents from d: */
337 template <class Real>
338 inline void Joint<Real>::set(unsigned int NrJoints, Real* d)
339 {
340 #ifndef JOINT_NO_RANGECHECK
341  if ((!m_Joints) || (NrJoints != m_NrJoints))
342  setNrJoints(NrJoints);
343 #endif
344 
345  for (unsigned int i = 0; i < m_NrJoints; i++)
346  m_Joints[i] = d[i];
347 }
348 
349 /* element access (read): */
350 
351 /* return element i: */
352 template <class Real>
353 inline Real Joint<Real>::get(unsigned int i) const
354 {
355 #ifndef JOINT_NO_RANGECHECK
356  if ((m_Joints == NULL) || (i >= m_NrJoints))
357  throw Joint_Exception(__FILE__, __LINE__, "tried to acces an element out of Joint range!");
358 #endif
359 
360  return m_Joints[i];
361 }
362 
363 template <class Real>
364 inline Real Joint<Real>::operator[](unsigned int i) const
365 {
366  return get(i);
367 }
368 
369 /* copy Joint values to array d (d must have enough allocated memory!): */
370 template <class Real>
371 inline void Joint<Real>::get(unsigned int NrJoints, Real* d) const
372 {
373 #ifndef JOINT_NO_RANGECHECK
374  if ((m_Joints == NULL) || (NrJoints > m_NrJoints))
375  throw Joint_Exception(__FILE__, __LINE__, "tried to acces an element out of Joint range!");
376 #endif
377 
378  for (unsigned int i = 0; i < m_NrJoints; i++)
379  d[i] = m_Joints[i];
380 }
381 
382 /* return number of elements: */
383 template <class Real>
384 inline unsigned int Joint<Real>::size() const
385 {
386  return m_NrJoints;
387 }
388 
389 /* Return value of the largest/smallest component: */
390 template <class Real>
391 inline Real Joint<Real>::getMax() const
392 {
393 #ifndef JOINT_NO_RANGECHECK
394  if (m_NrJoints == 0)
395  throw Joint_Exception(__FILE__, __LINE__, "tried to call getMax on empty Joint!");
396 #endif
397 
398  Real max = m_Joints[0];
399  for (unsigned int i = 1; i < m_NrJoints; i++)
400  max = (m_Joints[i] > max) ? m_Joints[i] : max;
401  return max;
402 }
403 
404 template <class Real>
405 inline Real Joint<Real>::getMin() const
406 {
407 #ifndef JOINT_NO_RANGECHECK
408  if (m_NrJoints == 0)
409  throw Joint_Exception(__FILE__, __LINE__, "tried to call getMin on empty Joint!");
410 #endif
411 
412  Real min = m_Joints[0];
413  for (unsigned int i = 1; i < m_NrJoints; i++)
414  min = (m_Joints[i] < min) ? m_Joints[i] : min;
415  return min;
416 }
417 
418 /* Return Index of largest/smallest component: */
419 template <class Real>
420 inline unsigned int Joint<Real>::getMaxInd() const
421 {
422 #ifndef JOINT_NO_RANGECHECK
423  if (m_NrJoints == 0)
424  throw Joint_Exception(__FILE__, __LINE__, "tried to call getMaxInd on empty Joint!");
425 #endif
426 
427  Real max = m_Joints[0];
428  unsigned int maxI = 0;
429 
430  for (unsigned int i = 1; i < m_NrJoints; i++)
431  {
432  if (m_Joints[i] > max)
433  {
434  max = m_Joints[i];
435  maxI = i;
436  }
437  }
438  return maxI;
439 }
440 
441 template <class Real>
442 inline unsigned int Joint<Real>::getMinInd() const
443 {
444 #ifndef JOINT_NO_RANGECHECK
445  if (m_NrJoints == 0)
446  throw Joint_Exception(__FILE__, __LINE__, "tried to call getMinInd on empty Joint!");
447 #endif
448 
449  Real min = m_Joints[0];
450  unsigned int minI = 0;
451 
452  for (unsigned int i = 1; i < m_NrJoints; i++)
453  {
454  if (m_Joints[i] < min)
455  {
456  min = m_Joints[i];
457  minI = i;
458  }
459  }
460  return minI;
461 }
462 
463 /* calculate this + (j2-this)*f: */
464 template <class Real>
465 inline Joint<Real> Joint<Real>::interpolate(const Joint& j2, Real f) const
466 {
467 #ifndef JOINT_NO_RANGECHECK
468  if ((m_Joints == NULL) || (j2.size() != m_NrJoints))
469  throw Joint_Exception(__FILE__, __LINE__, "Joint dimensions mismatch in interpolate!");
470 #endif
471 
472  Joint<Real> result(m_NrJoints);
473 
474  for (unsigned int i = 0; i < m_NrJoints; i++)
475  result[i] = m_Joints[i] + (j2[i] - m_Joints[i]) * f;
476 
477  return result;
478 }
479 
480 /* calculate j1 + (j2-j1)*f: */
481 template <class Real>
482 inline Joint<Real> Joint<Real>::interpolate(const Joint& j1, const Joint& j2, Real f)
483 {
484 #ifndef JOINT_NO_RANGECHECK
485  if (j1.size() != j2.size())
486  throw Joint_Exception(__FILE__, __LINE__, "Joint dimensions mismatch in interpolate!");
487 #endif
488 
489  Joint<Real> result(j1.size());
490 
491  for (unsigned int i = 0; i < j1.size(); i++)
492  result[i] = j1[i] + f * (j2[i] - j1[i]);
493 
494  return result;
495 }
496 
497 /* convert the Joint from Deg to Rad or vice versa: */
498 template <class Real>
499 inline void Joint<Real>::toRad()
500 {
501  for (unsigned int i = 0; i < m_NrJoints; i++)
502  m_Joints[i] *= RADS_PER_DEG; // 0.017453292;
503 }
504 
505 template <class Real>
506 inline void Joint<Real>::toDeg()
507 {
508  for (unsigned int i = 0; i < m_NrJoints; i++)
509  m_Joints[i] *= DEGS_PER_RAD; // 57.29577951;
510  // 57.29577951 = 180 / Pi
511 }
512 
513 /* define various operators: */
514 
515 /* operator= */
516 template <class Real>
518 {
519  if (joint.size() != m_NrJoints)
520  setNrJoints(joint.size());
521 
522  for (unsigned int i = 0; i < m_NrJoints; i++)
523  m_Joints[i] = joint[i];
524 
525  return *this;
526 }
527 
528 /* if length(this - rhs) < JOINT_EPSILON, they are considered equal: */
529 template <class Real>
530 inline bool Joint<Real>::operator==(const Joint& joint2) const
531 {
532 #ifndef JOINT_NO_RANGECHECK
533  if (m_NrJoints != joint2.size())
534  return false;
535  else
536  {
537 #endif
538 
539  // Wenn betragsquadrat(joint1-joint2) < epsilon sind joints "gleich"
540  Joint<Real> diff = *this - joint2;
541  if (diff.lengthSqr() < JOINT_EPSILON)
542  return true;
543  else
544  return false;
545 
546 #ifndef JOINT_NO_RANGECHECK
547  }
548 #endif
549 }
550 
551 /* operators +, -, *, / */
552 template <class Real>
554 {
555 #ifndef JOINT_NO_RANGECHECK
556  if (m_NrJoints != rhs.size())
557  throw Joint_Exception(__FILE__, __LINE__, "Joint dimensions mismatch in operator+ !");
558 #endif
559 
560  Joint<Real> result(*this);
561  for (unsigned int i = 0; i < m_NrJoints; i++)
562  {
563  result.m_Joints[i] += rhs[i];
564  }
565  return result;
566 }
567 
568 template <class Real>
570 {
571 #ifndef JOINT_NO_RANGECHECK
572  if (m_NrJoints != rhs.size())
573  throw Joint_Exception(__FILE__, __LINE__, "Joint dimensions mismatch in operator- !");
574 #endif
575 
576  Joint<Real> result(*this);
577  for (unsigned int i = 0; i < m_NrJoints; i++)
578  {
579  result.m_Joints[i] -= rhs[i];
580  }
581  return result;
582 }
583 
584 template <class Real>
586 {
587  Joint<Real> result(*this);
588  for (unsigned int i = 0; i < m_NrJoints; i++)
589  result.m_Joints[i] *= s;
590  return result;
591 }
592 
593 template <class Real>
595 {
596  Joint<Real> result(*this);
597  if (fabs(s) > std::numeric_limits<Real>::epsilon())
598  for (unsigned int i = 0; i < m_NrJoints; i++)
599  result.m_Joints[i] /= s;
600  else
601  throw Joint_Exception(__FILE__, __LINE__, "Attempt to divide by zero in operator/ !");
602 
603  return result;
604 }
605 
606 /* operators +=, -=, *=, /= */
607 template <class Real>
608 inline void Joint<Real>::operator+=(const Joint<Real>& rhs)
609 {
610 #ifndef JOINT_NO_RANGECHECK
611  if (m_NrJoints != rhs.size())
612  throw Joint_Exception(__FILE__, __LINE__, "Joint dimensions mismatch in operator+= !");
613 #endif
614 
615  for (unsigned int i = 0; i < m_NrJoints; i++)
616  {
617  m_Joints[i] += rhs[i];
618  }
619 }
620 
621 template <class Real>
622 inline void Joint<Real>::operator-=(const Joint<Real>& rhs)
623 {
624 #ifndef JOINT_NO_RANGECHECK
625  if (m_NrJoints != rhs.size())
626  throw Joint_Exception(__FILE__, __LINE__, "Joint dimensions mismatch in operator-= !");
627 #endif
628 
629  for (unsigned int i = 0; i < m_NrJoints; i++)
630  {
631  m_Joints[i] -= rhs[i];
632  }
633 }
634 
635 template <class Real>
636 inline void Joint<Real>::operator*=(Real s)
637 {
638  for (unsigned int i = 0; i < m_NrJoints; i++)
639  m_Joints[i] *= s;
640 }
641 
642 template <class Real>
643 inline void Joint<Real>::operator/=(Real s)
644 {
645  if (fabs(s) > std::numeric_limits<Real>::epsilon())
646  for (unsigned int i = 0; i < m_NrJoints; i++)
647  m_Joints[i] /= s;
648  else
649  throw Joint_Exception(__FILE__, __LINE__, "Attempt to divide by zero in operator/= !");
650 }
651 
652 /* get euklidian norm (length), squared or normal */
653 /* (not taking the root saves computation time) */
654 template <class Real>
655 inline Real Joint<Real>::lengthSqr() const
656 {
657  Real l = 0;
658  for (unsigned int i = 0; i < getNrJoints(); i++)
659  {
660  l += m_Joints[i] * m_Joints[i];
661  }
662  return l;
663 }
664 
665 template <class Real>
666 inline Real Joint<Real>::length() const
667 {
668  return sqrt(lengthSqr());
669 }
670 
671 /* return string which looks like: (0.000, 1.000, 2.000, ...) */
672 /* if convert is true, the values will be converted to degrees */
673 template <class Real>
674 inline std::string Joint<Real>::toString(bool convert) const
675 {
676  char out[10];
677  std::string str("(");
678  for (unsigned int i = 0; i < m_NrJoints; i++)
679  {
680  if (i != 0)
681  str += ",";
682  if (convert)
683  sprintf(out, "%3.3lf", m_Joints[i] * DEGS_PER_RAD);
684  else
685  sprintf(out, "%3.6lf", m_Joints[i]);
686  str += std::string(out);
687  }
688  str += ")";
689  return str;
690 }
691 
692 /* read in the joint from a c-string, format as above: */
693 template <class Real>
694 inline void Joint<Real>::fromString(unsigned int nrjoints, const char* str)
695 {
696  /* resize the joint if necessary */
697  if (nrjoints != m_NrJoints)
698  setNrJoints(nrjoints);
699 
700  const char* start = strrchr(str, '(');
701  const char* end = strrchr(str, ')');
702  if (end > start)
703  {
704  int n = end - start;
705  char* numbers = new char[n];
706  strncpy(numbers, start + 1, n - 1);
707  char* pch = strtok(numbers, ",");
708  unsigned int i = 0;
709  while (pch != NULL && i < nrjoints)
710  {
711  // cout << pch << endl;
712  set(i, atof(pch));
713  i++;
714  pch = strtok(NULL, ",");
715  }
716  delete numbers;
717  }
718 }
719 
720 /* read in the joint from a c-string, format as above: */
721 template <class Real>
722 inline void Joint<Real>::fromString(const char* str)
723 {
724  std::vector<Real> vec;
725 
726  const char* start = strrchr(str, '(');
727  const char* end = strrchr(str, ')');
728  if (end > start)
729  {
730  int n = end - start;
731  char* numbers = new char[n];
732  strncpy(numbers, start + 1, n - 1);
733  char* pch = strtok(numbers, ",");
734  // int i = 0;
735  while (pch != NULL)
736  {
737  // cout << pch << endl;
738  vec.push_back(atof(pch));
739  pch = strtok(NULL, ",");
740  }
741  }
742 
743  setNrJoints(vec.size());
744  for (unsigned int i = 0; i < m_NrJoints; i++)
745  m_Joints[i] = vec[i];
746 }
747 
748 /* if for some reason printf should be used rather than operator<< use this: */
749 template <class Real>
750 inline void Joint<Real>::print()
751 {
752  for (unsigned int i = 0; i < m_NrJoints; i++)
753  printf("%f ", get(i));
754  printf("\n");
755 }
756 
757 template <class Real>
758 inline std::ostream& operator<<(std::ostream& _os, const Joint<Real>& joint)
759 
760 {
761  std::string str = joint.toString();
762  _os << str;
763  return _os;
764 }
765 
766 template <class Real>
767 inline std::istream& operator>>(std::istream& _is, Joint<Real>& joint)
768 {
769  char c_str[255];
770  _is.get(c_str, 255);
771  joint.fromString(c_str);
772  return _is;
773 }
774 
775 #endif
776 
777 #ifdef SWIG
778 %module Util
779 %include Source/Manipulation/ManipUtil/datastructsManipulator.h
780 %include Source/Manipulation/ManipUtil/Trajectory.h
781 %{
782  #include "Joint.h"
783 %}
784 %include "std_vector.i"
785 %template(Jointd) Joint<double>;
786 #endif
d
Joint operator-(const Joint &rhs) const
Definition: Joint.h:569
const char * getFile() const
Definition: Joint.h:64
void zero()
Definition: Joint.h:307
AbsPos operator*(double s, const AbsPos &abs)
Real getMin() const
Definition: Joint.h:405
ROSCPP_DECL void start()
const char * getMsg() const
Definition: Joint.h:72
Joint operator/(Real s) const
Definition: Joint.h:594
f
std::istream & operator>>(std::istream &, Joint< Real > &joint)
Definition: Joint.h:767
std::string toString(bool convert=false) const
Definition: Joint.h:674
XmlRpcServer s
bool operator==(const Joint &rhs) const
Definition: Joint.h:530
Joint operator+(const Joint &rhs) const
Definition: Joint.h:553
Real & operator[](unsigned int i)
Definition: Joint.h:327
Joint_Exception(const char *_file, int _line, const char *_msg)
Definition: Joint.h:60
Joint()
Definition: Joint.h:235
int getLine() const
Definition: Joint.h:68
ROSCONSOLE_DECL void print(FilterBase *filter, void *logger, Level level, const char *file, int line, const char *function, const char *fmt,...) ROSCONSOLE_PRINTF_ATTRIBUTE(7
Real length() const
Definition: Joint.h:666
Joint< float > Jointf
Definition: Joint.h:207
Real getMax() const
Definition: Joint.h:391
unsigned int size() const
Definition: Joint.h:384
void operator/=(Real s)
Definition: Joint.h:643
void fromString(unsigned int nrjoints, const char *str)
Definition: Joint.h:694
unsigned int getMinInd() const
Definition: Joint.h:442
#define JOINT_EPSILON
Definition: Joint.h:40
void operator*=(Real s)
Definition: Joint.h:636
Joint operator*(Real s) const
Definition: Joint.h:585
void operator-=(const Joint &rhs)
Definition: Joint.h:622
unsigned int getMaxInd() const
Definition: Joint.h:420
Real lengthSqr() const
Definition: Joint.h:655
void toRad()
Definition: Joint.h:499
#define DEGS_PER_RAD
Definition: Joint.h:44
double Distance(const Joint< Real > &j1, const Joint< Real > &j2)
Definition: Joint.h:224
void setNrJoints(unsigned int NrJoints)
Definition: Joint.h:284
std::ostream & operator<<(std::ostream &_os, const Joint_Exception &e)
Definition: Joint.h:84
void print()
Definition: Joint.h:750
Joint interpolate(const Joint &j2, Real f) const
Definition: Joint.h:465
Real * m_Joints
Definition: Joint.h:203
unsigned int m_NrJoints
Definition: Joint.h:202
Real get(unsigned int i) const
Definition: Joint.h:353
void set(unsigned int i, Real d)
Definition: Joint.h:317
unsigned int getNrJoints() const
Definition: Joint.h:196
const char * msg
Definition: Joint.h:80
Definition: Joint.h:97
const char * file
Definition: Joint.h:78
#define RADS_PER_DEG
Definition: Joint.h:45
void operator+=(const Joint &rhs)
Definition: Joint.h:608
Joint & operator=(const Joint &joint)
Definition: Joint.h:517
void toDeg()
Definition: Joint.h:506
virtual ~Joint()
Definition: Joint.h:276
Joint< double > Jointd
Definition: Joint.h:206


schunk_powercube_chain
Author(s): Florian Weisshardt
autogenerated on Mon Nov 25 2019 03:48:21