Go to the documentation of this file.
19 #include <Eigen/Eigen>
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>
31 #define KBM_USE_DOUBLE_PRECISION
33 #define KBM_IMPORT_EXPORT
38 #ifdef KBM_USE_DOUBLE_PRECISION
46 using Matrix = Eigen::MatrixXf;
47 using Vector = Eigen::VectorXf;
49 using Vector3 = Eigen::Vector3f;
134 KBM(
int nDoF,
int dim,
Real spreadAngle);
137 bool restore(std::string fileName =
"");
139 void store(std::string fileName =
"");
149 void online(
const Matrix& proprioception,
const Matrix& shape,
Real learnRate = 1.0);
159 void batch(
const Matrix& proprioception,
162 Real threshold = 0.0);
175 Matrix predict(
const Matrix& proprioception,
int dim = 0)
const;
178 void differentiate();
181 Vector getPartialDerivative(
const Vector& proprioception,
int iDoF)
const;
194 const Vector& newSpreadAngles);
204 void getSubdivisedNet(
const Vector newCenter,
206 Matrix& resultingControlNet)
const;
209 void getSubdivisedNet(
unsigned int dof,
212 Matrix& resultingControlNet)
const;
221 checkBBox(
const Vector& lower,
const Vector& upper,
Real tolerance = 0.0f)
const;
235 Real tolerance = 0.0f);
247 Vector getSpreadAngles()
const;
255 Matrix getControlNet()
const;
258 static KBM_ptr createKBM(
int nDoF,
261 const Vector& spreadAngles,
262 const Matrix& controlNet);
263 static KBM_ptr createFromVirtualRobot(VirtualRobot::KinematicChainPtr chain,
265 const Vector& spreadAngles,
266 bool useOrientation =
false);
283 void createIndices();
291 std::vector<Matrix> partialDerivatives;
309 const Vector& _spreadAngles,
323 this->
center = kbm->getCenter();
326 kbm->getBBox(BBupper, BBlower);
327 this->
lower = BBlower;
328 this->
upper = BBupper;
364 unsigned int recursion,
418 const Vector& _spreadAngles,
Namespace where the Partial Least Squares (PLS-1) solver is defined in.
std::vector< Solution > SolutionSet
std::shared_ptr< KBM > KBM_ptr
Solution(const Vector &_center, const Vector &_spreadAngles, const Vector &_upper, const Vector &_lower, const Models::KBM::BBCheckType &_type)
GlobalIKSemiBreadth(Real _semiBreadthRecursion, int _solutionSelect=Models::KBM::COVERED)
MatrixXX< 4, 4, float > Matrix4f
Real IQR
Inerquartile range (50% of all errors): .
Models::KBM::BBCheckType type
void subdivideAngles(Side side, unsigned int recursion, Models::KBM_ptr kbm, Vector ¢er, Vector &spreadAngles)
Subdivides the joint angles only. Can be used to select in which direction to subdivise first.
virtual unsigned int recurse(unsigned int level, Models::KBM_ptr kbm)=0
Real STD
Standard deviation.
Real semiBreadthRecursion
Return type of the evaluation (KBM::getErrors()) function providing insight in the statistics of the ...
std::ostream & operator<<(std::ostream &os, const KBM::ErrorValuesType &et)
Real Median
Median of the error.
@ COVERED
The bounding box is covered by the interval (most interesting case for inverse kinematics).
void store(const mongocxx::database &db, const armem::wm::Memory &m)
Where the model representation for a Body Schema (especially the Kinematic B“ezier Maps) reside.
ReaderT::InputType & input
BBCheckType
Cases for the check of bounding boxes (i.e., an interval ) and an interval ( )both in Cartesian coor...
unsigned int recurse(unsigned int level, Models::KBM_ptr kbm) override
Models::KBM::BBCheckType type
Solution(Models::KBM_ptr kbm, Models::KBM::BBCheckType type)
#define KBM_IMPORT_EXPORT
Finds all solutions to the Global IK.
Namespace for algorithms related to solving the inverse kinematics.
Optimization
Enum for the preferred optimization method during batch learning.
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)
Expands all nets until a resolution has been reached, then search only for a single solution.
Models::KBM_ptr subdivideKBM(GlobalIKBase::Side side, unsigned int recursion, Models::KBM_ptr kbm)
Subdivides the kbm and creates new KBM. Calls GlobalIKBase::subdivideAngles().
GlobalIKBase::SolutionSet runDijkstra(KBM::Inverse::GraphNode initial)
state::Type center(state::Type previous)
The Kinematic B\'ezier Maps.
boost::intrusive_ptr< SceneObject > SceneObjectPtr
GraphNode(Models::KBM_ptr _model, Real _ratio, int _level, Real _volume)
void solve(Models::KBM_ptr kbm, const Vector lower, const Vector upper, Real resolution=2.0f *M_PI/180.0f)
unsigned int recurse(unsigned int level, Models::KBM_ptr kbm) override
Solution(const Vector &_center, const Vector &_spreadAngles, const Vector &_upper, const Vector &_lower, const Models::KBM::BBCheckType &_type)
double Real
Type definition of the underlying Realing point type.
std::vector< Solution > SolutionSet
Return type of the global inverse kinematics solvers.
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.