41#ifndef IKFAST_HEADER_COMMON
42#define IKFAST_HEADER_COMMON
45#define IKFAST_VERSION 61
82 virtual void GetSolution(std::vector<T>& solution,
const std::vector<T>& freevalues)
const
85 if (freevalues.empty())
94 virtual const std::vector<int>&
GetFree()
const = 0;
167 for (std::size_t i = 0; i <
_vbasesol.size(); ++i)
173 assert(freevalues !=
nullptr);
175 if (solution[i] >
T(3.14159265358979))
177 solution[i] -=
T(6.28318530717959);
179 else if (solution[i] <
T(-3.14159265358979))
181 solution[i] +=
T(6.28318530717959);
187 void GetSolution(std::vector<T>& solution,
const std::vector<T>& freevalues)
const override
189 solution.resize(
GetDOF());
190 if (freevalues.empty())
201 for (
size_t i = 0; i <
_vbasesol.size(); ++i)
203 if (
_vbasesol[i].maxsolutions == (
unsigned char)-1)
205 throw std::runtime_error(
"max solutions for joint not initialized");
211 throw std::runtime_error(
"index >= max solutions for joint");
215 throw std::runtime_error(
"2nd index >= max solutions for joint");
225 for (
int i = (
int)
_vbasesol.size() - 1; i >= 0; --i)
229 for (
size_t j = 0;
j <
v.size(); ++
j)
233 size_t orgsize =
v.size();
234 if (
_vbasesol[i].indices[1] != (
unsigned char)-1)
236 for (
size_t j = 0;
j < orgsize; ++
j)
241 if (
_vbasesol[i].indices[0] != (
unsigned char)-1)
243 for (
size_t j = 0;
j < orgsize; ++
j)
272 throw std::runtime_error(
"GetSolution index is invalid");
275 std::advance(
it, index);
291#ifdef IKFAST_HAS_LIBRARY
294#ifdef IKFAST_CLIBRARY
296#define IKFAST_API extern "C" __declspec(dllexport)
298#define IKFAST_API extern "C" __attribute__((visibility("default")))
304#ifdef IKFAST_NAMESPACE
305namespace IKFAST_NAMESPACE
310typedef IKFAST_REAL IkReal;
312using IkReal = double;
326IKFAST_API
bool ComputeIk(
const IkReal* eetrans,
332IKFAST_API
void ComputeFk(
const IkReal*
joints, IkReal* eetrans, IkReal* eerot);
355#ifdef IKFAST_NAMESPACE
IKFAST_API int * GetFreeParameters()
Definition: abb_irb2400_ikfast_solver.hpp:380
IKFAST_API int GetNumJoints()
Definition: abb_irb2400_ikfast_solver.hpp:381
IKFAST_API const char * GetIkFastVersion()
Definition: abb_irb2400_ikfast_solver.hpp:3221
IKFAST_API int GetIkRealSize()
Definition: abb_irb2400_ikfast_solver.hpp:383
IKFAST_API const char * GetKinematicsHash()
Definition: abb_irb2400_ikfast_solver.hpp:3216
IKFAST_API int GetIkType()
Definition: abb_irb2400_ikfast_solver.hpp:385
IKFAST_API void ComputeFk(const IkReal *j, IkReal *eetrans, IkReal *eerot)
Definition: abb_irb2400_ikfast_solver.hpp:284
IKFAST_API bool ComputeIk(const IkReal *eetrans, const IkReal *eerot, const IkReal *pfree, IkSolutionListBase< IkReal > &solutions)
Definition: abb_irb2400_ikfast_solver.hpp:3210
IKFAST_API int GetNumFreeParameters()
Definition: abb_irb2400_ikfast_solver.hpp:379
holds function pointers for all the exported functions of ikfast
Definition: ikfast.h:128
GetIkFastVersionFn _GetIkFastVersion
Definition: ikfast.h:145
GetIkTypeFn _GetIkType
Definition: ikfast.h:147
virtual ~IkFastFunctions()=default
int(*)() GetNumJointsFn
Definition: ikfast.h:140
GetFreeParametersFn _GetFreeParameters
Definition: ikfast.h:139
int(*)() GetNumFreeParametersFn
Definition: ikfast.h:136
const char *(*)() GetIkFastVersionFn
Definition: ikfast.h:144
ComputeFkFn _ComputeFk
Definition: ikfast.h:135
GetIkRealSizeFn _GetIkRealSize
Definition: ikfast.h:143
IkFastFunctions()=default
ComputeIkFn _ComputeIk
Definition: ikfast.h:133
GetKinematicsHashFn _GetKinematicsHash
Definition: ikfast.h:149
const char *(*)() GetKinematicsHashFn
Definition: ikfast.h:148
void(*)(const T *, T *, T *) ComputeFkFn
Definition: ikfast.h:134
int(*)() GetIkRealSizeFn
Definition: ikfast.h:142
GetNumJointsFn _GetNumJoints
Definition: ikfast.h:141
int(*)() GetIkTypeFn
Definition: ikfast.h:146
int *(*)() GetFreeParametersFn
Definition: ikfast.h:138
GetNumFreeParametersFn _GetNumFreeParameters
Definition: ikfast.h:137
bool(*)(const T *, const T *, const T *, IkSolutionListBase< T > &) ComputeIkFn
Definition: ikfast.h:132
holds the solution for a single dof
Definition: ikfast.h:52
T foffset
joint value is fmul*sol[freeind]+foffset
Definition: ikfast.h:56
unsigned char jointtype
joint type, 0x01 is revolute, 0x11 is slider
Definition: ikfast.h:58
unsigned char maxsolutions
max possible indices, 0 if controlled by free index or a free joint itself
Definition: ikfast.h:59
unsigned char indices[5]
Definition: ikfast.h:60
IkSingleDOFSolutionBase()
Definition: ikfast.h:54
T fmul
joint value is fmul*sol[freeind]+foffset
Definition: ikfast.h:55
signed char freeind
if >= 0, mimics another joint
Definition: ikfast.h:57
The discrete solutions are returned in this structure.
Definition: ikfast.h:72
virtual const std::vector< int > & GetFree() const =0
Gets the indices of the configuration space that have to be preset before a full solution can be retu...
virtual void GetSolution(std::vector< T > &solution, const std::vector< T > &freevalues) const
std::vector version of GetSolution
Definition: ikfast.h:82
virtual void GetSolution(T *solution, const T *freevalues) const =0
gets a concrete solution
virtual int GetDOF() const =0
the dof of the solution
virtual ~IkSolutionBase()=default
manages all the solutions
Definition: ikfast.h:103
virtual size_t GetNumSolutions() const =0
returns the number of solutions stored
virtual const IkSolutionBase< T > & GetSolution(size_t index) const =0
returns the solution pointer
virtual void Clear()=0
clears all current solutions, note that any memory addresses returned from GetSolution will be invali...
virtual size_t AddSolution(const std::vector< IkSingleDOFSolutionBase< T > > &vinfos, const std::vector< int > &vfree)=0
add one solution and return its index for later retrieval
virtual ~IkSolutionListBase()=default
Default implementation of IkSolutionListBase.
Definition: ikfast.h:259
std::list< IkSolution< T > > _listsolutions
Definition: ikfast.h:284
void Clear() override
clears all current solutions, note that any memory addresses returned from GetSolution will be invali...
Definition: ikfast.h:281
size_t AddSolution(const std::vector< IkSingleDOFSolutionBase< T > > &vinfos, const std::vector< int > &vfree) override
add one solution and return its index for later retrieval
Definition: ikfast.h:261
const IkSolutionBase< T > & GetSolution(size_t index) const override
returns the solution pointer
Definition: ikfast.h:268
size_t GetNumSolutions() const override
returns the number of solutions stored
Definition: ikfast.h:279
Default implementation of IkSolutionBase.
Definition: ikfast.h:157
virtual void Validate() const
Definition: ikfast.h:199
void GetSolution(std::vector< T > &solution, const std::vector< T > &freevalues) const override
std::vector version of GetSolution
Definition: ikfast.h:187
std::vector< int > _vfree
Definition: ikfast.h:253
virtual void GetSolutionIndices(std::vector< unsigned int > &v) const
Definition: ikfast.h:221
IkSolution(const std::vector< IkSingleDOFSolutionBase< T > > &vinfos, const std::vector< int > &vfree)
Definition: ikfast.h:159
int GetDOF() const override
the dof of the solution
Definition: ikfast.h:197
std::vector< IkSingleDOFSolutionBase< T > > _vbasesol
solution and their offsets if joints are mimiced
Definition: ikfast.h:252
const std::vector< int > & GetFree() const override
Gets the indices of the configuration space that have to be preset before a full solution can be retu...
Definition: ikfast.h:196
void GetSolution(T *solution, const T *freevalues) const override
gets a concrete solution
Definition: ikfast.h:165
Definition: polygon_mesh.h:46
auto it
Definition: collision_core_unit.cpp:208
v
Definition: tesseract_common_unit.cpp:369
tesseract_geometry::PolygonMesh T
Definition: tesseract_geometry_unit.cpp:140
JointDynamics j
Definition: tesseract_scene_graph_joint_unit.cpp:15
object joints["j_1"]
Definition: tesseract_scene_graph_serialization_unit.cpp:224