Skip to content

Commit

Permalink
Implement yarp::dev::IRemoteVariables
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBowman committed Mar 11, 2019
1 parent a0a5a3e commit 0a8137c
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ yarp_add_plugin(YarpOpenraveControlboard YarpOpenraveControlboard.hpp
IPositionControlImpl.cpp
IPositionControl2Impl.cpp
IPositionDirectImpl.cpp
IRemoteVariablesImpl.cpp
ITorqueControlImpl.cpp
IVelocityControlImpl.cpp
IVelocityControl2Impl.cpp)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-

#include "YarpOpenraveControlboard.hpp"

#include <limits>

#include <ColorDebug.h>

// ------------------- IRemoteVariables Related ------------------------------------

bool roboticslab::YarpOpenraveControlboard::getRemoteVariable(std::string key, yarp::os::Bottle& val)
{
CD_DEBUG("%s\n", key.c_str());

val.clear();

if (key == "ptModeMs")
{
val.addDouble(std::numeric_limits<double>::max());
}

return true;
}

// -----------------------------------------------------------------------------

bool roboticslab::YarpOpenraveControlboard::setRemoteVariable(std::string key, const yarp::os::Bottle& val)
{
CD_DEBUG("%s\n", key.c_str());
return true;
}

// -----------------------------------------------------------------------------

bool roboticslab::YarpOpenraveControlboard::getRemoteVariablesList(yarp::os::Bottle* listOfKeys)
{
CD_DEBUG("\n");
listOfKeys->clear();
listOfKeys->addString("ptModeMs");
return true;
}

// -----------------------------------------------------------------------------
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ namespace roboticslab
*/
class YarpOpenraveControlboard : YarpOpenraveBase,
public yarp::dev::DeviceDriver,
public yarp::dev::IControlLimits2, //-- IControlLimits2 inherits from IControlLimits
public yarp::dev::IControlMode2, //-- IControlMode2 inherits from IControlMode
public yarp::dev::IEncodersTimed, //-- IEncodersTimed inherits from IEncoders
public yarp::dev::IPositionControl2, //-- IPositionControl2 inherits from IPositionControl
public yarp::dev::IControlLimits2,
public yarp::dev::IControlMode2,
public yarp::dev::IEncodersTimed,
public yarp::dev::IPositionControl2,
public yarp::dev::IPositionDirect,
public yarp::dev::ITorqueControl,
public yarp::dev::IVelocityControl2 //-- IVelocityControl2 inherits from IVelocityControl
public yarp::dev::IVelocityControl2,
public yarp::dev::IRemoteVariables
{
public:

Expand Down Expand Up @@ -640,6 +641,14 @@ class YarpOpenraveControlboard : YarpOpenraveBase,
virtual bool setBemfParam(int j, double bemf);
#endif // YARP_VERSION_MAJOR != 3

// ------- IRemoteVariables declarations. Implementation in IRemoteVariablesImpl.cpp -------

virtual bool getRemoteVariable(std::string key, yarp::os::Bottle& val);

virtual bool setRemoteVariable(std::string key, const yarp::os::Bottle& val);

virtual bool getRemoteVariablesList(yarp::os::Bottle* listOfKeys);

// -------- DeviceDriver declarations. Implementation in IDeviceImpl.cpp --------

/**
Expand Down

0 comments on commit 0a8137c

Please sign in to comment.