kbm.h
Go to the documentation of this file.
1 /* *********************
2  * @file kbm.h
3  *
4  * @author Stefan Ulbrich
5  * @date 2013-2014
6  *
7  * @brief This file contains the definition the class representing the Kinematic Bezier Maps.
8  * *********************/
9 
10 
11 #pragma once
12 
13 #include <iostream>
14 #include <memory>
15 #include <ostream>
16 #include <queue>
17 #include <vector>
18 
19 #include <Eigen/Eigen>
20 #include <Eigen/QR>
21 
22 #define USE_SIMOX
23 #ifdef USE_SIMOX
24 #include <VirtualRobot/KinematicChain.h>
25 #include <VirtualRobot/Nodes/RobotNode.h>
26 #include <VirtualRobot/Nodes/RobotNodeRevolute.h>
27 #include <VirtualRobot/Robot.h>
28 #include <VirtualRobot/VirtualRobotException.h>
29 #endif
30 
31 #define KBM_USE_DOUBLE_PRECISION
32 
33 #define KBM_IMPORT_EXPORT
34 
35 namespace memoryx::KBM
36 {
37  /// Type definition of the underlying Realing point type.
38 #ifdef KBM_USE_DOUBLE_PRECISION
39  using Real = double;
40  using Matrix = Eigen::MatrixXd;
41  using Vector = Eigen::VectorXd;
42  using Matrix4 = Eigen::Matrix4d;
43  using Vector3 = Eigen::Vector3d;
44 #else
45  using Real = float;
46  using Matrix = Eigen::MatrixXf;
47  using Vector = Eigen::VectorXf;
48  using Matrix4 = Eigen::Matrix4f;
49  using Vector3 = Eigen::Vector3f;
50 #endif
51 } // namespace memoryx::KBM
52 
53 /// Namespace where the <i>Partial Least Squares (PLS-1)</i> solver is defined in.
55 {
56  /** Solves a linear system of equations using the partial least squares algorithm.
57  * @param input Input values (i.e., the rational polynomial basis)
58  * @param output Output values (e.g., TCP positions/orientation)
59  * @param threshold Tells the algorithm when to stop. If zero, the result is the same as the standard least mean squares (but w/o matrix inversions)
60  */
61  Matrix KBM_IMPORT_EXPORT solve(const Matrix& input, const Matrix output, Real threshold);
62 } // namespace memoryx::KBM::PLS
63 
64 /** Where the model representation for a Body Schema (especially the Kinematic B&acute;ezier Maps) reside.
65  * @todo Dynamic B&acute;ezier Maps (KBM for the inverse dynamics) are still to be implemented.
66  */
67 namespace memoryx::KBM::Models
68 {
69 
70  class KBM;
71  using KBM_ptr = std::shared_ptr<KBM>;
72 
73  /** @brief The Kinematic B\'ezier Maps.
74  *
75  * @details This class represents the Kinematic B\'ezier Map algorithm.
76  * See the unit test on hints on how to use it.
77  * @todo In the predict function, the center vector should be substracted from the proprioception!
78  * @todo Introduce more the terms of intervals instead of spread angle and center!?
79  * @todo offer a linearized version (for small angles).
80  */
82  {
83  public:
84  /// Enum for the preferred optimization method during batch learning
86  {
88  PLS
89  };
90 
91  /** Cases for the check of bounding boxes (i.e., an interval \f$ [c_{l,1},c_{u,1}]\times\ldots\times [c_{l,n},c_{u,n}] \f$)
92  * and an interval \f$i\f$ (\f$ [i_{l,1},i_{u,1}]\times\ldots\times [i_{l,n},i_{u,n}] \f$)both in Cartesian coordinates.
93  */
95  {
96  /// The interval is included in the bounding box \f$ \forall j: i_{l,j} > c_{l,j} \wedge c_{u,j} > i_{u,j} \f$
97  INCLUDED = 1,
98  /// The bounding box is covered by the interval \f$ \forall j: i_{l,j} < c_{l,j} \wedge c_{u,j} < i_{u,j} \f$ (most interesting case for inverse kinematics).
99  COVERED = 2,
100  /// The bounding box and interval are disjoint \f$ \exists_j: i_{u,j} < c_{l,j} \vee c_{u,j} < i_{l,j} \f$
101  DISJOINT = 4,
102  /// The interval and bounding box are partially overlapping (if none of the above applies).
103  OVERLAPPING = 8,
104  ALL = 15
105  };
106 
107  /// Return type of the evaluation (KBM::getErrors()) function providing insight in the statistics of the prediction error.
109  {
110  /// Mean error
112  /// Standard deviation
114  /// Median of the error
116  /// Inerquartile range (50% of all errors): \f$IQR= Q_{75\%} - Q_{25\%}\f$
118  /// Maximal error
120  /// For debugging output
121  friend KBM_IMPORT_EXPORT std::ostream& operator<<(std::ostream& os,
122  const ErrorValuesType& et);
123  };
124 
125  /// Copy constructor
126  KBM(const KBM& other);
127 
128  /** @brief Constructor
129  * @param nDoF The number of the kinematic chain's degrees of freedom (number of input dimensions)
130  * @param dim The number of output dimensions (usually three)
131  * @param spreadAngle The input values should be centered around 0 and this angle should represent
132  * their distribution in input space.
133  */
134  KBM(int nDoF, int dim, Real spreadAngle);
135 
136  /// loads a KBM with same input/output dimensions from disk (comma-separated values).
137  bool restore(std::string fileName = "");
138  /// stores the current KBM as a comma-separated matrix to disk.
139  void store(std::string fileName = "");
140  /** @brief Implements the online learning algorithm.
141  * @param proprioception The input values (joint angles)
142  * @param shape The output values (e.g. 3D TCP positions)
143  * @param learnRate Learning rate between (0,1)
144  * Can be called (and still makes sense) after KBM::restore() and KBM::batch() and
145  * prior calls to KBM::online().
146  * Proprioception must have the same number of columns (i.e., number of samples)
147  * while the rows must match the number of input and output dimensions respectively.
148  */
149  void online(const Matrix& proprioception, const Matrix& shape, Real learnRate = 1.0);
150  // @param learnRate Learning rate between (0,1)
151  /** @brief Implements the batch learning algorithm.
152  * @param proprioception The input values (joint angles)
153  * @param shape The output values (e.g. 3D TCP positions)
154  * @param method Select optimization with standard linear least mean squares (KBM::STANDARD) or partial least squares (KMB::PLS)
155  * @param threshold Models the noise and should equal the expected mean positioning error of the system. Only used with partial least squares (KBM::PLS)
156  * Proprioception must have the same number of columns (i.e., number of samples)
157  * while the rows must match the number of input and output dimensions respectively.
158  */
159  void batch(const Matrix& proprioception,
160  const Matrix& shape,
161  Optimization method = KBM::STANDARD,
162  Real threshold = 0.0);
163  /** After learning this function gives various error measures over a given test set.online
164  * Proprioception must have the same number of columns (i.e., number of samples)
165  * while the rows must match the number of input and output dimensions respectively.*/
166  ErrorValuesType getErrors(const Matrix& proprioception, const Matrix& shape);
167  /// Forgets all previously learned samples.
168  void reset();
169 
170  /** @brief Predicts a value of the FK given a set of joint angles.
171  * @param proprioception The input values (joint angles in the columns).
172  * @param dim If > 0, the prediction assumes it is the last joint in the kinematic chain and creates a coordinate frame
173  * according to the partial derivative.
174  */
175  Matrix predict(const Matrix& proprioception, int dim = 0) const;
176 
177  /// Prepares the calculus of the derivatives. Has to be called alwayes after learning.
178  void differentiate();
179 
180  /// Computes a partial derivative with respect to a configuration and the specified degree of freedom.
181  Vector getPartialDerivative(const Vector& proprioception, int iDoF) const;
182 
183  /// Computes the partial derivative with respect to a configuration.
184  Matrix getJacobian(const Vector& proprioception) const;
185 
186  /** @brief <b>Work in progress</b> This method subdivides the KBM representation.
187  * @param center The new zero of the input values.
188  * @param newSpreadAngles The new spread angle vector after subdivision. It can also be used to increase
189  * the original angles. <b>Important:</b> The new spread angles must be smaller than
190  * \f$90^\circ\f$ degrees and a smaller value is more suitable in general.
191  * @todo This method needs to be further developed to enable the global inverse kinematics search.
192  */
193  void /*std::shared_ptr<KBM>*/ subdivide(const Vector& center,
194  const Vector& newSpreadAngles);
195 
196  /** @brief <b>Work in progress</b> This method computes the control net of a subdivised KBM instance.
197  * @param center The new zero of the input values.
198  * @param newSpreadAngles The new spread angle vector after subdivision.
199  * @param resultingControlNet The resulting control net of the subdivised KBM.
200  *
201  * This method computes only the control net (i.e., does not create a new KBM instance). It can be used, for instance,
202  * in the global inverse kinematics algorithms.
203  */
204  void getSubdivisedNet(const Vector newCenter,
205  Vector newSpreadAngles,
206  Matrix& resultingControlNet) const;
207 
208  /// Makes the subdivision only for one degree of freedom
209  void getSubdivisedNet(unsigned int dof,
210  Real center,
211  Real newSpreadAngle,
212  Matrix& resultingControlNet) const;
213 
214  /** @brief Check whether an interval overlaps the the bounding box of the control points.
215  * @param lower The lower bounds of the interval.
216  * @param upper The upper bounds of the interval.
217  * @param tolerance Widens each bounding box by twice this skalar. You should use lower and upper to implement this behavior regularly.
218  * @todo Add parameter to chose between overlapping and containment.
219  */
221  checkBBox(const Vector& lower, const Vector& upper, Real tolerance = 0.0f) const;
222 
223  /** @brief Check whether an interval overlaps the the bounding box of a given control net.
224  * @param lower The lower bounds of the interval.
225  * @param upper The upper bounds of the interval.
226  * @param controlNet Check againt the bounding box of the points defined by the columns of this matrix.
227  * @param tolerance Widens each bounding box by twice this skalar. You should use lower and upper to implement this behavior regularly.
228  * @see KBM::Models::KBM::BBCheckType for details.
229  * @todo Add parameter to chose between overlapping and containment. Containment seems better but more expensive (more recursions)
230  *
231  */
232  static BBCheckType checkBBoxes(const Vector& lower,
233  const Vector& upper,
234  const Matrix& controlNet,
235  Real tolerance = 0.0f);
236 
237 
238  /// Helper function that extracts the bounding box of a control net.
239  static void getBBox(Vector& lower, Vector& upper, const Matrix& controlNet);
240 
241  void getBBox(Vector& lower, Vector& upper);
242  Real getVolume();
243  Real getOverlappingVolume(const Vector& lower, const Vector& upper);
244  Real getOverlappingVolumeRatio(const Vector& lower, const Vector& upper, Real targetVolume);
245 
246  /// Return the spread angles.
247  Vector getSpreadAngles() const;
248 
249  /// Return the center.
250  Vector getCenter() const;
251 
252  /// Get the number of degrees of freedom (DoF).
253  int getNDoF() const;
254  int getNDim() const;
255  Matrix getControlNet() const;
256 
257  /// Factory methods
258  static KBM_ptr createKBM(int nDoF,
259  int dim,
260  const Vector& center,
261  const Vector& spreadAngles,
262  const Matrix& controlNet);
263  static KBM_ptr createFromVirtualRobot(VirtualRobot::KinematicChainPtr chain,
265  const Vector& spreadAngles,
266  bool useOrientation = false);
267 
268  private:
269  /** @brief Creates the system of linear equations formed by the Bernstein-polynomials and the projection.
270  * @param proprioception Matrix with joint angles in its columns / (suggested) ColumnVector for blossom
271  * @param dim If 0 < dim < #joint angles, then calculate the blossom for the dim-th joint.
272  * @param a1 If calculating the blossom, a1 and a2 are used instead of proprioception(dim,*).
273  *
274  * About the blossom: In short, it creates all intermediate points constructed by DeCasteljau's algorithm.
275  * It can be used to obtain the control points for the curves in the main direction or its the partial derivative.
276  */
277  Matrix createSLE(const Matrix& proprioception,
278  int dim = -1,
279  Real a1 = 0.0f,
280  Real a2 = 0.0f,
281  bool project = true) const;
282  /// Creates an index for addressing the control vertice
283  void createIndices();
284  int nDoF;
285  int dim;
286  //Real spreadAngle;
287  //std::vector<Real> spreadAngles;
288  Vector spreadAngles;
289  Matrix index;
290  Matrix controlNet;
291  std::vector<Matrix> partialDerivatives;
292  int nControlPoints;
293  Vector center;
294  };
295 
296 
297 } // namespace memoryx::KBM::Models
298 
299 /// Namespace for algorithms related to solving the inverse kinematics
300 namespace memoryx::KBM::Inverse
301 {
302 
304  {
305  public:
306  struct Solution
307  {
308  Solution(const Vector& _center,
309  const Vector& _spreadAngles,
310  const Vector& _upper,
311  const Vector& _lower,
312  const Models::KBM::BBCheckType& _type) :
313  center(_center),
314  spreadAngles(_spreadAngles),
315  upper(_upper),
316  lower(_lower),
317  type(_type)
318  {
319  }
320 
322  {
323  this->center = kbm->getCenter();
324  this->spreadAngles = kbm->getSpreadAngles();
325  Vector BBupper, BBlower;
326  kbm->getBBox(BBupper, BBlower);
327  this->lower = BBlower;
328  this->upper = BBupper;
329  }
330 
336  };
337 
338  using SolutionSet = std::vector<Solution>;
339 
340  enum Side
341  {
345  };
346 
348  {
349  }
350 
351  void solve(Models::KBM_ptr kbm,
352  const Vector lower,
353  const Vector upper,
354  Real resolution = 2.0f * M_PI / 180.0f);
355 
357 
358  protected:
359  /// Subdivides the kbm and creates new KBM. Calls GlobalIKBase::subdivideAngles().
361  subdivideKBM(GlobalIKBase::Side side, unsigned int recursion, Models::KBM_ptr kbm);
362  /// Subdivides the joint angles only. Can be used to select in which direction to subdivise first.
363  void subdivideAngles(Side side,
364  unsigned int recursion,
365  Models::KBM_ptr kbm,
366  Vector& center,
367  Vector& spreadAngles);
368 
369  virtual unsigned int recurse(unsigned int level, Models::KBM_ptr kbm) = 0;
372  };
373 
374  struct GraphNode
375  {
376  GraphNode(Models::KBM_ptr _model, Real _ratio, int _level, Real _volume) :
377  model(_model), ratio(_ratio), level(_level), volume(_volume)
378  {
379  }
380 
383  int level;
385  };
386 
387  /** Finds <i>all</i> solutions to the Global IK.
388  *
389  * Note that this may be \f$ 2^\frac{\alpha_{spread}}{\alpha_{resolution}}\f$ (i.e., <i> a lot </i>) solutions.
390  */
392  {
393  protected:
394  unsigned int recurse(unsigned int level, Models::KBM_ptr kbm) override;
395  };
396 
397  /** Expands all nets until a resolution has been reached, then search only for a single solution.
398  *
399  * This is the most promising approach for large kinematics.
400  */
402  {
403  public:
404  GlobalIKSemiBreadth(Real _semiBreadthRecursion, int _solutionSelect = Models::KBM::COVERED);
405  int misses;
407 
408  protected:
412  unsigned int recurse(unsigned int level, Models::KBM_ptr kbm) override;
413  };
414 
415  struct Solution
416  {
417  Solution(const Vector& _center,
418  const Vector& _spreadAngles,
419  const Vector& _upper,
420  const Vector& _lower,
421  const Models::KBM::BBCheckType& _type) :
422  center(_center), spreadAngles(_spreadAngles), upper(_upper), lower(_lower), type(_type)
423  {
424  }
425 
431  };
432 
433  /// Return type of the global inverse kinematics solvers.
434  using SolutionSet = std::vector<Solution>;
435 
436  /** @brief Algorithm to find the <b>global</b> solution to the inverse kinematics based on the KBM structure. <b>Work in progress</b>.
437  * @param kbm The already learned KBM representation of a kinematics.
438  * @param lower The lower bound of the interval in Cartesian space.
439  * @param upper The upper bound of the interval in Cartesian space. Lower and upper bounds should be a target destination plus a desired tolerance, but can be chosen with equal values.
440  * @param resolution The granularity of the found solutions (defaults to \f$2^\circ\f$).
441  * @return The algorithm returns a list of joint angle intervals (the size is specified by the resolution parameters).
442  *
443  * This algorithm solves the inverse kinematics <b>globally</b> and <b>numerically</b> by using an interval based
444  * version of the forward kinemtatics
445  * \f[ f(\alpha_1, \beta_1,\ldots,\alpha_n,\beta_n) = ([a_x, \ldots, b_x],[a_y,\ldots,b_y],[a_z,\ldots,b_z]).\f]
446  * which can be subdivided easily because of the linearisation emerging from the KBM model.
447  * This means that if there exist more than a single solution,
448  * a list of intervals that <i>probably</i> contain a solution. Specifically, this means that the target position lies within
449  * the bounding box of the control net of the subdivised kbm. If a sufficient amount of steps has been performed,
450  * the solution is garantueed to lie at least close to the desired target. The number of steps can be regulated
451  * by the resolution parameter (i.e., \f$n_{steps}=\log_2\frac{\alpha_{spread}}{\alpha_{resolution}}\f$).
452  * An interval-based version of this algorithm exists to define this distance in Cartesian space.
453  *
454  * \image html subdivision.png "Subdivision in angular space"
455  * \image html subdivision2.png "Subdivision in angular space"
456  *
457  * @todo Allow for additional constraints and behaviors in the form of a functor parameter.
458  * @todo Transform into class (with solution set embedded). For easier parameter settings. Further, SolutionSet should be a class with more information.
459  * @todo Change the enum type in KBM::Models::KBM::BBCheckType such that they can be combined by binary operators.
460  * @todo Allow depth search, also conditional after a given accuracy to avoid multiple solutions.
461  */
463  const Vector& lower,
464  const Vector& upper,
465  Real resolution = M_PI / 90.0f);
466  //SolutionSet solveGlobalIK(KBM::Models::KBM_ptr kbm, const Vector &target, Real resolution=M_PI/90.0f);
467 
468 
469 } // namespace memoryx::KBM::Inverse
memoryx::KBM::Inverse::GraphNode::model
Models::KBM_ptr model
Definition: kbm.h:381
memoryx::KBM::Inverse::GlobalIKBase::GlobalIKBase
GlobalIKBase()
Definition: kbm.h:347
memoryx::KBM::PLS
Namespace where the Partial Least Squares (PLS-1) solver is defined in.
Definition: kbm.h:54
memoryx::KBM::Inverse::GlobalIKBase::SolutionSet
std::vector< Solution > SolutionSet
Definition: kbm.h:338
memoryx::KBM::Models::KBM_ptr
std::shared_ptr< KBM > KBM_ptr
Definition: kbm.h:71
memoryx::KBM::Inverse::GraphNode::volume
Real volume
Definition: kbm.h:384
memoryx::KBM::Inverse::GlobalIKBase::Solution::Solution
Solution(const Vector &_center, const Vector &_spreadAngles, const Vector &_upper, const Vector &_lower, const Models::KBM::BBCheckType &_type)
Definition: kbm.h:308
memoryx::KBM::Matrix
Eigen::MatrixXd Matrix
Definition: kbm.h:40
memoryx::KBM::Inverse::GlobalIKSemiBreadth::GlobalIKSemiBreadth
GlobalIKSemiBreadth(Real _semiBreadthRecursion, int _solutionSelect=Models::KBM::COVERED)
Definition: inverse.cpp:807
memoryx::KBM::Inverse::GlobalIKBase::solutions
SolutionSet solutions
Definition: kbm.h:356
index
uint8_t index
Definition: EtherCATFrame.h:59
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:650
memoryx::KBM::Models::KBM::ErrorValuesType::IQR
Real IQR
Inerquartile range (50% of all errors): .
Definition: kbm.h:117
memoryx::KBM::Inverse::GlobalIKBase::Solution::lower
Vector lower
Definition: kbm.h:334
memoryx::KBM::Inverse::Solution::type
Models::KBM::BBCheckType type
Definition: kbm.h:430
memoryx::KBM::Inverse::GlobalIKBase::subdivideAngles
void subdivideAngles(Side side, unsigned int recursion, Models::KBM_ptr kbm, Vector &center, Vector &spreadAngles)
Subdivides the joint angles only. Can be used to select in which direction to subdivise first.
Definition: inverse.cpp:543
memoryx::KBM::Inverse::Solution
Definition: kbm.h:415
memoryx::KBM::Inverse::GlobalIKSemiBreadth::solutionSelect
int solutionSelect
Definition: kbm.h:411
memoryx::KBM::Inverse::GlobalIKBase::recurse
virtual unsigned int recurse(unsigned int level, Models::KBM_ptr kbm)=0
memoryx::KBM::Inverse::GlobalIKSemiBreadth::misses
int misses
Definition: kbm.h:405
memoryx::KBM::Models::KBM::ErrorValuesType::STD
Real STD
Standard deviation.
Definition: kbm.h:113
memoryx::KBM::Models::KBM::ErrorValuesType::Mean
Real Mean
Mean error.
Definition: kbm.h:111
memoryx::KBM::Inverse::GlobalIKBase::Solution
Definition: kbm.h:306
memoryx::KBM::Inverse::GlobalIKSemiBreadth::semiBreadthRecursion
Real semiBreadthRecursion
Definition: kbm.h:410
memoryx::KBM::Vector
Eigen::VectorXd Vector
Definition: kbm.h:41
memoryx::KBM::Models::KBM::ErrorValuesType
Return type of the evaluation (KBM::getErrors()) function providing insight in the statistics of the ...
Definition: kbm.h:108
memoryx::KBM::Models::operator<<
std::ostream & operator<<(std::ostream &os, const KBM::ErrorValuesType &et)
Definition: kbm.cpp:27
memoryx::KBM::Inverse::GlobalIKBase::Solution::center
Vector center
Definition: kbm.h:331
project
std::string project
Definition: VisualizationRobot.cpp:85
memoryx::KBM::Inverse::Solution::upper
Vector upper
Definition: kbm.h:428
memoryx::KBM::Models::KBM::ErrorValuesType::Median
Real Median
Median of the error.
Definition: kbm.h:115
memoryx::KBM::Models::KBM::COVERED
@ COVERED
The bounding box is covered by the interval (most interesting case for inverse kinematics).
Definition: kbm.h:99
memoryx::KBM::Inverse::GlobalIKBase::Side
Side
Definition: kbm.h:340
memoryx::KBM
Definition: inverse.cpp:22
memoryx::KBM::Inverse::GlobalIKBase::END
@ END
Definition: kbm.h:344
armarx::armem::server::ltm::mongodb::util::store
void store(const mongocxx::database &db, const armem::wm::Memory &m)
Definition: operations.cpp:260
scene3D::ALL
@ ALL
Definition: ManipulatorMode.h:35
M_PI
#define M_PI
Definition: MathTools.h:17
memoryx::KBM::Inverse::GlobalIKBase
Definition: kbm.h:303
memoryx::KBM::Inverse::GraphNode::ratio
Real ratio
Definition: kbm.h:382
memoryx::KBM::Models::KBM::STANDARD
@ STANDARD
Definition: kbm.h:87
memoryx::KBM::Inverse::Solution::center
Vector center
Definition: kbm.h:426
memoryx::KBM::Models
Where the model representation for a Body Schema (especially the Kinematic B“ezier Maps) reside.
Definition: inverse.cpp:22
armarx::aron::input
ReaderT::InputType & input
Definition: rw.h:12
memoryx::KBM::Matrix4
Eigen::Matrix4d Matrix4
Definition: kbm.h:42
memoryx::KBM::Models::KBM::BBCheckType
BBCheckType
Cases for the check of bounding boxes (i.e., an interval ) and an interval ( )both in Cartesian coor...
Definition: kbm.h:94
memoryx::KBM::Inverse::GlobalIKSemiBreadth::recurse
unsigned int recurse(unsigned int level, Models::KBM_ptr kbm) override
Definition: inverse.cpp:609
memoryx::KBM::Inverse::GlobalIKBase::Solution::type
Models::KBM::BBCheckType type
Definition: kbm.h:335
memoryx::KBM::Inverse::GlobalIKBase::Solution::Solution
Solution(Models::KBM_ptr kbm, Models::KBM::BBCheckType type)
Definition: kbm.h:321
KBM_IMPORT_EXPORT
#define KBM_IMPORT_EXPORT
Definition: kbm.h:33
memoryx::KBM::Inverse::GlobalIKExtensive
Finds all solutions to the Global IK.
Definition: kbm.h:391
memoryx::KBM::Models::KBM::ErrorValuesType::Max
Real Max
Maximal error.
Definition: kbm.h:119
memoryx::KBM::Inverse
Namespace for algorithms related to solving the inverse kinematics.
Definition: inverse.cpp:361
memoryx::KBM::Models::KBM::Optimization
Optimization
Enum for the preferred optimization method during batch learning.
Definition: kbm.h:85
memoryx::KBM::Inverse::Solution::spreadAngles
Vector spreadAngles
Definition: kbm.h:427
memoryx::KBM::Inverse::solveGlobalIK
void solveGlobalIK(unsigned int recursion, int side, SolutionSet &solutionSet, Models::KBM_ptr kbm, const Vector &lower, const Vector &upper, Real resolution, Vector spreadAngles, Vector center)
Definition: inverse.cpp:365
memoryx::KBM::Inverse::Solution::lower
Vector lower
Definition: kbm.h:429
memoryx::KBM::Inverse::GlobalIKBase::resolution
Real resolution
Definition: kbm.h:371
memoryx::KBM::Inverse::GraphNode
Definition: kbm.h:374
memoryx::KBM::Inverse::GlobalIKSemiBreadth
Expands all nets until a resolution has been reached, then search only for a single solution.
Definition: kbm.h:401
memoryx::KBM::Inverse::GlobalIKBase::subdivideKBM
Models::KBM_ptr subdivideKBM(GlobalIKBase::Side side, unsigned int recursion, Models::KBM_ptr kbm)
Subdivides the kbm and creates new KBM. Calls GlobalIKBase::subdivideAngles().
Definition: inverse.cpp:521
memoryx::KBM::Inverse::GlobalIKSemiBreadth::targetVolume
Real targetVolume
Definition: kbm.h:409
float
#define float
Definition: 16_Level.h:22
memoryx::KBM::Inverse::GlobalIKSemiBreadth::runDijkstra
GlobalIKBase::SolutionSet runDijkstra(KBM::Inverse::GraphNode initial)
Definition: inverse.cpp:751
memoryx::KBM::Inverse::GraphNode::level
int level
Definition: kbm.h:383
armarx::view_selection::skills::direction::state::center
state::Type center(state::Type previous)
Definition: LookDirection.cpp:233
memoryx::KBM::Vector3
Eigen::Vector3d Vector3
Definition: kbm.h:43
memoryx::KBM::Inverse::GlobalIKBase::Solution::upper
Vector upper
Definition: kbm.h:333
memoryx::KBM::Models::KBM
The Kinematic B\'ezier Maps.
Definition: kbm.h:81
scene3D::SceneObjectPtr
boost::intrusive_ptr< SceneObject > SceneObjectPtr
Definition: PointerDefinitions.h:40
memoryx::KBM::Inverse::GraphNode::GraphNode
GraphNode(Models::KBM_ptr _model, Real _ratio, int _level, Real _volume)
Definition: kbm.h:376
memoryx::KBM::Inverse::GlobalIKBase::solve
void solve(Models::KBM_ptr kbm, const Vector lower, const Vector upper, Real resolution=2.0f *M_PI/180.0f)
Definition: inverse.cpp:509
memoryx::KBM::Inverse::GlobalIKExtensive::recurse
unsigned int recurse(unsigned int level, Models::KBM_ptr kbm) override
Definition: inverse.cpp:566
memoryx::KBM::Inverse::GlobalIKBase::Solution::spreadAngles
Vector spreadAngles
Definition: kbm.h:332
memoryx::KBM::Inverse::Solution::Solution
Solution(const Vector &_center, const Vector &_spreadAngles, const Vector &_upper, const Vector &_lower, const Models::KBM::BBCheckType &_type)
Definition: kbm.h:417
memoryx::KBM::Inverse::GlobalIKBase::LOWER
@ LOWER
Definition: kbm.h:342
memoryx::KBM::Real
double Real
Type definition of the underlying Realing point type.
Definition: kbm.h:39
memoryx::KBM::Inverse::GlobalIKBase::targetLower
Vector targetLower
Definition: kbm.h:370
memoryx::KBM::Inverse::GlobalIKBase::UPPER
@ UPPER
Definition: kbm.h:343
memoryx::KBM::Inverse::SolutionSet
std::vector< Solution > SolutionSet
Return type of the global inverse kinematics solvers.
Definition: kbm.h:434
memoryx::KBM::PLS::solve
Matrix KBM_IMPORT_EXPORT solve(const Matrix &input, const Matrix output, Real threshold)
Solves a linear system of equations using the partial least squares algorithm.
Definition: pls.cpp:33
memoryx::KBM::Inverse::GlobalIKBase::targetUpper
Vector targetUpper
Definition: kbm.h:370