3 #include <boost/function.hpp> 4 #include <boost/bind.hpp> 6 #include <coil/stringutil.h> 9 #ifdef CNOID_BODY_CUSTOMIZER 10 #include <cnoid/BodyCustomizerInterface> 17 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) 18 #define DLL_EXPORT __declspec(dllexport) 23 #if defined(HRPMODEL_VERSION_MAJOR) && defined(HRPMODEL_VERSION_MINOR) 24 #if HRPMODEL_VERSION_MAJOR >= 3 && HRPMODEL_VERSION_MINOR >= 1 26 #define NS_HRPMODEL hrp 30 #ifdef CNOID_BODY_CUSTOMIZER 31 #define NS_HRPMODEL cnoid 32 cnoid::Matrix3
trans(
const cnoid::Matrix3& M) {
return M.transpose(); }
39 #define NS_HRPMODEL OpenHRP 45 using namespace boost;
74 std::vector<BushCustomizerParam>
params;
89 static const char* names[] = {
97 std::cerr <<
"[Bush customizer] Bush params" << std::endl;
103 if ( tmp_config.size() != 3 ) {
104 std::cerr <<
"[Bush customizer] Parameter size mismatch (" << i <<
") (" << tmp_config.size() <<
")" << std::endl;
107 int bushIndex =
bodyInterface->getLinkIndexFromName(body, tmp_config[0].c_str());
109 std::cerr <<
"[Bush customizer] No such joint name (" << tmp_config[0] <<
")" << std::endl;
114 p.
name = tmp_config[0];
115 p.
spring = atof(tmp_config[1].c_str());
116 p.
damping= atof(tmp_config[2].c_str());
120 customizer->
params.push_back(p);
121 std::cerr <<
"[Bush customizer] name = " << p.
name <<
", index = " << p.
index <<
", spring = " << p.
spring <<
", damping = " << p.
damping << std::endl;
130 std::cerr <<
"[Bush customizer] Create " << std::string(modelName) << std::endl;
159 for(
int i=0;
i < customizer->
params.size(); ++
i){
171 char* tmpenv =
getenv(
"BUSH_CUSTOMIZER_CONFIG_PATH");
173 std::ifstream
ifs(tmpenv);
175 std::cerr <<
"[Bush customizer] Could not open [" << tmpenv <<
"]" << std::endl;
178 std::cerr <<
"[Bush customizer] Open [" << tmpenv <<
"]" << std::endl;
179 while (std::getline(ifs,tmpstr)) {
181 if (config_params[0] ==
"robot_model_name") {
183 std::cerr <<
"[Bush customizer] robot_model_name = [" <<
robot_model_name <<
"]" << std::endl;
184 }
else if ( config_params[0] ==
"bush_config" ) {
186 std::cerr <<
"[Bush customizer] bush_config = [" << config_params[1] <<
"]" << std::endl;
Modifications controlling boost library behavior.
static const char ** getTargetModelNames()
vstring split(const std::string &input, const std::string &delimiter, bool ignore_empty)
static const int BODY_CUSTOMIZER_INTERFACE_VERSION
OpenHRP::matrix33 Matrix33
bool hasVirtualBushJoints
static coil::vstring bush_config
png_infop png_bytep * trans
std::vector< BushCustomizerParam > params
static BodyInterface * bodyInterface
static void getVirtualbushJoints(BushCustomizer *customizer, BodyHandle body)
std::vector< std::string > vstring
void * BodyCustomizerHandle
double dot(const Vector3 &v1, const Vector3 &v2)
The definitions of the body customizer interface for increasing binary compatibility.
char * getenv(const char *name)
static std::string robot_model_name
DLL_EXPORT NS_HRPMODEL::BodyCustomizerInterface * getHrpBodyCustomizerInterface(NS_HRPMODEL::BodyInterface *bodyInterface_)
static BodyCustomizerHandle create(BodyHandle bodyHandle, const char *modelName)
static void destroy(BodyCustomizerHandle customizerHandle)
static BodyCustomizerInterface bodyCustomizerInterface
static void setVirtualJointForces(BodyCustomizerHandle customizerHandle)