18 #include <boost/log/trivial.hpp> 19 #include <boost/exception/diagnostic_information.hpp> 27 #pragma comment(lib, "Shlwapi.lib") 30 #if defined (__linux) || defined (__APPLE__) 33 #define _stricmp(x,y) strcasecmp(x,y) 36 #define PLUGIN_VERSION 1 41 #define CONCAT(x,y,z) x y z 42 #define strConCat(x,y,z) CONCAT(x,y,z) 43 #define LUA_GET_SENSOR_DATA_COMMAND "simExtSkeleton_getSensorData" 65 BOOST_LOG_TRIVIAL(info) <<
"v_repExtInverseKinematicsController Starting Inverse Kinematics Plugin\n";
73 BOOST_LOG_TRIVIAL(info) <<
"v_repExtInverseKinematicsController Starting Inverse Kinematics Plugin Data Collection\n";
81 BOOST_LOG_TRIVIAL(info) <<
"Ending v_repExtInverseKinematicsController plugin\n";
126 VREP_DLLEXPORT
unsigned char v_repStart(
void* reservedPointer,
int reservedInt)
131 char curDirAndFile[1024];
133 GetModuleFileName(NULL,curDirAndFile,1023);
134 PathRemoveFileSpec(curDirAndFile);
135 #elif defined (__linux) || defined (__APPLE__) 136 getcwd(curDirAndFile,
sizeof(curDirAndFile));
138 std::string currentDirAndPath(curDirAndFile);
140 std::string temp(currentDirAndPath);
143 #elif defined (__linux) 144 temp+=
"/libv_rep.so";
145 #elif defined (__APPLE__) 146 temp+=
"/libv_rep.dylib";
152 BOOST_LOG_TRIVIAL(error) <<
"Error, could not find or correctly load the V-REP library. Cannot start 'PluginSkeleton' plugin.\n";
157 BOOST_LOG_TRIVIAL(error) <<
"Error, could not find all required functions in the V-REP library. Cannot start 'PluginSkeleton' plugin.\n";
169 BOOST_LOG_TRIVIAL(error) <<
"Sorry, your V-REP copy is somewhat old. Cannot start 'PluginSkeleton' plugin.\n";
188 BOOST_LOG_TRIVIAL(info) <<
"Inverse Kinematics plugin initialized. Build date/time: " << __DATE__ <<
" " << __TIME__ <<
"\n";
209 VREP_DLLEXPORT
void*
v_repMessage(
int message,
int* auxiliaryData,
void* customData,
int* replyData)
212 static bool refreshDlgFlag=
true;
235 int flags=auxiliaryData[0];
236 bool sceneContentChanged=((flags&(1+2+4+8+16+32+64+256))!=0);
237 bool instanceSwitched=((flags&64)!=0);
239 if (instanceSwitched)
244 if (sceneContentChanged)
299 }
catch (boost::exception& e){
301 std::string initerr(
"v_repExtInverseKinematicsController plugin initialization error:\n" + boost::diagnostic_information(e));
303 BOOST_LOG_TRIVIAL(error) << initerr;
319 if ( (customData==NULL)||(_stricmp(
"PluginSkeleton",(
char*)customData)==0) )
327 if ( (customData==NULL)||(_stricmp(
"PluginSkeleton",(
char*)customData)==0) )
335 if ( (customData==NULL)||(_stricmp(
"PluginSkeleton",(
char*)customData)==0) )
364 refreshDlgFlag=
false;
void LUA_SIM_EXT_GRL_IK_GET_TRANSFORM(SLuaCallBack *p)
int getVrepProcAddresses(LIBRARY lib)
LIBRARY loadVrepLibrary(const char *pathAndFilename)
void LUA_SIM_EXT_GRL_IK_START(SLuaCallBack *p)
ptrSimSetIntegerParameter simSetIntegerParameter
void LUA_SIM_EXT_GRL_IK_APPLY_TRANSFORM(SLuaCallBack *p)
void LUA_SIM_EXT_GRL_IK_FIND_TRANSFORM(SLuaCallBack *p)
void LUA_SIM_EXT_GRL_IK_RESET(SLuaCallBack *p)
void LUA_SIM_EXT_GRL_IK_ADD_FRAME(SLuaCallBack *p)
ptrSimGetIntegerParameter simGetIntegerParameter
void unloadVrepLibrary(LIBRARY lib)
std::shared_ptr< grl::vrep::InverseKinematicsVrepPlugin > InverseKinematicsControllerPG
ptrSimRegisterCustomLuaFunction simRegisterCustomLuaFunction
VREP_DLLEXPORT unsigned char v_repStart(void *reservedPointer, int reservedInt)
void LUA_SIM_EXT_GRL_IK_RESTORE_SENSOR_POSITION(SLuaCallBack *p)
VREP_DLLEXPORT void v_repEnd()
ptrSimGetSimulationState simGetSimulationState
void LUA_SIM_EXT_GRL_IK_STOP(SLuaCallBack *p)
VREP_DLLEXPORT void * v_repMessage(int message, int *auxiliaryData, void *customData, int *replyData)
ptrSimAddStatusbarMessage simAddStatusbarMessage