DART 6.7.3
Loading...
Searching...
No Matches
IkFast.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011-2019, The DART development contributors
3 * All rights reserved.
4 *
5 * The list of contributors can be found at:
6 * https://github.com/dartsim/dart/blob/master/LICENSE
7 *
8 * This file is provided under the following "BSD-style" License:
9 * Redistribution and use in source and binary forms, with or
10 * without modification, are permitted provided that the following
11 * conditions are met:
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer in the documentation and/or other materials provided
17 * with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#ifndef DART_DYNAMICS_IKFAST_HPP_
34#define DART_DYNAMICS_IKFAST_HPP_
35
36#include <array>
37
38#define IKFAST_HAS_LIBRARY
39#include "dart/external/ikfast/ikfast.h"
40
42
43namespace dart {
44namespace dynamics {
45
51{
52public:
65 IkFast(
67 const std::vector<std::size_t>& dofMap,
68 const std::vector<std::size_t>& freeDofMap,
69 const std::string& methodName = "IKFast",
70 const Analytical::Properties& properties = Analytical::Properties());
71
72 // Documentation inherited.
73 auto computeSolutions(const Eigen::Isometry3d& desiredBodyTf)
74 -> const std::vector<InverseKinematics::Analytical::Solution>& override;
75
76 // Documentation inherited.
77 auto getDofs() const -> const std::vector<std::size_t>& override;
78
80 virtual bool isConfigured() const;
81
82protected:
83 virtual int getNumFreeParameters() const = 0;
84 virtual int* getFreeParameters() const = 0;
85 virtual int getNumJoints() const = 0;
86 virtual int getIkRealSize() const = 0;
87 virtual int getIkType() const = 0;
88
90 virtual bool computeIk(
91 const IkReal* mTargetTranspose,
92 const IkReal* mTargetRotation,
93 const IkReal* pfree,
94 ikfast::IkSolutionListBase<IkReal>& solutions) = 0;
95
96 virtual const char* getKinematicsHash() = 0;
97
98 virtual const char* getIkFastVersion() = 0;
99
102 virtual void configure() const;
103
104protected:
105 mutable std::vector<double> mFreeParams;
106
108 mutable bool mConfigured;
109
112 mutable std::vector<std::size_t> mDofs;
113
116 mutable std::vector<std::size_t> mFreeDofs;
117
118private:
120 std::array<IkReal, 9> mTargetRotation;
121
123 std::array<IkReal, 3> mTargetTranspose;
124};
125
126} // namespace dynamics
127} // namespace dart
128
129#endif // DART_DYNAMICS_IKFAST_HPP_
BodyPropPtr properties
Definition SdfParser.cpp:80
A base class for IkFast-based analytical inverse kinematics classes.
Definition IkFast.hpp:51
virtual bool isConfigured() const
Returns true if this IkFast is ready to solve.
Definition IkFast.cpp:236
auto computeSolutions(const Eigen::Isometry3d &desiredBodyTf) -> const std::vector< InverseKinematics::Analytical::Solution > &override
Use this function to fill the entries of the mSolutions variable.
Definition IkFast.cpp:277
std::array< IkReal, 9 > mTargetRotation
Cache data for the target rotation used by IKFast.
Definition IkFast.hpp:120
virtual bool computeIk(const IkReal *mTargetTranspose, const IkReal *mTargetRotation, const IkReal *pfree, ikfast::IkSolutionListBase< IkReal > &solutions)=0
Computes the inverse kinematics solutions using the generated IKFast code.
virtual int getIkType() const =0
virtual int getIkRealSize() const =0
auto getDofs() const -> const std::vector< std::size_t > &override
Get a list of the DOFs that will be included in the entries of the solutions returned by getSolutions...
Definition IkFast.cpp:217
bool mConfigured
True if this IkFast is ready to solve.
Definition IkFast.hpp:108
virtual const char * getIkFastVersion()=0
virtual int * getFreeParameters() const =0
std::vector< double > mFreeParams
Definition IkFast.hpp:105
std::vector< std::size_t > mDofs
Indices of the DegreeOfFreedoms associated to the variable parameters of this IkFast.
Definition IkFast.hpp:112
std::vector< std::size_t > mFreeDofs
Indices of the DegreeOfFreedoms associated to the free parameters of this IkFast.
Definition IkFast.hpp:116
virtual int getNumFreeParameters() const =0
virtual void configure() const
Configure IkFast.
Definition IkFast.cpp:242
virtual int getNumJoints() const =0
virtual const char * getKinematicsHash()=0
std::array< IkReal, 3 > mTargetTranspose
Cache data for the target translation used by IKFast.
Definition IkFast.hpp:123
Analytical is a base class that should be inherited by methods that are made to solve the IK analytic...
Definition InverseKinematics.hpp:965
The InverseKinematics class provides a convenient way of setting up an IK optimization problem.
Definition InverseKinematics.hpp:76
Definition BulletCollisionDetector.cpp:63