Skip to content

Commit

Permalink
Merge branch 'fix-72-deps' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBowman committed Aug 2, 2018
2 parents 40734bc + d0ad21f commit ebca8bd
Show file tree
Hide file tree
Showing 42 changed files with 486 additions and 390 deletions.
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake
# Find project's hard dependencies.
find_package(YCM 0.8 REQUIRED)
find_package(COLOR_DEBUG REQUIRED)
find_package(OpenRAVE REQUIRED)
find_package(Boost ${OpenRAVE_Boost_VERSION} EXACT REQUIRED
COMPONENTS iostreams python thread system)
find_package(OpenRAVE 0.9 REQUIRED)
find_package(Boost "${OpenRAVE_Boost_VERSION}" EXACT REQUIRED COMPONENTS thread)
find_package(YARP 3.0 QUIET)
# https://github.com/roboticslab-uc3m/questions-and-answers/issues/65
if(NOT YARP_FOUND)
Expand Down
2 changes: 2 additions & 0 deletions doc/openrave-yarp-plugins-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ First install the dependencies:
- [Install YCM 0.8+](https://github.com/roboticslab-uc3m/installation-guides/blob/master/install-ycm.md)
- [Install YARP 2.3.70+](https://github.com/roboticslab-uc3m/installation-guides/blob/master/install-yarp.md)
- [Install OpenRAVE 0.9+](https://github.com/roboticslab-uc3m/installation-guides/blob/master/install-openrave.md)
- [Install Boost](https://github.com/roboticslab-uc3m/installation-guides/blob/master/install-boost.md) (implicitly required by OpenRAVE)
- Components: Boost.Thread.
- [Install color-debug](https://github.com/roboticslab-uc3m/color-debug)

# Install openrave-yarp-plugins on Ubuntu (working on all tested versions)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@ option(ENABLE_OpenraveDumpManipulatorJointLinks "Enable/disable OpenraveDumpMani

if(ENABLE_OpenraveDumpManipulatorJointLinks)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${OpenRAVE_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS})
include_directories(${OpenRAVE_INCLUDE_DIRS})

link_directories(${OpenRAVE_LIBRARY_DIRS}
${Boost_LIBRARY_DIRS})
link_directories(${OpenRAVE_LIBRARY_DIRS})

add_library(OpenraveDumpManipulatorJointLinks MODULE OpenraveDumpManipulatorJointLinks.cpp)

set_target_properties(OpenraveDumpManipulatorJointLinks PROPERTIES COMPILE_OPTIONS "${OpenRAVE_CXX_FLAGS}"
LINK_FLAGS "${OpenRAVE_LINK_FLAGS}")

target_link_libraries(OpenraveDumpManipulatorJointLinks ${OpenRAVE_LIBRARIES}
Boost::boost
ROBOTICSLAB::ColorDebug)

include(InstallOpenravePlugin)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-

#include <sstream>
#include <string>
#include <vector>

#include <openrave/openrave.h>
#include <openrave/plugin.h>
#include <boost/bind.hpp>

#include <boost/bind/bind.hpp>

#include <ColorDebug.h>

Expand All @@ -23,7 +28,7 @@ class OpenraveDumpManipulatorJointLinks : public OpenRAVE::ModuleBase
OpenraveDumpManipulatorJointLinks(OpenRAVE::EnvironmentBasePtr penv) : OpenRAVE::ModuleBase(penv)
{
__description = "OpenraveDumpManipulatorJointLinks plugin.";
RegisterCommand("open",boost::bind(&OpenraveDumpManipulatorJointLinks::Open, this,_1,_2),"opens OpenraveDumpManipulatorJointLinks");
OpenRAVE::InterfaceBase::RegisterCommand("open",boost::bind(&OpenraveDumpManipulatorJointLinks::Open, this,_1,_2),"opens OpenraveDumpManipulatorJointLinks");
}

virtual ~OpenraveDumpManipulatorJointLinks()
Expand Down Expand Up @@ -70,7 +75,7 @@ class OpenraveDumpManipulatorJointLinks : public OpenRAVE::ModuleBase

std::istringstream sinput( openStrings[i] );
std::ostringstream sout;
if( ! SendCommand(sout,sinput) )
if( ! OpenRAVE::InterfaceBase::SendCommand(sout,sinput) )
return 1;
}
return 0;
Expand Down
10 changes: 4 additions & 6 deletions libraries/OpenravePlugins/OpenraveYarpCoupled/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ option(ENABLE_OpenraveYarpCoupled "Enable/disable OpenraveYarpCoupled" ON)

if(ENABLE_OpenraveYarpCoupled)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${OpenRAVE_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS})
include_directories(${OpenRAVE_INCLUDE_DIRS})

link_directories(${OpenRAVE_LIBRARY_DIRS}
${Boost_LIBRARY_DIRS})
link_directories(${OpenRAVE_LIBRARY_DIRS})

add_library(OpenraveYarpCoupled MODULE OpenraveYarpCoupled.cpp)

Expand All @@ -21,7 +18,8 @@ target_link_libraries(OpenraveYarpCoupled YARP::YARP_OS
YARP::YARP_init
YARP::YARP_dev
YARP::YARP_sig
${OpenRAVE_LIBRARIES})
${OpenRAVE_LIBRARIES}
Boost::boost)

include(InstallOpenravePlugin)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,36 @@
\endverbatim
<b>Full Example Code:</b>
*/

#include <cstdio>

#include <sstream>
#include <string>
#include <vector>

#include <openrave/openrave.h>
#include <openrave/plugin.h>
#include <boost/bind.hpp>

#include <yarp/os/all.h>
#include <yarp/dev/all.h>
#include <yarp/sig/all.h>
#include <boost/bind/bind.hpp>
#include <boost/smart_ptr/shared_ptr.hpp>

using namespace std;
using namespace OpenRAVE;
#include <yarp/os/Bottle.h>
#include <yarp/os/BufferedPort.h>
#include <yarp/os/ConstString.h>
#include <yarp/os/Network.h>
#include <yarp/os/RateThread.h>

#include <yarp/dev/PolyDriver.h>

#define NULL_JMC_MS 20

//YARP_DECLARE_PLUGINS(yarpplugins)
#include <yarp/sig/Image.h>

#define NULL_JMC_MS 20

class TeoSimRateThread : public yarp::os::RateThread {
public:

// Set the Thread Rate in the class constructor
TeoSimRateThread() : RateThread(NULL_JMC_MS) {} // In ms
TeoSimRateThread() : yarp::os::RateThread(NULL_JMC_MS) {} // In ms

void setEnvironmentPtr(const OpenRAVE::EnvironmentBasePtr& environmentPtr) {
this->environmentPtr = environmentPtr;
Expand Down Expand Up @@ -230,16 +238,16 @@ void TeoSimRateThread::run() {

}

class OpenraveYarpCoulped : public ModuleBase
class OpenraveYarpCoupled : public OpenRAVE::ModuleBase
{
public:
OpenraveYarpCoulped(EnvironmentBasePtr penv) : ModuleBase(penv) {
OpenraveYarpCoupled(OpenRAVE::EnvironmentBasePtr penv) : OpenRAVE::ModuleBase(penv) {
//YARP_REGISTER_PLUGINS(yarpplugins);
__description = "OpenraveYarpCoulped plugin.";
RegisterCommand("open",boost::bind(&OpenraveYarpCoulped::Open, this,_1,_2),"opens OpenraveYarpCoulped");
OpenRAVE::InterfaceBase::RegisterCommand("open",boost::bind(&OpenraveYarpCoupled::Open, this,_1,_2),"opens OpenraveYarpCoulped");
}

virtual ~OpenraveYarpCoulped() {
virtual ~OpenraveYarpCoupled() {
for(int i=0;i<robotDevices.size();i++)
{
robotDevices[i]->close();
Expand All @@ -257,14 +265,14 @@ class OpenraveYarpCoulped : public ModuleBase
return 0;
}*/

bool Open(ostream& sout, istream& sinput)
bool Open(std::ostream& sout, std::istream& sinput)
{
bool alternativeRobotName = false;

vector<string> funcionArgs;
std::vector<std::string> funcionArgs;
while(sinput)
{
string funcionArg;
std::string funcionArg;
sinput >> funcionArg;
funcionArgs.push_back(funcionArg);
}
Expand All @@ -285,14 +293,14 @@ class OpenraveYarpCoulped : public ModuleBase

for ( unsigned int robotIter = 0; robotIter<vectorOfRobotPtr.size(); robotIter++ ) {
std::vector<OpenRAVE::RobotBase::AttachedSensorPtr> sensors = vectorOfRobotPtr.at(robotIter)->GetAttachedSensors();
printf("Sensors found on robot %d (%s): %d.\n",robotIter,vectorOfRobotPtr.at(robotIter)->GetName().c_str(),(int)sensors.size());
std::printf("Sensors found on robot %d (%s): %d.\n",robotIter,vectorOfRobotPtr.at(robotIter)->GetName().c_str(),(int)sensors.size());
for ( unsigned int sensorIter = 0; sensorIter<sensors.size(); sensorIter++ ) {
OpenRAVE::SensorBasePtr psensorbase = sensors.at(sensorIter)->GetSensor();
std::string tipo = psensorbase->GetName();
printf("Sensor %d name: %s\n",sensorIter,tipo.c_str());
std::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);
std::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
Expand All @@ -319,7 +327,7 @@ class OpenraveYarpCoulped : public ModuleBase
tmpPort->open(tmpName);
vectorOfRgbPortPtr.push_back(tmpPort);
} else if (psensorbase->Supports(OpenRAVE::SensorBase::ST_Laser)) {
printf("Sensor %d supports ST_Laser.\n", sensorIter);
std::printf("Sensor %d supports ST_Laser.\n", sensorIter);
// Activate the sensor
psensorbase->Configure(OpenRAVE::SensorBase::CC_PowerOn);
// Paint the rays in the OpenRAVE viewer
Expand All @@ -346,7 +354,7 @@ class OpenraveYarpCoulped : public ModuleBase
tmpPort->open(tmpName);
vectorOfIntPortPtr.push_back(tmpPort);
} else if (psensorbase->Supports(OpenRAVE::SensorBase::ST_Force6D)) {
printf("Sensor %d supports ST_Force6D.\n", sensorIter);
std::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
Expand All @@ -359,7 +367,7 @@ class OpenraveYarpCoulped : public ModuleBase
portName += sensorName.substr (pos+1,sensorName.size());
tmpPort->open(portName);
vectorOfForce6DPortPtr.push_back(tmpPort);
} else printf("Sensor %d not supported.\n", robotIter);
} else std::printf("Sensor %d not supported.\n", robotIter);
}
}

Expand Down Expand Up @@ -407,15 +415,15 @@ class OpenraveYarpCoulped : public ModuleBase

};

InterfaceBasePtr CreateInterfaceValidated(InterfaceType type, const std::string& interfacename, std::istream& sinput, EnvironmentBasePtr penv) {
if( type == PT_Module && interfacename == "openraveyarpcoupled" ) {
return InterfaceBasePtr(new OpenraveYarpCoulped(penv));
OpenRAVE::InterfaceBasePtr CreateInterfaceValidated(OpenRAVE::InterfaceType type, const std::string& interfacename, std::istream& sinput, OpenRAVE::EnvironmentBasePtr penv) {
if( type == OpenRAVE::PT_Module && interfacename == "openraveyarpcoupled" ) {
return OpenRAVE::InterfaceBasePtr(new OpenraveYarpCoupled(penv));
}
return InterfaceBasePtr();
return OpenRAVE::InterfaceBasePtr();
}

void GetPluginAttributesValidated(PLUGININFO& info) {
info.interfacenames[PT_Module].push_back("OpenraveYarpCoulped");
void GetPluginAttributesValidated(OpenRAVE::PLUGININFO& info) {
info.interfacenames[OpenRAVE::PT_Module].push_back("OpenraveYarpCoulped");
}

OPENRAVE_PLUGIN_API void DestroyPlugin() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@ option(ENABLE_OpenraveYarpForceEstimator "Enable/disable OpenraveYarpForceEstima

if(ENABLE_OpenraveYarpForceEstimator)

include_directories(${CMAKE_CURRENT_SOURCE_DIR}
${OpenRAVE_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS})
include_directories(${OpenRAVE_INCLUDE_DIRS})

link_directories(${OpenRAVE_LIBRARY_DIRS}
${Boost_LIBRARY_DIRS})
link_directories(${OpenRAVE_LIBRARY_DIRS})

add_library(OpenraveYarpForceEstimator MODULE OpenraveYarpForceEstimator.cpp)

Expand All @@ -20,6 +17,7 @@ set_target_properties(OpenraveYarpForceEstimator PROPERTIES COMPILE_OPTIONS "${O
target_link_libraries(OpenraveYarpForceEstimator YARP::YARP_OS
YARP::YARP_init
${OpenRAVE_LIBRARIES}
Boost::boost
ROBOTICSLAB::ColorDebug)

include(InstallOpenravePlugin)
Expand Down
Loading

0 comments on commit ebca8bd

Please sign in to comment.