26 #pragma comment(lib, "Shlwapi.lib") 29 #if defined (__linux) || defined (__APPLE__) 32 #define _stricmp(x,y) strcasecmp(x,y) 35 #define PLUGIN_VERSION 1 40 #define CONCAT(x,y,z) x y z 41 #define strConCat(x,y,z) CONCAT(x,y,z) 42 #define LUA_GET_SENSOR_DATA_COMMAND "simExtSkeleton_getSensorData" 57 std::string
LUA_SIM_EXT_PIVOT_CALIB_START_CALL_TIP(
"number result=simExtPivotCalibStart(string ToolTipToModifyName, string ToolTipToMeasureName, string ToolBaseToModifyName, string ToolBaseToMeasureName)");
64 BOOST_LOG_TRIVIAL(info) <<
"v_repExtPivotCalibration Starting Pivot Calibration Plugin Data Collection\n";
70 std::vector<CLuaFunctionDataItem>* inData=data.
getInDataPtr();
71 std::string ToolTipModifyName((inData->at(0 ).stringData[0]));
72 std::string ToolTipMeasureName((inData->at(1 ).stringData[0]));
73 std::string ToolBaseModifyName((inData->at(0 ).stringData[0]));
74 std::string ToolBaseMeasureName((inData->at(2 ).stringData[0]));
76 std::make_tuple(ToolTipModifyName , ToolTipMeasureName, ToolBaseModifyName, ToolBaseMeasureName)
102 BOOST_LOG_TRIVIAL(info) <<
"v_repExtPivotCalibration Setting Algorithm\n";
108 std::vector<CLuaFunctionDataItem>* inData=data.
getInDataPtr();
109 std::string AlgorithmName((inData->at(0 ).stringData[0]));
121 BOOST_LOG_TRIVIAL(info) <<
"v_repExtPivotCalibration Starting Pivot Calibration Plugin Data Collection\n";
129 BOOST_LOG_TRIVIAL(info) <<
"Ending v_repExtPivotCalibration plugin\n";
174 VREP_DLLEXPORT
unsigned char v_repStart(
void* reservedPointer,
int reservedInt)
179 char curDirAndFile[1024];
181 GetModuleFileName(NULL,curDirAndFile,1023);
182 PathRemoveFileSpec(curDirAndFile);
183 #elif defined (__linux) || defined (__APPLE__) 184 getcwd(curDirAndFile,
sizeof(curDirAndFile));
186 std::string currentDirAndPath(curDirAndFile);
188 std::string temp(currentDirAndPath);
191 #elif defined (__linux) 192 temp+=
"/libv_rep.so";
193 #elif defined (__APPLE__) 194 temp+=
"/libv_rep.dylib";
200 BOOST_LOG_TRIVIAL(error) <<
"Error, could not find or correctly load the V-REP library. Cannot start 'PluginSkeleton' plugin.\n";
205 BOOST_LOG_TRIVIAL(error) <<
"Error, could not find all required functions in the V-REP library. Cannot start 'PluginSkeleton' plugin.\n";
217 BOOST_LOG_TRIVIAL(error) <<
"Sorry, your V-REP copy is somewhat old. Cannot start 'PluginSkeleton' plugin.\n";
237 BOOST_LOG_TRIVIAL(info) <<
"Pivot Calibration plugin initialized. Build date/time: " << __DATE__ <<
" " << __TIME__ <<
"\n";
258 VREP_DLLEXPORT
void*
v_repMessage(
int message,
int* auxiliaryData,
void* customData,
int* replyData)
261 static bool refreshDlgFlag=
true;
284 int flags=auxiliaryData[0];
285 bool sceneContentChanged=((flags&(1+2+4+8+16+32+64+256))!=0);
286 bool instanceSwitched=((flags&64)!=0);
288 if (instanceSwitched)
293 if (sceneContentChanged)
346 }
catch (boost::exception& e){
348 std::string initerr(
"v_repExtPivotCalibration plugin initialization error:\n" + boost::diagnostic_information(e));
350 BOOST_LOG_TRIVIAL(error) << initerr;
366 if ( (customData==NULL)||(_stricmp(
"PluginSkeleton",(
char*)customData)==0) )
374 if ( (customData==NULL)||(_stricmp(
"PluginSkeleton",(
char*)customData)==0) )
382 if ( (customData==NULL)||(_stricmp(
"PluginSkeleton",(
char*)customData)==0) )
411 refreshDlgFlag=
false;
int getVrepProcAddresses(LIBRARY lib)
LIBRARY loadVrepLibrary(const char *pathAndFilename)
void LUA_SIM_EXT_PIVOT_CALIB_RESTORE_SENSOR_POSITION(SLuaCallBack *p)
bool readDataFromLua(const SLuaCallBack *p, const int *expectedArguments, int requiredArgumentCount, const char *functionName)
void LUA_SIM_EXT_PIVOT_CALIB_FIND_TRANSFORM(SLuaCallBack *p)
ptrSimSetIntegerParameter simSetIntegerParameter
void LUA_SIM_EXT_PIVOT_CALIB_RESET(SLuaCallBack *p)
void LUA_SIM_EXT_PIVOT_CALIB_STOP(SLuaCallBack *p)
const int inArgs_PIVOT_CALIB_START[]
void LUA_SIM_EXT_PIVOT_CALIB_GET_TRANSFORM(SLuaCallBack *p)
const int inArgs_PIVOT_CALIB_ALGORITHM[]
VREP_DLLEXPORT unsigned char v_repStart(void *reservedPointer, int reservedInt)
ptrSimGetIntegerParameter simGetIntegerParameter
void unloadVrepLibrary(LIBRARY lib)
VREP_DLLEXPORT void v_repEnd()
void LUA_SIM_EXT_PIVOT_CALIB_START(SLuaCallBack *p)
std::string LUA_SIM_EXT_PIVOT_CALIB_START_CALL_TIP("number result=simExtPivotCalibStart(string ToolTipToModifyName, string ToolTipToMeasureName, string ToolBaseToModifyName, string ToolBaseToMeasureName)")
ptrSimRegisterCustomLuaFunction simRegisterCustomLuaFunction
VREP_DLLEXPORT void * v_repMessage(int message, int *auxiliaryData, void *customData, int *replyData)
std::shared_ptr< grl::PivotCalibrationVrepPlugin > pivotCalibrationPG
std::string LUA_SIM_EXT_PIVOT_CALIB_ALGORITHM_CALL_TIP("number result=simExtPivotCalibAlgorithm(string AlgorithmName) -- Algorithm options are TWO_STEP_PROCEDURE and COMBINATORICAL_APPROACH")
void LUA_SIM_EXT_PIVOT_CALIB_APPLY_TRANSFORM(SLuaCallBack *p)
ptrSimGetSimulationState simGetSimulationState
std::vector< CLuaFunctionDataItem > * getInDataPtr()
void LUA_SIM_EXT_PIVOT_CALIB_ALGORITHM(SLuaCallBack *p)
void LUA_SIM_EXT_PIVOT_CALIB_ADD_FRAME(SLuaCallBack *p)
ptrSimAddStatusbarMessage simAddStatusbarMessage