Go to the documentation of this file.
39 #ifndef IKFAST_HEADER_COMMON
40 #define IKFAST_HEADER_COMMON
43 #define IKFAST_VERSION 61
78 virtual void GetSolution(T* solution,
const T* freevalues)
const = 0;
81 virtual void GetSolution(std::vector<T>& solution,
const std::vector<T>& freevalues)
const
84 GetSolution(&solution.at(0), freevalues.size() > 0 ? &freevalues.at(0) : NULL);
90 virtual const std::vector<int>&
GetFree()
const = 0;
93 virtual const int GetDOF()
const = 0;
118 virtual void Clear() = 0;
122 template <
typename T>
145 typedef int* (*GetFreeParametersFn)();
151 typedef const char* (*GetIkFastVersionFn)();
155 typedef const char* (*GetKinematicsHashFn)();
162 template <
typename T>
174 for (std::size_t i = 0; i <
_vbasesol.size(); ++i)
181 if (solution[i] > T(3.14159265358979))
183 solution[i] -= T(6.28318530717959);
185 else if (solution[i] < T(-3.14159265358979))
187 solution[i] += T(6.28318530717959);
193 virtual void GetSolution(std::vector<T>& solution,
const std::vector<T>& freevalues)
const
195 solution.resize(
GetDOF());
196 GetSolution(&solution.at(0), freevalues.size() > 0 ? &freevalues.at(0) : NULL);
204 for (
size_t i = 0; i <
_vbasesol.size(); ++i)
206 if (
_vbasesol[i].maxsolutions == (
unsigned char)-1)
208 throw std::runtime_error(
"max solutions for joint not initialized");
214 throw std::runtime_error(
"index >= max solutions for joint");
218 throw std::runtime_error(
"2nd index >= max solutions for joint");
228 for (
int i = (
int)
_vbasesol.size() - 1; i >= 0; --i)
232 for (
size_t j = 0; j < v.size(); ++j)
236 size_t orgsize = v.size();
237 if (
_vbasesol[i].indices[1] != (
unsigned char)-1)
239 for (
size_t j = 0; j < orgsize; ++j)
241 v.push_back(v[j] +
_vbasesol[i].indices[1]);
244 if (
_vbasesol[i].indices[0] != (
unsigned char)-1)
246 for (
size_t j = 0; j < orgsize; ++j)
260 template <
typename T>
275 throw std::runtime_error(
"GetSolution index is invalid");
277 typename std::list<IkSolution<T> >::const_iterator it =
_listsolutions.begin();
278 std::advance(it, index);
292 #endif // OPENRAVE_IKFAST_HEADER
295 #ifdef IKFAST_HAS_LIBRARY
298 #ifdef IKFAST_CLIBRARY
300 #define IKFAST_API extern "C" __declspec(dllexport)
302 #define IKFAST_API extern "C"
308 #ifdef IKFAST_NAMESPACE
309 namespace IKFAST_NAMESPACE
314 typedef IKFAST_REAL IkReal;
316 typedef double IkReal;
330 IKFAST_API
bool ComputeIk(
const IkReal* eetrans,
336 IKFAST_API
void ComputeFk(
const IkReal* joints, IkReal* eetrans, IkReal* eerot);
359 #ifdef IKFAST_NAMESPACE
363 #endif // IKFAST_HAS_LIBRARY
unsigned char jointtype
joint type, 0x01 is revolute, 0x11 is slider
Default implementation of IkSolutionListBase.
virtual const IkSolutionBase< T > & GetSolution(size_t index) const =0
returns the solution pointer
GetIkFastVersionFn _GetIkFastVersion
IkSingleDOFSolutionBase()
void(* ComputeFkFn)(const T *, T *, T *)
IKFAST_API bool ComputeIk(const IkReal *eetrans, const IkReal *eerot, const IkReal *pfree, IkSolutionListBase< IkReal > &solutions)
GetFreeParametersFn _GetFreeParameters
const IKFAST_API char * GetIkFastVersion()
virtual size_t GetNumSolutions() const
returns the number of solutions stored
std::vector< int > _vfree
virtual void GetSolutionIndices(std::vector< unsigned int > &v) const
virtual void GetSolution(T *solution, const T *freevalues) const =0
gets a concrete solution
T foffset
joint value is fmul*sol[freeind]+foffset
unsigned char maxsolutions
max possible indices, 0 if controlled by free index or a free joint itself
manages all the solutions
virtual size_t AddSolution(const std::vector< IkSingleDOFSolutionBase< T > > &vinfos, const std::vector< int > &vfree)
add one solution and return its index for later retrieval
GetKinematicsHashFn _GetKinematicsHash
virtual size_t GetNumSolutions() const =0
returns the number of solutions stored
IKFAST_API int GetNumFreeParameters()
int(* GetNumFreeParametersFn)()
holds the solution for a single dof
holds function pointers for all the exported functions of ikfast
GetNumFreeParametersFn _GetNumFreeParameters
virtual const std::vector< int > & GetFree() const
Gets the indices of the configuration space that have to be preset before a full solution can be retu...
virtual const int GetDOF() const =0
the dof of the solution
virtual ~IkSolutionBase()
IKFAST_API void ComputeFk(const IkReal *j, IkReal *eetrans, IkReal *eerot)
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 void Validate() const
IKFAST_API int GetNumJoints()
virtual const IkSolutionBase< T > & GetSolution(size_t index) const
returns the solution pointer
virtual void GetSolution(T *solution, const T *freevalues) const
gets a concrete solution
const typedef char *(* GetIkFastVersionFn)()
const IKFAST_API char * GetKinematicsHash()
GetNumJointsFn _GetNumJoints
The discrete solutions are returned in this structure.
virtual ~IkSolutionListBase()
std::list< IkSolution< T > > _listsolutions
virtual void Clear()=0
clears all current solutions, note that any memory addresses returned from GetSolution will be invali...
IKFAST_API int * GetFreeParameters()
GetIkRealSizeFn _GetIkRealSize
virtual ~IkFastFunctions()
const typedef char *(* GetKinematicsHashFn)()
virtual const int GetDOF() const
the dof of the solution
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
IKFAST_API int GetIkRealSize()
std::vector< IkSingleDOFSolutionBase< T > > _vbasesol
solution and their offsets if joints are mimiced
IkSolution(const std::vector< IkSingleDOFSolutionBase< T > > &vinfos, const std::vector< int > &vfree)
IKFAST_API int GetIkType()
signed char freeind
if >= 0, mimics another joint
Default implementation of IkSolutionBase.
bool(* ComputeIkFn)(const T *, const T *, const T *, IkSolutionListBase< T > &)
int *(* GetFreeParametersFn)()
virtual void GetSolution(std::vector< T > &solution, const std::vector< T > &freevalues) const
std::vector version of GetSolution
virtual void Clear()
clears all current solutions, note that any memory addresses returned from GetSolution will be invali...
opw_kinematics
Author(s): Jon Meyer
, Jeroen De Maeyer
autogenerated on Thu Jan 16 2025 03:40:37