Choreonoid  1.8
BodyCustomizerInterface.h
Go to the documentation of this file.
1 
7 #ifndef CNOID_BODY_BODY_CUSTOMIZER_INTERFACE_H
8 #define CNOID_BODY_BODY_CUSTOMIZER_INTERFACE_H
9 
10 #include <string>
11 #include <cnoid/EigenTypes>
12 #include <cnoid/Config>
13 #include "exportdecl.h"
14 
15 namespace cnoid {
16 
17 typedef void* BodyHandle;
18 typedef void* BodyCustomizerHandle;
19 
20 typedef int (*BodyGetLinkIndexFromNameFunc) (BodyHandle bodyHandle, const char* linkName);
21 typedef const char* (*BodyGetLinkNameFunc) (BodyHandle bodyHandle, int linkIndex);
22 typedef double* (*BodyGetLinkDoubleValuePtrFunc)(BodyHandle bodyHandle, int linkIndex);
23 
24 static const int BODY_INTERFACE_VERSION = 1;
25 
27 {
28  int version;
29 
35 };
36 
37 typedef const char** (*BodyCustomizerGetTargetModelNamesFunc)();
38 typedef BodyCustomizerHandle (*BodyCustomizerCreateFunc)(BodyHandle bodyHandle, const char* modelName);
39 
40 typedef void (*BodyCustomizerDestroyFunc) (BodyCustomizerHandle customizerHandle);
41 typedef int (*BodyCustomizerInitializeAnalyticIkFunc) (BodyCustomizerHandle customizerHandle, int baseLinkIndex, int targetLinkIndex);
42 
43 /*
44  p and R are based on the coordinate of a base link
45 */
46 typedef bool (*BodyCustomizerCalcAnalyticIkFunc) (BodyCustomizerHandle customizerHandle, int ikPathId, const Vector3& p, const Matrix3& R);
47 
49 typedef void (*BodyCustomizerSetVirtualJointForces2Func)(BodyCustomizerHandle customizerHandle, double timeStep);
50 
51 
52 static const int BODY_CUSTOMIZER_INTERFACE_VERSION = 2;
53 
55 {
56  int version;
57 
65 
67  getTargetModelNames(nullptr),
68  create(nullptr),
69  destroy(nullptr),
70  initializeAnalyticIk(nullptr),
71  calcAnalyticIk(nullptr),
72  setVirtualJointForces(nullptr),
73  setVirtualJointForces2(nullptr)
74  { }
75 };
76 
77 typedef BodyCustomizerInterface* (*GetBodyCustomizerInterfaceFunc)(BodyInterface* bodyInterface);
78 
79 CNOID_EXPORT int loadDefaultBodyCustomizers(std::ostream& os);
80 CNOID_EXPORT int loadBodyCustomizers(const std::string pathString, std::ostream& os);
81 
82 CNOID_EXPORT BodyCustomizerInterface* findBodyCustomizer(std::string modelName);
83 }
84 
85 
86 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
87 #define CNOID_BODY_CUSTOMIZER_EXPORT extern "C" __declspec(dllexport)
88 #else
89 #define CNOID_BODY_CUSTOMIZER_EXPORT extern "C"
90 #endif
91 
92 #endif
cnoid::BodyCustomizerInterface::destroy
BodyCustomizerDestroyFunc destroy
Definition: BodyCustomizerInterface.h:60
cnoid::BodyHandle
void * BodyHandle
Definition: BodyCustomizerInterface.h:17
cnoid::BodyCustomizerSetVirtualJointForces2Func
void(* BodyCustomizerSetVirtualJointForces2Func)(BodyCustomizerHandle customizerHandle, double timeStep)
Definition: BodyCustomizerInterface.h:49
cnoid::BodyCustomizerCalcAnalyticIkFunc
bool(* BodyCustomizerCalcAnalyticIkFunc)(BodyCustomizerHandle customizerHandle, int ikPathId, const Vector3 &p, const Matrix3 &R)
Definition: BodyCustomizerInterface.h:46
cnoid::Vector3
Eigen::Vector3d Vector3
Definition: EigenTypes.h:57
cnoid::BodyInterface::getJointValuePtr
BodyGetLinkDoubleValuePtrFunc getJointValuePtr
Definition: BodyCustomizerInterface.h:32
cnoid::findBodyCustomizer
CNOID_EXPORT BodyCustomizerInterface * findBodyCustomizer(std::string modelName)
Definition: BodyCustomizerInterface.cpp:205
cnoid::BodyCustomizerInitializeAnalyticIkFunc
int(* BodyCustomizerInitializeAnalyticIkFunc)(BodyCustomizerHandle customizerHandle, int baseLinkIndex, int targetLinkIndex)
Definition: BodyCustomizerInterface.h:41
cnoid::Matrix3
Eigen::Matrix3d Matrix3
Definition: EigenTypes.h:56
cnoid::BodyCustomizerInterface::BodyCustomizerInterface
BodyCustomizerInterface()
Definition: BodyCustomizerInterface.h:66
cnoid::BodyInterface::version
int version
Definition: BodyCustomizerInterface.h:28
cnoid::loadBodyCustomizers
CNOID_EXPORT int loadBodyCustomizers(const std::string pathString, std::ostream &os)
Definition: BodyCustomizerInterface.cpp:158
cnoid::BodyCustomizerGetTargetModelNamesFunc
const typedef char **(* BodyCustomizerGetTargetModelNamesFunc)()
Definition: BodyCustomizerInterface.h:37
cnoid::BodyCustomizerInterface::initializeAnalyticIk
BodyCustomizerInitializeAnalyticIkFunc initializeAnalyticIk
Definition: BodyCustomizerInterface.h:61
cnoid::BodyCustomizerCreateFunc
BodyCustomizerHandle(* BodyCustomizerCreateFunc)(BodyHandle bodyHandle, const char *modelName)
Definition: BodyCustomizerInterface.h:38
cnoid::BodyCustomizerInterface
Definition: BodyCustomizerInterface.h:54
cnoid::BodyInterface
Definition: BodyCustomizerInterface.h:26
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::BodyGetLinkIndexFromNameFunc
int(* BodyGetLinkIndexFromNameFunc)(BodyHandle bodyHandle, const char *linkName)
Definition: BodyCustomizerInterface.h:20
cnoid::BodyInterface::getLinkIndexFromName
BodyGetLinkIndexFromNameFunc getLinkIndexFromName
Definition: BodyCustomizerInterface.h:30
cnoid::BodyCustomizerInterface::getTargetModelNames
BodyCustomizerGetTargetModelNamesFunc getTargetModelNames
Definition: BodyCustomizerInterface.h:58
cnoid::BodyInterface::getJointForcePtr
BodyGetLinkDoubleValuePtrFunc getJointForcePtr
Definition: BodyCustomizerInterface.h:34
cnoid::loadDefaultBodyCustomizers
CNOID_EXPORT int loadDefaultBodyCustomizers(std::ostream &os)
Definition: BodyCustomizerInterface.cpp:193
cnoid::BodyGetLinkDoubleValuePtrFunc
double *(* BodyGetLinkDoubleValuePtrFunc)(BodyHandle bodyHandle, int linkIndex)
Definition: BodyCustomizerInterface.h:22
cnoid::BodyCustomizerInterface::calcAnalyticIk
BodyCustomizerCalcAnalyticIkFunc calcAnalyticIk
Definition: BodyCustomizerInterface.h:62
cnoid::BodyCustomizerHandle
void * BodyCustomizerHandle
Definition: Body.h:23
cnoid::BodyCustomizerInterface::create
BodyCustomizerCreateFunc create
Definition: BodyCustomizerInterface.h:59
cnoid::BodyCustomizerInterface::version
int version
Definition: BodyCustomizerInterface.h:56
cnoid::BodyCustomizerInterface::setVirtualJointForces
BodyCustomizerSetVirtualJointForcesFunc setVirtualJointForces
Definition: BodyCustomizerInterface.h:63
cnoid::BodyCustomizerSetVirtualJointForcesFunc
void(* BodyCustomizerSetVirtualJointForcesFunc)(BodyCustomizerHandle customizerHandle)
Definition: BodyCustomizerInterface.h:48
cnoid::BodyCustomizerDestroyFunc
void(* BodyCustomizerDestroyFunc)(BodyCustomizerHandle customizerHandle)
Definition: BodyCustomizerInterface.h:40
cnoid::BodyCustomizerInterface::setVirtualJointForces2
BodyCustomizerSetVirtualJointForces2Func setVirtualJointForces2
Definition: BodyCustomizerInterface.h:64
cnoid::BodyInterface::getLinkName
BodyGetLinkNameFunc getLinkName
Definition: BodyCustomizerInterface.h:31
cnoid::BodyInterface::getJointVelocityPtr
BodyGetLinkDoubleValuePtrFunc getJointVelocityPtr
Definition: BodyCustomizerInterface.h:33
cnoid::BodyGetLinkNameFunc
const typedef char *(* BodyGetLinkNameFunc)(BodyHandle bodyHandle, int linkIndex)
Definition: BodyCustomizerInterface.h:21