From e2d65bf237c3811c1b15c1f6b84e3a1497e31405 Mon Sep 17 00:00:00 2001 From: jgvictores Date: Fri, 12 Jan 2018 23:46:09 +0100 Subject: [PATCH 1/3] EOL of teoSim in openrave-yarp-plugins, for #27 --- CMakeLists.txt | 2 +- programs/CMakeLists.txt | 2 +- programs/teoSim/CMakeLists.txt | 55 ----- programs/teoSim/ControlboardContainer.cpp | 88 ------- programs/teoSim/ControlboardContainer.hpp | 61 ----- programs/teoSim/TeoSim.cpp | 278 ---------------------- programs/teoSim/TeoSim.hpp | 116 --------- programs/teoSim/TeoSimRateThread.cpp | 151 ------------ programs/teoSim/TeoSimRateThread.hpp | 146 ------------ programs/teoSim/main.cpp | 90 ------- share/CMakeLists.txt | 2 +- share/teoSim/CMakeLists.txt | 12 - share/teoSim/conf/teoSim.ini | 19 -- 13 files changed, 3 insertions(+), 1019 deletions(-) delete mode 100644 programs/teoSim/CMakeLists.txt delete mode 100644 programs/teoSim/ControlboardContainer.cpp delete mode 100644 programs/teoSim/ControlboardContainer.hpp delete mode 100644 programs/teoSim/TeoSim.cpp delete mode 100644 programs/teoSim/TeoSim.hpp delete mode 100644 programs/teoSim/TeoSimRateThread.cpp delete mode 100644 programs/teoSim/TeoSimRateThread.hpp delete mode 100644 programs/teoSim/main.cpp delete mode 100644 share/teoSim/CMakeLists.txt delete mode 100644 share/teoSim/conf/teoSim.ini diff --git a/CMakeLists.txt b/CMakeLists.txt index 0244c51e..f5201077 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,7 @@ option(ENABLE_YarpOpenraveRGBDSensor "Enable/disable option YarpOpenraveRGBDSen option(ENABLE_YarpOpenraveRobotManager "Enable/disable option YarpOpenraveRobotManager" TRUE) ### options: cpp programs -option(ENABLE_teoSim "Choose if you want to compile (deprecated) teoSim" TRUE) +#option(ENABLE_exampleProgram "Choose if you want to compile exampleProgram" TRUE) if(MSVC) diff --git a/programs/CMakeLists.txt b/programs/CMakeLists.txt index 742c07fd..c0f617c8 100644 --- a/programs/CMakeLists.txt +++ b/programs/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright: Universidad Carlos III de Madrid (C) 2013 # Authors: Juan G. Victores -add_subdirectory(teoSim) +#add_subdirectory(exampleProgram) diff --git a/programs/teoSim/CMakeLists.txt b/programs/teoSim/CMakeLists.txt deleted file mode 100644 index 212b9516..00000000 --- a/programs/teoSim/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ -# - -cmake_minimum_required (VERSION 2.6.0) - -IF (ENABLE_teoSim) - -set(KEYWORD "teoSim") - -# Start a project. -project(${KEYWORD}) - -#set(CMAKE_BUILD_TYPE Debug)#RelWithDebInfo) -FIND_PACKAGE(OpenRAVE REQUIRED) -FIND_PACKAGE(YARP REQUIRED) - -# Search for source code. -file(GLOB folder_source *.cpp *.cc *.c) -file(GLOB folder_header *.h *.hpp) -source_group("Source Files" FILES ${folder_source}) -source_group("Header Files" FILES ${folder_header}) - -# Automatically add include directories if needed. -foreach(header_file ${folder_header}) - get_filename_component(p ${header_file} PATH) - include_directories(${p}) -endforeach(header_file ${folder_header}) - -if( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX ) - add_definitions("-fno-strict-aliasing -Wall") -endif( CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX ) - -find_package(Boost COMPONENTS iostreams python thread system) - -include_directories(${OPENRAVE_YARP_PLUGINS_INCLUDE_DIRS} ${OpenRAVE_INCLUDE_DIRS} ${YARP_INCLUDE_DIRS}) -if( Boost_INCLUDE_DIRS ) - include_directories(${Boost_INCLUDE_DIRS}) -endif() - -link_directories(${OPENRAVE_YARP_PLUGINS_LINK_DIRS}) - -# Set up our main executable. -if (folder_source) - add_executable(${KEYWORD} ${folder_source} ${folder_header}) - add_dependencies(${KEYWORD} COLOR_DEBUG) - set_target_properties(${KEYWORD} PROPERTIES COMPILE_FLAGS "${OpenRAVE_CXXFLAGS}") - set_target_properties(${KEYWORD} PROPERTIES LINK_FLAGS "${OpenRAVE_LINK_FLAGS}") - target_link_libraries(${KEYWORD} ${OpenRAVE_LIBRARIES} ${OpenRAVE_CORE_LIBRARIES} ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${YARP_LIBRARIES}) -# target_link_libraries(${KEYWORD} ${OpenRAVE_LIBRARIES} ${OpenRAVE_CORE_LIBRARIES} ${Boost_THREAD_LIBRARY} ${YARP_LIBRARIES}) - install(TARGETS ${KEYWORD} DESTINATION bin ) -else (folder_source) - message(FATAL_ERROR "No source code files found. Please add something") -endif (folder_source) - -ENDIF (ENABLE_teoSim) - diff --git a/programs/teoSim/ControlboardContainer.cpp b/programs/teoSim/ControlboardContainer.cpp deleted file mode 100644 index 02a69e64..00000000 --- a/programs/teoSim/ControlboardContainer.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- - -#include "ControlboardContainer.hpp" - -// ----------------------------------------------------------------------------- - -const int roboticslab::ControlboardContainer::getFatherRobotIdx() { - return fatherRobotIdx; -} - -// ----------------------------------------------------------------------------- - - std::vector& roboticslab::ControlboardContainer::getVectorOfJointIdxRef() { - return vectorOfJointIdx; -} - - // ----------------------------------------------------------------------------- - - std::vector& roboticslab::ControlboardContainer::getVectorOfJointTrRef() { - return vectorOfJointTr; - } - - // ----------------------------------------------------------------------------- - - std::vector& roboticslab::ControlboardContainer::getVectorOfJointPosRef() { - if(encs) { - double vals[vectorOfJointIdx.size()]; - encs->getEncoders(vals); - for(size_t i=0; i < this->vectorOfJointIdx.size(); i++) - vectorOfJointPos[i] = vals[i]; - } else { - CD_WARNING("No encs yet.\n") - } - return vectorOfJointPos; -} -// ----------------------------------------------------------------------------- - -void roboticslab::ControlboardContainer::setFatherRobotIdx(int value) { - fatherRobotIdx = value; -} - -// ----------------------------------------------------------------------------- - -void roboticslab::ControlboardContainer::setManipulatorWrapperName(const std::string &value) { - manipulatorWrapperName = value; -} - -// ----------------------------------------------------------------------------- - -void roboticslab::ControlboardContainer::push_back(int robotJointIdx) { - vectorOfJointIdx.push_back( robotJointIdx ); -} - -// ----------------------------------------------------------------------------- - -void roboticslab::ControlboardContainer::push_back_tr(double robotJointTr) { - vectorOfJointTr.push_back( robotJointTr ); -} - -// ----------------------------------------------------------------------------- - -bool roboticslab::ControlboardContainer::start() { - vectorOfJointPos.resize( this->vectorOfJointIdx.size() ); - yarp::os::Property options; - options.put("device","controlboardwrapper2"); // - options.put("subdevice","FakeControlboard"); // FakeControlboard provides more interfaces than test_motor - options.put("axes", (int)this->vectorOfJointIdx.size() ); - options.put("name", this->manipulatorWrapperName ); - - dd.open(options); - if(!dd.isValid()) { - CD_ERROR("ManipulatorWrapper device \"%s\" not available.\n", options.find("subdevice").asString().c_str()); - dd.close(); - return false; - } - dd.view(encs); - - return true; -} - -// ----------------------------------------------------------------------------- - -bool roboticslab::ControlboardContainer::stop() { - dd.close(); - return true; -} - -// ----------------------------------------------------------------------------- diff --git a/programs/teoSim/ControlboardContainer.hpp b/programs/teoSim/ControlboardContainer.hpp deleted file mode 100644 index a1ea70a3..00000000 --- a/programs/teoSim/ControlboardContainer.hpp +++ /dev/null @@ -1,61 +0,0 @@ -// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- - -#ifndef __CONTROLBOARD_CONTAINER_HPP__ -#define __CONTROLBOARD_CONTAINER_HPP__ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "ColorDebug.hpp" - -namespace roboticslab -{ - -/** - * @ingroup teoSim - * - * @brief Helper class, contains a controlboard that should correspond to a given manipulator. - */ -class ControlboardContainer { - - public: - - bool start(); - bool stop(); - void setFatherRobotIdx(int value); - void setManipulatorWrapperName(const std::string &value); - void push_back(int robotJointIdx); - void push_back_tr(double robotJointTr); - - const int getFatherRobotIdx(); - std::vector& getVectorOfJointIdxRef(); - std::vector& getVectorOfJointPosRef(); - std::vector& getVectorOfJointTrRef(); - - - -protected: - - int fatherRobotIdx; - std::vector vectorOfJointIdx; - std::vector vectorOfJointPos; - std::vector vectorOfJointTr; - yarp::dev::PolyDriver dd; - yarp::dev::IEncoders *encs; - std::string manipulatorWrapperName; - -}; - -} // namsepace teo - -#endif // __CONTROLBOARD_CONTAINER_HPP__ - diff --git a/programs/teoSim/TeoSim.cpp b/programs/teoSim/TeoSim.cpp deleted file mode 100644 index 04b748f4..00000000 --- a/programs/teoSim/TeoSim.cpp +++ /dev/null @@ -1,278 +0,0 @@ -// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- - -#include "TeoSim.hpp" - -void SetViewer(OpenRAVE::EnvironmentBasePtr penv, const std::string& viewername, int _viewer); - -// ------------------- RFModule Related ------------------------------------ - -bool roboticslab::TeoSim::configure(yarp::os::ResourceFinder &rf) { - - const double defautTr = M_PI/180.0; - std::string env = DEFAULT_ENV; - double jmcMs = DEFAULT_TEO_SIM_MS; - std::string physics = DEFAULT_PHYSICS; - int viewer = DEFAULT_VIEWER; - - if(rf.check("help")) { - printf("TeoSim options:\n"); - printf("\t--help (this help)\t--from [file.ini]\t--context [path]\n"); - - printf("\t--env [xml] (env name within context, default: \"%s\")\n",env.c_str()); - printf("\t--physics [type] (type of physics, default: \"%s\")\n",physics.c_str()); - printf("\t--viewer [type] (set to 0 for none, default: \"%d\")\n",viewer); - } - - if (rf.check("env")) env = rf.find("env").asString(); - if (rf.check("jmcMs")) jmcMs = rf.find("jmcMs").asDouble(); - if (rf.check("physics")) physics = rf.find("physics").asString(); - if (rf.check("viewer")) viewer = rf.find("viewer").asInt(); - - printf("TeoSim using context: %s.\n",rf.getContext().c_str()); - printf("TeoSim using env: %s, jmcMs: %f, physics: %s, viewer: %d.\n", env.c_str(), jmcMs, physics.c_str(), viewer); - - if(rf.check("help")) { - ::exit(1); - } - - // Initialize OpenRAVE-core - OpenRAVE::RaveInitialize(true); // Start openrave core - environmentPtr = OpenRAVE::RaveCreateEnvironment(); // Create the main OpenRAVE environment, set the EnvironmentBasePtr - environmentPtr->SetDebugLevel(OpenRAVE::Level_Debug); // Relatively new function - environmentPtr->StopSimulation(); // NEEDED?? - boost::thread thviewer(boost::bind(SetViewer,environmentPtr,"qtcoin",viewer)); - orThreads.add_thread(&thviewer); - yarp::os::Time::delay(0.4); // wait for the viewer to init, in [s] - - std::string envFull( rf.findFileByName(env) ); - if (! environmentPtr->Load(envFull.c_str()) ) { - CD_ERROR("Could not load environment: %s\n",envFull.c_str()); - return false; - } - CD_SUCCESS("Loaded environment: %s\n",envFull.c_str()); - //CD_DEBUG("penv %p\n",environmentPtr.get()); - - // Attach a physics engine - if(physics=="ode"){ - environmentPtr->SetPhysicsEngine(RaveCreatePhysicsEngine(environmentPtr,"ode")); - environmentPtr->GetPhysicsEngine()->SetGravity(OpenRAVE::Vector(0,0,-9.8)); - } - - //-- Get robots - environmentPtr->GetRobots(vectorOfRobotPtr); - //-- For each robot - for(size_t robotPtrIdx=0;robotPtrIdxGetName().c_str()); - //-- Get manupilators - std::vector vectorOfManipulatorPtr = vectorOfRobotPtr[robotPtrIdx]->GetManipulators(); - //-- For each manipulator - for(size_t j=0;jGetName().c_str() ); - //-- Formulate the manipulator port name - yarp::os::ConstString manipulatorPortName("/"); - manipulatorPortName += vectorOfRobotPtr[robotPtrIdx]->GetName(); - manipulatorPortName += "/"; - manipulatorPortName += vectorOfManipulatorPtr[j]->GetName(); - CD_INFO( "* manipulatorPortName: %s\n",manipulatorPortName.c_str() ); - //-- Create the manipulator wrapper object - size_t index = vectorOfControlboardContainerPtr.size(); - vectorOfControlboardContainerPtr.push_back( new ControlboardContainer() ); //! \todo Delete objects stored in vectorOfManipulatorWrapperPtr - //-- Give it its name - vectorOfControlboardContainerPtr[index]->setManipulatorWrapperName(manipulatorPortName); - //-- Give it its father's index - vectorOfControlboardContainerPtr[index]->setFatherRobotIdx(robotPtrIdx); - //-- Check if there are overrides - if(rf.check(manipulatorPortName)) { - yarp::os::Bottle manipulatorDescription = rf.findGroup(manipulatorPortName).tail(); - yarp::os::Bottle manipulatorIDs = manipulatorDescription.findGroup("IDs").tail(); - for(int i = 0; ipush_back( manipulatorIDs.get(i).asInt() ); - } - CD_INFO( "* Using overriden IDs: %s.\n",manipulatorIDs.toString().c_str()); - if (manipulatorDescription.check("TRs")){ - yarp::os::Bottle manipulatorTRs = manipulatorDescription.findGroup("TRs").tail(); - for(int i = 0; ipush_back_tr( manipulatorTRs.get(i).asDouble() ); - } - CD_INFO( "* Using overriden TRs: %s.\n",manipulatorTRs.toString().c_str()); - } else { - for(int i = 0; ipush_back_tr( defautTr ); - }CD_INFO( "* Using default general TR: %f.\n", defautTr); - } - } else { //-- Use existing IDs otherwise - std::vector< int > manipulatorIDs = vectorOfManipulatorPtr[j]->GetArmIndices(); - CD_INFO( "* Using xml IDs: "); - for(size_t i=0;ipush_back( (int)manipulatorIDs[i] ); - vectorOfControlboardContainerPtr[index]->push_back_tr ( defautTr ); - } - printf(".\n"); - CD_INFO( "* Using default general TR: %f.\n",defautTr); - } - if(!vectorOfControlboardContainerPtr[index]->start()){ - CD_ERROR("Could not start ManipulatorWrapper[%zu].\n",index); - return false; - } - //createManipulatorDevice(manipulatorPortName,manipulatorIndices.size()); - - } - } - - for ( unsigned int robotIter = 0; robotIter sensors = vectorOfRobotPtr.at(robotIter)->GetAttachedSensors(); - printf("Sensors found on robot %d (%s): %d.\n",robotIter,vectorOfRobotPtr.at(robotIter)->GetName().c_str(),(int)sensors.size()); - for ( unsigned int sensorIter = 0; sensorIterGetSensor(); - std::string tipo = psensorbase->GetName(); - printf("Sensor %d name: %s\n",sensorIter,tipo.c_str()); - // printf("Sensor %d description: %s\n",sensorIter,psensorbase->GetDescription().c_str()); - if (psensorbase->Supports(OpenRAVE::SensorBase::ST_Camera)) { - printf("Sensor %d supports ST_Camera.\n", sensorIter); - // Activate the camera - psensorbase->Configure(OpenRAVE::SensorBase::CC_PowerOn); - // Show the camera image in a separate window - // pcamerasensorbase->Configure(SensorBase::CC_RenderDataOn); - // Get some camera parameter info - boost::shared_ptr pcamerageomdata = boost::dynamic_pointer_cast(psensorbase->GetSensorGeometry(OpenRAVE::SensorBase::ST_Camera)); - // printf("Camera width: %d, height: %d.\n",pcamerageomdata->width,pcamerageomdata->height); - vectorOfCameraWidth.push_back(pcamerageomdata->width); - vectorOfCameraHeight.push_back(pcamerageomdata->height); - // Get a pointer to access the camera data stream - vectorOfCameraSensorDataPtr.push_back(boost::dynamic_pointer_cast(psensorbase->CreateSensorData(OpenRAVE::SensorBase::ST_Camera))); - vectorOfSensorPtrForCameras.push_back(psensorbase); // "save" - yarp::os::BufferedPort >* tmpPort = new yarp::os::BufferedPort >; - yarp::os::ConstString tmpName("/"); - yarp::os::ConstString cameraSensorString(psensorbase->GetName()); - size_t pos = cameraSensorString.find("imageMap"); - if ( pos != std::string::npos) { - tmpName += cameraSensorString.substr (0,pos-1); - tmpName += "/imageMap:o"; - } else { - tmpName += cameraSensorString.c_str(); - tmpName += "/img:o"; - } - tmpPort->open(tmpName); - vectorOfRgbPortPtr.push_back(tmpPort); - } else if (psensorbase->Supports(OpenRAVE::SensorBase::ST_Laser)) { - printf("Sensor %d supports ST_Laser.\n", sensorIter); - // Activate the sensor - psensorbase->Configure(OpenRAVE::SensorBase::CC_PowerOn); - // Paint the rays in the OpenRAVE viewer - psensorbase->Configure(OpenRAVE::SensorBase::CC_RenderDataOn); - // Get some laser parameter info - // boost::shared_ptr plasergeomdata = boost::dynamic_pointer_cast(psensorbase->GetSensorGeometry(SensorBase::ST_Laser)); - // printf("Laser resolution: %f %f.\n",plasergeomdata->resolution[0],plasergeomdata->resolution[1]); - // printf("Laser min_angle: %f %f.\n",plasergeomdata->min_angle[0],plasergeomdata->min_angle[1]); - // printf("Laser max_angle: %f %f.\n",plasergeomdata->max_angle[0],plasergeomdata->max_angle[1]); - // Get a pointer to access the laser data stream - vectorOfLaserSensorDataPtr.push_back(boost::dynamic_pointer_cast(psensorbase->CreateSensorData(OpenRAVE::SensorBase::ST_Laser))); - vectorOfSensorPtrForLasers.push_back(psensorbase); // "save" - yarp::os::BufferedPort >* tmpPort = new yarp::os::BufferedPort >; - yarp::os::ConstString tmpName("/"); - yarp::os::ConstString depthSensorString(psensorbase->GetName()); - size_t pos = depthSensorString.find("depthMap"); - if ( pos != std::string::npos) { - tmpName += depthSensorString.substr (0,pos-1); - tmpName += "/depthMap:o"; - } else { - tmpName += depthSensorString.c_str(); - tmpName += "/depth:o"; - } - tmpPort->open(tmpName); - vectorOfIntPortPtr.push_back(tmpPort); - } else if (psensorbase->Supports(OpenRAVE::SensorBase::ST_Force6D)) { - printf("Sensor %d supports ST_Force6D.\n", sensorIter); - // Activate the sensor - psensorbase->Configure(OpenRAVE::SensorBase::CC_PowerOn); - // Get a pointer to access the force6D data stream - vectorOfForce6DSensorDataPtr.push_back(boost::dynamic_pointer_cast(psensorbase->CreateSensorData(OpenRAVE::SensorBase::ST_Force6D))); - vectorOfSensorPtrForForce6Ds.push_back(psensorbase); // "save" - yarp::os::BufferedPort * tmpPort = new yarp::os::BufferedPort; - std::string sensorName = psensorbase->GetName(); - size_t pos = sensorName.find(":"); - std::string portName("/"); - portName += sensorName.substr (pos+1,sensorName.size()); - tmpPort->open(portName); - vectorOfForce6DPortPtr.push_back(tmpPort); - } else printf("Sensor %d not supported.\n", robotIter); - } - } - - // Start the RateThread - teoSimRateThread.setRate(jmcMs); - teoSimRateThread.setEnvironmentPtr(environmentPtr); - teoSimRateThread.setPtrVectorOfRobotPtr(&vectorOfRobotPtr); - teoSimRateThread.setPtrVectorOfControlboardContainerPtr(&vectorOfControlboardContainerPtr); - - teoSimRateThread.setPtrVectorOfSensorPtrForCameras(&vectorOfSensorPtrForCameras); - teoSimRateThread.setPtrVectorOfCameraSensorDataPtr(&vectorOfCameraSensorDataPtr); - teoSimRateThread.setPtrVectorOfRgbPortPtr(&vectorOfRgbPortPtr); - teoSimRateThread.setPtrVectorOfIntPortPtr(&vectorOfIntPortPtr); - teoSimRateThread.setPtrVectorOfForce6DPortPtr(&vectorOfForce6DPortPtr); - teoSimRateThread.setPtrVectorOfCameraWidth(&vectorOfCameraWidth); - teoSimRateThread.setPtrVectorOfCameraHeight(&vectorOfCameraHeight); - teoSimRateThread.setPtrVectorOfSensorPtrForLasers(&vectorOfSensorPtrForLasers); - teoSimRateThread.setPtrVectorOfLaserSensorDataPtr(&vectorOfLaserSensorDataPtr); - teoSimRateThread.setPtrVectorOfSensorPtrForForce6Ds(&vectorOfSensorPtrForForce6Ds); - teoSimRateThread.setPtrVectorOfForce6DSensorDataPtr(&vectorOfForce6DSensorDataPtr); - - - teoSimRateThread.start(); - - return true; -} - -// ----------------------------------------------------------------------------- - -double roboticslab::TeoSim::getPeriod() { - return 5.0; -} - -// ----------------------------------------------------------------------------- - -bool roboticslab::TeoSim::updateModule() { - CD_INFO("Alive...\n"); - return true; -} - -// ----------------------------------------------------------------------------- - -bool roboticslab::TeoSim::close() { - printf("[TeoSim] begin: close(). Ask thread to stop...\n"); - teoSimRateThread.askToStop(); - printf("[TeoSim] Done. Closing devices...\n"); - for (size_t i=0;istop(); - delete vectorOfControlboardContainerPtr[i]; - vectorOfControlboardContainerPtr[i] = 0; - } - //penv->StopSimulation(); // NEEDED?? - printf("[TeoSim] Devices closed. Closing environment...\n"); - environmentPtr->Destroy(); // destroy - yarp::os::Time::delay(0.4); - printf("[TeoSim] close() joining...\n"); - orThreads.join_all(); // wait for the viewer thread to exit - printf("[TeoSim] success: join_all ended.\n"); - printf("[TeoSim] end: close().\n"); - return true; -} - -// ----------------------------------------------------------------------------- - -void SetViewer(OpenRAVE::EnvironmentBasePtr penv, const std::string& viewername, int _viewer) -{ - OpenRAVE::ViewerBasePtr viewer = RaveCreateViewer(penv,viewername); - BOOST_ASSERT(!!viewer); - - // attach it to the environment: - penv->AddViewer(viewer); // penv->AttachViewer(viewer); - - // finally you call the viewer's infinite loop (this is why you need a separate thread): - bool showgui = true; // change to false to disable scene view - if(!_viewer) showgui = false; // if viewer arg = 0 - viewer->main(showgui); -} - -// ----------------------------------------------------------------------------- diff --git a/programs/teoSim/TeoSim.hpp b/programs/teoSim/TeoSim.hpp deleted file mode 100644 index 10c4a375..00000000 --- a/programs/teoSim/TeoSim.hpp +++ /dev/null @@ -1,116 +0,0 @@ -// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- - -#ifndef __TEO_SIM_HPP__ -#define __TEO_SIM_HPP__ - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include "ColorDebug.hpp" -#include "ControlboardContainer.hpp" -#include "TeoSimRateThread.hpp" - -#define DEFAULT_ENV "contexts/openrave/teo/teo.robot.xml" -#define DEFAULT_TEO_SIM_MS 20.0 // [ms] -#define DEFAULT_PHYSICS "none" -#define DEFAULT_VIEWER 1 - -namespace roboticslab -{ - -/** - * @ingroup teoSim - * - * @brief Main class, creates an instance of OpenRAVE-core (qtcoin viewer included) and corresponding controlboard wrappers. - */ -class TeoSim : public yarp::os::RFModule { - - public: - -// -------- RFModule declarations. Implementation in TeoSim.cpp -------- - - /** - * Configure the module, pass a ResourceFinder object to the module. - * - * @param rf a previously initialized ResourceFinder - * @return true/false upon success/failure - * - * \note attachTerminal() is no longer called automatically. You - * can call it in the configure function. - */ - virtual bool configure(yarp::os::ResourceFinder &rf); - - /** - * You can override this to control the approximate periodicity at which - * updateModule() is called by runModule(). By default, it returns - * 1.0. Time here is in seconds. - * - * @return the desired period between successive calls to updateModule() - */ - virtual double getPeriod(); - - /** - * Override this to do whatever your module needs to do. - * - * When your module wants to stop, return false. The module's actual - * work could be done during this call, or it could just check the - * state of a thread running in the background. - * - * @return true iff module should continue - */ - virtual bool updateModule(); - - /** - * Close function. - * - * This is called automatically when the module closes, after the last call - * to updateModule. - * Override this to perform memory cleanup or other activities. - * - * @return true/false on success failure. - */ - virtual bool close(); - - // ------------------------------- Protected ------------------------------------- - - protected: - - // Rave-specific parameters // - OpenRAVE::EnvironmentBasePtr environmentPtr; - OpenRAVE::PhysicsEngineBasePtr physicsEnginePtr; - std::vector vectorOfRobotPtr; - // - boost::thread_group orThreads; - // - std::vector< OpenRAVE::SensorBasePtr > vectorOfSensorPtrForCameras; - std::vector< OpenRAVE::SensorBasePtr > vectorOfSensorPtrForLasers; - std::vector< OpenRAVE::SensorBasePtr > vectorOfSensorPtrForForce6Ds; - std::vector< boost::shared_ptr > vectorOfCameraSensorDataPtr; - std::vector< boost::shared_ptr > vectorOfLaserSensorDataPtr; - std::vector< boost::shared_ptr > vectorOfForce6DSensorDataPtr; - std::vector vectorOfCameraWidth; - std::vector vectorOfCameraHeight; - std::vector< yarp::os::BufferedPort >* > vectorOfRgbPortPtr; - std::vector< yarp::os::BufferedPort >* > vectorOfIntPortPtr; - std::vector< yarp::os::BufferedPort* > vectorOfForce6DPortPtr; - // - TeoSimRateThread teoSimRateThread; - - /** Vector to store pointers to ControlboardContainer objects */ - std::vector < ControlboardContainer* > vectorOfControlboardContainerPtr; -}; - -} // namespace roboticslab - -#endif // __TEO_SIM_HPP__ - diff --git a/programs/teoSim/TeoSimRateThread.cpp b/programs/teoSim/TeoSimRateThread.cpp deleted file mode 100644 index fbaeea3c..00000000 --- a/programs/teoSim/TeoSimRateThread.cpp +++ /dev/null @@ -1,151 +0,0 @@ -// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- - -#include "TeoSimRateThread.hpp" - -// ------------------- RateThread Related ------------------------------------ - -bool roboticslab::TeoSimRateThread::threadInit() { - printf("[TeoSimRateThread] begin: threadInit()\n"); - jmcMs = this->getRate(); - - std::string plugin = DEFAULT_PLUGIN; - - if(plugin != "none") { - OpenRAVE::RaveLoadPlugin(plugin); - OpenRAVE::ModuleBasePtr moduleBasePtr = RaveCreateModule(environmentPtr,plugin); // create the module - environmentPtr->Add(moduleBasePtr,true); // load the module, calls main and also enables good destroy. - std::stringstream cmdin,cmdout; - cmdin << "open"; // default maxiter:4000 - RAVELOG_INFO("%s\n",cmdin.str().c_str()); - if( !moduleBasePtr->SendCommand(cmdout,cmdin) ) { - fprintf(stderr,"Bad send open command.\n"); - } - printf("Sent open command.\n"); - } - - lastTime = yarp::os::Time::now(); - printf("[TeoSimRateThread] end: threadInit()\n"); - return true; -} - -// ----------------------------------------------------------------------------- - -void roboticslab::TeoSimRateThread::run() { - //printf("[TeoSimRateThread] run()\n"); - - for(size_t i=0;isize();i++) { // For each robot - int dof = ptrVectorOfRobotPtr->at(i)->GetDOF(); // Create a vector sized - std::vector dEncRaw(dof); // its number of joints. - //-- Iterate through manipulator wrappers - for(size_t j=0;jsize();j++) { - //-- If indexes belong to father - if((int)i == ptrVectorOfManipulatorWrapperPtr->at(j)->getFatherRobotIdx() ) { - std::vector< int > vectorOfJointIdx = ptrVectorOfManipulatorWrapperPtr->at(j)->getVectorOfJointIdxRef(); - std::vector< double > vectorOfJointPos = ptrVectorOfManipulatorWrapperPtr->at(j)->getVectorOfJointPosRef(); - std::vector< double > vectorOfJointTr = ptrVectorOfManipulatorWrapperPtr->at(j)->getVectorOfJointTrRef(); - //-- Overwrite dEncRaw - for(size_t k=0;kat(i)->SetJointValues(dEncRaw); // More compatible with physics?? - } - - environmentPtr->StepSimulation(jmcMs/1000.0); // StepSimulation must be given in seconds - - for(unsigned int camIter = 0; camItersize(); camIter++ ) { - ptrVectorOfSensorPtrForCameras->at(camIter)->GetSensorData(ptrVectorOfCameraSensorDataPtr->at(camIter)); - //std::vector currentFrame = pcamerasensordata->vimagedata; - //printf("Vector size: %d\n",currentFrame.size()); // i.e. 480 * 640 * 3 = 921600; - yarp::sig::ImageOf& i_imagen = ptrVectorOfRgbPortPtr->at(camIter)->prepare(); - i_imagen.resize(ptrVectorOfCameraWidth->at(camIter),ptrVectorOfCameraHeight->at(camIter)); // Tamaño de la pantalla - yarp::sig::PixelRgb p; - for (int i_x = 0; i_x < i_imagen.width(); ++i_x) { - for (int i_y = 0; i_y < i_imagen.height(); ++i_y) { - p.r = ptrVectorOfCameraSensorDataPtr->at(camIter)->vimagedata[3*(i_x+(i_y*i_imagen.width()))]; - p.g = ptrVectorOfCameraSensorDataPtr->at(camIter)->vimagedata[1+3*(i_x+(i_y*i_imagen.width()))]; - p.b = ptrVectorOfCameraSensorDataPtr->at(camIter)->vimagedata[2+3*(i_x+(i_y*i_imagen.width()))]; - i_imagen.safePixel(i_x,i_y) = p; - } - } - ptrVectorOfRgbPortPtr->at(camIter)->write(); - } - - for(unsigned int laserIter = 0; laserItersize(); laserIter++ ) { - ptrVectorOfSensorPtrForLasers->at(laserIter)->GetSensorData(ptrVectorOfLaserSensorDataPtr->at(laserIter)); - std::vector< OpenRAVE::RaveVector< OpenRAVE::dReal > > sensorRanges = ptrVectorOfLaserSensorDataPtr->at(laserIter)->ranges; - std::vector< OpenRAVE::RaveVector< OpenRAVE::dReal > > sensorPositions = ptrVectorOfLaserSensorDataPtr->at(laserIter)->positions; - OpenRAVE::Transform tinv = ptrVectorOfLaserSensorDataPtr->at(laserIter)->__trans.inverse(); - // std::vector< dReal > sensorIntensity = plasersensordata[laserIter]->intensity; - // printf("[%d] sensorPositions size: %d ",laserIter,sensorPositions.size()); // = 1; xyz of the fixed 3d sensor position. - // printf("sensorRanges size: %d ",sensorRanges.size()); // 64 * 48 = 3072; - // printf("sensorIntensity size: %d\n",sensorIntensity.size()); // 64 * 48 = 3072; - //for(unsigned int i=0;i__trans.inverse(); - for(size_t i = 0; i < _data->ranges.size(); ++i) { - float* p = (float*)(&_pointcloud2msg.data.at(i*_pointcloud2msg.point_step)); - if( i < _data->positions.size() ) { - Vector v = tinv*(_data->ranges[i] + _data->positions[i]); - p[0] = (float)v.x; - p[1] = (float)v.y; - p[2] = (float)v.z; - } else if( _data->positions.size() > 0 ) { - Vector v = tinv*(_data->ranges[i] + _data->positions[0]); - p[0] = (float)v.x; - p[1] = (float)v.y; - p[2] = (float)v.z; - } else { - Vector v = tinv*_data->ranges[i]; - p[0] = (float)v.x; - p[1] = (float)v.y; - p[2] = (float)v.z; - } - if( _data->intensity.size()==_data->ranges.size() ) { - p[3] = _data->intensity[i]; - } - }*/ - yarp::sig::ImageOf& i_depth = ptrVectorOfIntPortPtr->at(laserIter)->prepare(); - if(sensorRanges.size()==3072) i_depth.resize(64,48); // Tamaño de la pantalla (64,48) - else if(sensorRanges.size()==12288) i_depth.resize(128,96); - else if(sensorRanges.size()==49152) i_depth.resize(256,192); - else if(sensorRanges.size()==307200) i_depth.resize(640,480); - else if(sensorRanges.size()==4) i_depth.resize(2,2); - //else printf("[warning] unrecognized laser sensor data size.\n"); - else i_depth.resize(sensorRanges.size(),1); - for (int i_y = 0; i_y < i_depth.height(); ++i_y) { // was y in x before - for (int i_x = 0; i_x < i_depth.width(); ++i_x) { - //double p = sensorRanges[i_y+(i_x*i_depth.height())].z; - double p; - if( sensorPositions.size() > 0 ) { - OpenRAVE::Vector v = tinv*(sensorRanges[i_y+(i_x*i_depth.height())] + sensorPositions[0]); - p = (float)v.z; - } else { - OpenRAVE::Vector v = tinv*(sensorRanges[i_y+(i_x*i_depth.height())]); - p = (float)v.z; - } - i_depth(i_x,i_y) = p*1000.0; // give mm - } - } - ptrVectorOfIntPortPtr->at(laserIter)->write(); - } - - for(unsigned int force6DIter = 0; force6DItersize(); force6DIter++ ) { - ptrVectorOfSensorPtrForForce6Ds->at(force6DIter)->GetSensorData(ptrVectorOfForce6DSensorDataPtr->at(force6DIter)); - yarp::os::Bottle& b = ptrVectorOfForce6DPortPtr->at(force6DIter)->prepare(); - b.clear(); - b.addDouble( ptrVectorOfForce6DSensorDataPtr->at(force6DIter)->force[0] ); - b.addDouble( ptrVectorOfForce6DSensorDataPtr->at(force6DIter)->force[1] ); - b.addDouble( ptrVectorOfForce6DSensorDataPtr->at(force6DIter)->force[2] ); - b.addDouble( ptrVectorOfForce6DSensorDataPtr->at(force6DIter)->torque[0] ); - b.addDouble( ptrVectorOfForce6DSensorDataPtr->at(force6DIter)->torque[1] ); - b.addDouble( ptrVectorOfForce6DSensorDataPtr->at(force6DIter)->torque[2] ); - ptrVectorOfForce6DPortPtr->at(force6DIter)->write(); - } - -} - -// ----------------------------------------------------------------------------- - diff --git a/programs/teoSim/TeoSimRateThread.hpp b/programs/teoSim/TeoSimRateThread.hpp deleted file mode 100644 index 4f1a2e39..00000000 --- a/programs/teoSim/TeoSimRateThread.hpp +++ /dev/null @@ -1,146 +0,0 @@ -// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- - -#ifndef __TEO_SIM_RATE_THREAD_HPP__ -#define __TEO_SIM_RATE_THREAD_HPP__ - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include "ControlboardContainer.hpp" - -#define NULL_JMC_MS 20 - -#define DEFAULT_PLUGIN "none" -//#define DEFAULT_PLUGIN "OpenraveWorldRpcResponder" // loads plugin - -namespace roboticslab -{ - -/** - * @ingroup teoSim - * - * @brief Helper class, implements the yarp::os::RateThread. - */ -class TeoSimRateThread : public yarp::os::RateThread { - public: - - // Set the Thread Rate in the class constructor - TeoSimRateThread() : RateThread(NULL_JMC_MS) {} // In ms - - void setEnvironmentPtr(const OpenRAVE::EnvironmentBasePtr& environmentPtr) { - this->environmentPtr = environmentPtr; - } - - void setPtrVectorOfControlboardContainerPtr(std::vector< ControlboardContainer* > * ptrVectorOfManipulatorWrapperPtr) { - this->ptrVectorOfManipulatorWrapperPtr = ptrVectorOfManipulatorWrapperPtr; - } - - void setPtrVectorOfRobotPtr(std::vector< OpenRAVE::RobotBasePtr > * ptrVectorOfRobotPtr) { - this->ptrVectorOfRobotPtr = ptrVectorOfRobotPtr; - } - - void setPtrVectorOfSensorPtrForCameras(std::vector< OpenRAVE::SensorBasePtr > * ptrVectorOfSensorPtrForCameras) { - this->ptrVectorOfSensorPtrForCameras = ptrVectorOfSensorPtrForCameras; - } - - void setPtrVectorOfSensorPtrForLasers(std::vector< OpenRAVE::SensorBasePtr > * ptrVectorOfSensorPtrForLasers) { - this->ptrVectorOfSensorPtrForLasers = ptrVectorOfSensorPtrForLasers; - } - - void setPtrVectorOfSensorPtrForForce6Ds(std::vector< OpenRAVE::SensorBasePtr > * ptrVectorOfSensorPtrForForce6Ds) { - this->ptrVectorOfSensorPtrForForce6Ds = ptrVectorOfSensorPtrForForce6Ds; - } - - void setPtrVectorOfCameraSensorDataPtr(std::vector< boost::shared_ptr > * ptrVectorOfCameraSensorDataPtr) { - this->ptrVectorOfCameraSensorDataPtr = ptrVectorOfCameraSensorDataPtr; - } - - void setPtrVectorOfLaserSensorDataPtr(std::vector< boost::shared_ptr > * setPtrVectorOfLaserSensorDataPtr) { - this->ptrVectorOfLaserSensorDataPtr = setPtrVectorOfLaserSensorDataPtr; - } - - void setPtrVectorOfForce6DSensorDataPtr(std::vector< boost::shared_ptr > * setPtrVectorOfForce6DSensorDataPtr) { - this->ptrVectorOfForce6DSensorDataPtr = setPtrVectorOfForce6DSensorDataPtr; - } - - void setPtrVectorOfCameraWidth(std::vector * ptrVectorOfCameraWidth) { - this->ptrVectorOfCameraWidth = ptrVectorOfCameraWidth; - } - - void setPtrVectorOfCameraHeight(std::vector * ptrVectorOfCameraHeight) { - this->ptrVectorOfCameraHeight = ptrVectorOfCameraHeight; - } - - void setPtrVectorOfRgbPortPtr(std::vector< yarp::os::BufferedPort >* > * ptrVectorOfRgbPortPtr) { - this->ptrVectorOfRgbPortPtr = ptrVectorOfRgbPortPtr; - } - - void setPtrVectorOfIntPortPtr(std::vector< yarp::os::BufferedPort >* > * ptrVectorOfIntPortPtr) { - this->ptrVectorOfIntPortPtr = ptrVectorOfIntPortPtr; - } - - void setPtrVectorOfForce6DPortPtr(std::vector< yarp::os::BufferedPort* > * ptrVectorOfForce6DPortPtr) { - this->ptrVectorOfForce6DPortPtr = ptrVectorOfForce6DPortPtr; - } - - - // -------- RateThread declarations. Implementation in RateThreadImpl.cpp -------- - - /** - * Initialization method. The thread executes this function - * when it starts and before "run". This is a good place to - * perform initialization tasks that need to be done by the - * thread itself (device drivers initialization, memory - * allocation etc). If the function returns false the thread - * quits and never calls "run". The return value of threadInit() - * is notified to the class and passed as a parameter - * to afterStart(). Note that afterStart() is called by the - * same thread that is executing the "start" method. - */ - bool threadInit(); - - /** - * Loop function. This is the thread itself. - */ - void run(); - - // ------------------------------- Protected ------------------------------------- - protected: - // - double jmcMs; - double lastTime; - // - // Rave-specific // - OpenRAVE::EnvironmentBasePtr environmentPtr; - std::vector * ptrVectorOfRobotPtr; - // - std::vector< OpenRAVE::SensorBasePtr > * ptrVectorOfSensorPtrForCameras; - std::vector< OpenRAVE::SensorBasePtr > * ptrVectorOfSensorPtrForLasers; - std::vector< OpenRAVE::SensorBasePtr > * ptrVectorOfSensorPtrForForce6Ds; - std::vector< boost::shared_ptr > * ptrVectorOfCameraSensorDataPtr; - std::vector< boost::shared_ptr > * ptrVectorOfLaserSensorDataPtr; - std::vector< boost::shared_ptr > * ptrVectorOfForce6DSensorDataPtr; - std::vector * ptrVectorOfCameraWidth; - std::vector * ptrVectorOfCameraHeight; - std::vector< yarp::os::BufferedPort >* > * ptrVectorOfRgbPortPtr; - std::vector< yarp::os::BufferedPort >* > * ptrVectorOfIntPortPtr; - std::vector< yarp::os::BufferedPort* > * ptrVectorOfForce6DPortPtr; - // - /** Vector to store pointers to ManipulatorWrapper objects */ - std::vector < ControlboardContainer* > * ptrVectorOfManipulatorWrapperPtr; -}; - -} // namespace roboticslab - -#endif // __TEO_SIM_HPP__ - diff --git a/programs/teoSim/main.cpp b/programs/teoSim/main.cpp deleted file mode 100644 index ec0576ab..00000000 --- a/programs/teoSim/main.cpp +++ /dev/null @@ -1,90 +0,0 @@ -// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- - -/** - * @ingroup openrave-yarp-plugins_programs - * - * \defgroup teoSim teoSim - * - * @brief Creates an instance of roboticslab::TeoSim. - * - * @section teoSim_legal Legal - * - * Copyright: 2013 (C) Universidad Carlos III de Madrid - * - * Author: Juan G. Victores - * - * Contrib: Paul Fitzpatrick (YARP sample code, email responses). - * - * CopyPolicy: Released under the terms of the LGPLv2.1 or later, see license/LGPL.TXT - * - * @section teoSim_install Installation - * - * The module is compiled when ENABLE_teoSim is activated (default: OFF). For further - * installation steps refer to your own system installation guidelines. - * - * @section teoSim_running Running (assuming correct installation) - * - * First we must run a YARP name server if it is not running in our current namespace: -\verbatim -[on terminal 1] yarp server -\endverbatim - * And then launch the actual module: -\verbatim -[on terminal 2] teoSim -\endverbatim - * - * You should get a window similar to the one depicted on Figure 1. - -\image html teoSim.png -
Fig. 1 - An instance of the \ref teoSim module.
- - * @section teoSim_interfacing Interfacing with the teoSim module - * -\verbatim -[on terminal 3] yarp rpc /teoSim/leftArm/rpc:i -[on terminal 3] yarp rpc /teoSim/rightArm/rpc:i -\endverbatim - * - * Note 1: Change '/teoSim' to '/teo' for the real robot! - * - * @section teoSim_modify Modify - * - * This file can be edited at - * programs/teoSim/main.cpp - * - */ - -#include "ColorDebug.hpp" -#include "TeoSim.hpp" - - -//YARP_DECLARE_PLUGINS(yarpplugins) - -int main(int argc, char *argv[]) { - - //YARP_REGISTER_PLUGINS(yarpplugins); - - yarp::os::ResourceFinder rf; - rf.setVerbose(true); - rf.setDefaultContext("teoSim"); - rf.setDefaultConfigFile("teoSim.ini"); - rf.configure(argc,argv); - - roboticslab::TeoSim mod; - if(rf.check("help")) { - return mod.runModule(rf); - } - - CD_INFO("Run \"teoSim --help\" for options.\n"); - CD_INFO("Checking for yarp network...\n"); - yarp::os::Network yarp; - if (!yarp.checkNetwork()) { - CD_ERROR("Found no yarp network (try running \"yarpserver &\"), bye!\n"); - return -1; - } else { - CD_SUCCESS("Yarp network found.\n"); - } - - return mod.runModule(rf); -} - diff --git a/share/CMakeLists.txt b/share/CMakeLists.txt index 4228dc33..7151b61b 100644 --- a/share/CMakeLists.txt +++ b/share/CMakeLists.txt @@ -10,5 +10,5 @@ yarp_configure_external_installation(roboticslab-openrave-yarp-plugins) ### Go through single applications -add_subdirectory(teoSim) +#add_subdirectory(example) diff --git a/share/teoSim/CMakeLists.txt b/share/teoSim/CMakeLists.txt deleted file mode 100644 index bfadeeff..00000000 --- a/share/teoSim/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright: 2014 UC3M -# Author: Juan G Victores -# CopyPolicy: Released under the terms of the GNU GPL v2.0. - -set(appname teoSim) - -file(GLOB conf ${CMAKE_CURRENT_SOURCE_DIR}/conf/*.ini) -#file(GLOB scripts ${CMAKE_CURRENT_SOURCE_DIR}/scripts/*.template) - -yarp_install(FILES ${conf} DESTINATION ${ROBOTICSLAB-OPENRAVE-YARP-PLUGINS_CONTEXTS_INSTALL_DIR}/${appname}) -#yarp_install(FILES ${scripts} DESTINATION ${ROBOTICSLAB-OPENRAVE-YARP-PLUGINS_APPLICATIONS_TEMPLATES_INSTALL_DIR}) - diff --git a/share/teoSim/conf/teoSim.ini b/share/teoSim/conf/teoSim.ini deleted file mode 100644 index 6b05bc15..00000000 --- a/share/teoSim/conf/teoSim.ini +++ /dev/null @@ -1,19 +0,0 @@ -// teoSim.ini - - -/// TeoSim options - -// env models/teoWhite/teoFull.robot.xml // env [xml] environment name within context -// jmcMs 20 // jmcMs [ms] rate of joint control thread -// physics none // type of physics -// viewer 1 // 0 for none - -// manipulator override options -//[/teoSim/rightArm] -//IDs 18 19 20 21 -//TRs -0.017453 -0.017453 -0.017453 -0.017453 - -//[/teoSim/leftArm] -//IDs 12 13 14 15 -//TRs -0.017453 -0.017453 -0.017453 -0.017453 - From 24c8e57ab3461e956be68729d8ee7074d440588e Mon Sep 17 00:00:00 2001 From: jgvictores Date: Fri, 12 Jan 2018 23:50:49 +0100 Subject: [PATCH 2/3] in readme, first describe c++ version, later python --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c36d1b2a..e1551c85 100644 --- a/README.md +++ b/README.md @@ -44,24 +44,24 @@ Technically, the OpenRAVE plugin can directly open YARP ports, or contain one or - "name": Can be extracted from the `OpenRAVE::Environment` and can be used for the port names opened by the "device" too. - Plus, whatever other information the "subdevice" YARP plugin requires (e.g. which `robotIndex` and/or `manipulatorIndex` for control). -# Tutorials: (How to use openrave-yarp-plugins as a replacement of teoSim) +# Tutorials: (How openrave-yarp-plugins is used to implement teoSim in teo-configuration-files) ```bash yarpserver # new terminal -python ~/repos/openrave-yarp-plugins/examples/openraveYarpPluginLoader-controlboard-allManipulators.py +openrave /usr/local/share/teo-openrave-models/contexts/openrave/teo/teo.robot.xml --module OpenraveYarpPluginLoader "open --device controlboardwrapper2 --subdevice YarpOpenraveControlboard --robotIndex 0 --allManipulators" # Then the robot can be commanded via yarp with: yarp rpc /teoSim/[kinematic chain name]/rpc:i ``` -If you do not have or want to use Python, the direct CLI one-liner succesor of `teoSim` is: +We can do funky commands like the following, where `open` acts as a delimiter: ```bash -openrave /usr/local/share/teo-openrave-models/contexts/openrave/teo/teo.robot.xml --module OpenraveYarpPluginLoader "open --device controlboardwrapper2 --subdevice YarpOpenraveControlboard --robotIndex 0 --allManipulators" +openrave /usr/local/share/teo-openrave-models/contexts/openrave/teo/teo.robot.xml --module OpenraveYarpPluginLoader "open --device controlboardwrapper2 --subdevice YarpOpenraveControlboard --robotIndex 0 --manipulatorIndex 0 open --device controlboardwrapper2 --subdevice YarpOpenraveControlboard --robotIndex 0 --manipulatorIndex 2" ``` -We can even do funky commands like the following, where `open` acts as a delimiter: +If you prefer to use Python, the direct CLI one-liner equivalent of `teoSim` is: ```bash -openrave /usr/local/share/teo-openrave-models/contexts/openrave/teo/teo.robot.xml --module OpenraveYarpPluginLoader "open --device controlboardwrapper2 --subdevice YarpOpenraveControlboard --robotIndex 0 --manipulatorIndex 0 open --device controlboardwrapper2 --subdevice YarpOpenraveControlboard --robotIndex 0 --manipulatorIndex 2" +python ~/repos/openrave-yarp-plugins/examples/openraveYarpPluginLoader-controlboard-allManipulators.py ``` Note that OpenraveYarpPluginLoader uses OpenRAVE plugins `main()`, affected by [#59](https://github.com/roboticslab-uc3m/openrave-yarp-plugins/issues/59) and [#60](https://github.com/roboticslab-uc3m/openrave-yarp-plugins/issues/60). From 2558e6a4a25f908ed9905e5f16a566706b31b0da Mon Sep 17 00:00:00 2001 From: jgvictores Date: Fri, 12 Jan 2018 23:55:30 +0100 Subject: [PATCH 3/3] comment out currently empty share,programs --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f5201077..8d8a5987 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,9 +96,9 @@ set(OPENRAVE_YARP_PLUGINS_LINK_DIRS CACHE INTERNAL "appended link dirs" FORCE) set(OPENRAVE_YARP_PLUGINS_LIBRARIES CACHE INTERNAL "appended libraries" FORCE) # add main contents -add_subdirectory(share) +#add_subdirectory(share) # Currently empty add_subdirectory(libraries) -add_subdirectory(programs) +#add_subdirectory(programs) # Currently empty # export our variables to a OPENRAVE_YARP_PLUGINSConfig.cmake creation set(OPENRAVE_YARP_PLUGINS_LINK_DIRS ${OPENRAVE_YARP_PLUGINS_LINK_DIRS} ${LIBRARY_OUTPUT_PATH})