void CAccess::createGui() { QWidget* pMainWindow = (QWidget*)simGetMainWindow(1); mtbRobotDialog=new CMtbRobotDialog(pMainWindow); // The plugin dialog simAddModuleMenuEntry("",1,&mtbRobotDialog->dialogMenuItemHandle); simSetModuleMenuItemState(mtbRobotDialog->dialogMenuItemHandle,1,"MTB Robot Properties"); }
void CAccess::createGui() { #ifdef _WIN32 // only the Windows version has a dialog! k3Dialog=new CK3Dialog(); // The plugin dialog k3Dialog->Create(IDD_K3_DIALOG,CWnd::FromHandle((HWND)simGetMainWindow(0))); simAddModuleMenuEntry("",1,&k3Dialog->dialogMenuItemHandle); simSetModuleMenuItemState(k3Dialog->dialogMenuItemHandle,1,"Khepera III Properties"); #endif // _WIN32 }
// This is the plugin start routine (called just once, just after the plugin was loaded): VREP_DLLEXPORT unsigned char v_repStart(void* reservedPointer,int reservedInt) { // Dynamically load and bind V-REP functions: // ****************************************** // 1. Figure out this plugin's directory: char curDirAndFile[1024]; #ifdef _WIN32 _getcwd(curDirAndFile, sizeof(curDirAndFile)); #elif defined (__linux) || defined (__APPLE__) getcwd(curDirAndFile, sizeof(curDirAndFile)); #endif std::string currentDirAndPath(curDirAndFile); // 2. Append the V-REP library's name: std::string temp(currentDirAndPath); #ifdef _WIN32 temp+="/v_rep.dll"; #elif defined (__linux) temp+="/libv_rep.so"; #elif defined (__APPLE__) temp+="/libv_rep.dylib"; #endif /* __linux || __APPLE__ */ // 3. Load the V-REP library: vrepLib=loadVrepLibrary(temp.c_str()); if (vrepLib==NULL) { std::cout << "Error, could not find or correctly load the V-REP library. Cannot start 'Collada' plugin.\n"; return(0); // Means error, V-REP will unload this plugin } if (getVrepProcAddresses(vrepLib)==0) { std::cout << "Error, could not find all required functions in the V-REP library. Cannot start 'Collada' plugin.\n"; unloadVrepLibrary(vrepLib); return(0); // Means error, V-REP will unload this plugin } // ****************************************** // Check the version of V-REP: // ****************************************** int vrepVer; simGetIntegerParameter(sim_intparam_program_version,&vrepVer); if (vrepVer<20604) // if V-REP version is smaller than 2.06.04 { std::cout << "Sorry, your V-REP copy is somewhat old. Cannot start 'Collada' plugin.\n"; unloadVrepLibrary(vrepLib); return(0); // Means error, V-REP will unload this plugin } // ****************************************** // Check if V-REP runs in headless mode: // ****************************************** if (simGetBooleanParameter(sim_boolparam_headless)>0) { std::cout << "V-REP runs in headless mode. Cannot start 'Collada' plugin.\n"; unloadVrepLibrary(vrepLib); return(0); // Means error, V-REP will unload this plugin } // ****************************************** QWidget* pMainWindow = (QWidget*)simGetMainWindow(1); colladaDialog=new CColladaDialog(pMainWindow); // The plugin dialog simAddModuleMenuEntry("",1,&colladaDialog->dialogMenuItemHandle); simSetModuleMenuItemState(colladaDialog->dialogMenuItemHandle,1,"COLLADA import/export..."); return(PLUGIN_VERSION); // initialization went fine, we return the version number of this plugin (can be queried with simGetModuleName) }
// This is the plugin start routine (called just once, just after the plugin was loaded): VREP_DLLEXPORT unsigned char v_repStart(void* reservedPointer,int reservedInt) { // Dynamically load and bind V-REP functions: // ****************************************** // 1. Figure out this plugin's directory: char curDirAndFile[1024]; #ifdef _WIN32 _getcwd(curDirAndFile, sizeof(curDirAndFile)); #elif defined (__linux) || defined (__APPLE__) getcwd(curDirAndFile, sizeof(curDirAndFile)); #endif std::string currentDirAndPath(curDirAndFile); // 2. Append the V-REP library's name: std::string temp(currentDirAndPath); #ifdef _WIN32 temp+="/v_rep.dll"; #elif defined (__linux) temp+="/libv_rep.so"; #elif defined (__APPLE__) temp+="/libv_rep.dylib"; #endif /* __linux || __APPLE__ */ // 3. Load the V-REP library: vrepLib=loadVrepLibrary(temp.c_str()); if (vrepLib==NULL) { std::cout << "Error, could not find or correctly load the V-REP library. Cannot start 'Urdf' plugin.\n"; return(0); // Means error, V-REP will unload this plugin } if (getVrepProcAddresses(vrepLib)==0) { std::cout << "Error, could not find all required functions in the V-REP library. Cannot start 'Urdf' plugin.\n"; unloadVrepLibrary(vrepLib); return(0); // Means error, V-REP will unload this plugin } // ****************************************** // Check the version of V-REP: // ****************************************** int vrepVer; simGetIntegerParameter(sim_intparam_program_version,&vrepVer); if (vrepVer<30001) // if V-REP version is smaller than 3.00.01 { std::cout << "Sorry, your V-REP copy is somewhat old. Cannot start 'Urdf' plugin.\n"; unloadVrepLibrary(vrepLib); return(0); // Means error, V-REP will unload this plugin } // ****************************************** // Check if V-REP runs in headless mode: // ****************************************** if (simGetBooleanParameter(sim_boolparam_headless)>0) { std::cout << "V-REP runs in headless mode. Cannot start 'Urdf' plugin.\n"; unloadVrepLibrary(vrepLib); return(0); // Means error, V-REP will unload this plugin } // ****************************************** QWidget* pMainWindow = (QWidget*)simGetMainWindow(1); urdfDialog=new CUrdfDialog(pMainWindow); // The plugin dialog simAddModuleMenuEntry("",1,&urdfDialog->dialogMenuItemHandle); simSetModuleMenuItemState(urdfDialog->dialogMenuItemHandle,1,"URDF import..."); int inputArgsTypes[] = { 10, sim_lua_arg_string, // URDF contents sim_lua_arg_bool, // assign collision links to layer 9 sim_lua_arg_bool, // assign joints to layer 10 sim_lua_arg_bool, // convex decompose sim_lua_arg_bool, // create visual links if none sim_lua_arg_bool, // show convex decomposition dialog sim_lua_arg_bool, // center model above ground sim_lua_arg_bool, // prepare model definition if feasible sim_lua_arg_bool, // alternate local respondable masks sim_lua_arg_bool // enable position control for revolute and prismatic joints }; simRegisterCustomLuaFunction("simExtImportUrdf", "string robot_name=simExtImportUrdf(" "string urdf," "bool hideCollisionLinks," "bool hideJoints," "bool convexDecomposeNonConvexCollidables," "bool createVisualIfNone," "bool showConvexDecompositionDlg," "bool centerAboveGround," "bool makeModel," "bool noSelfCollision," "bool positionCtrl" ")", inputArgsTypes, v_repImportUrdfCallback); int inputArgsTypesFile[] = { 10, sim_lua_arg_string, // filenameAndPath sim_lua_arg_bool, // assign collision links to layer 9 sim_lua_arg_bool, // assign joints to layer 10 sim_lua_arg_bool, // convex decompose sim_lua_arg_bool, // create visual links if none sim_lua_arg_bool, // show convex decomposition dialog sim_lua_arg_bool, // center model above ground sim_lua_arg_bool, // prepare model definition if feasible sim_lua_arg_bool, // alternate local respondable masks sim_lua_arg_bool // enable position control for revolute and prismatic joints }; simRegisterCustomLuaFunction("simExtImportUrdfFile", "string robot_name=simExtImportUrdf(" "string fileAndPath," "bool hideCollisionLinks," "bool hideJoints," "bool convexDecomposeNonConvexCollidables," "bool createVisualIfNone," "bool showConvexDecompositionDlg," "bool centerAboveGround," "bool makeModel," "bool noSelfCollision," "bool positionCtrl" ")", inputArgsTypesFile, v_repImportUrdfCallback); return(PLUGIN_VERSION); // initialization went fine, we return the version number of this plugin (can be queried with simGetModuleName) }