Skip to content

Commit

Permalink
dev: Deprecate headers
Browse files Browse the repository at this point in the history
* Deprecate the IVisualParams.h file in favour of I{Rgb,Depth}VisualParams.h.
* Deprecate files for deprecated interfaces.
* Fix `INCLUDING_ON_PURPOSE` macros when deprecated files are included recursively.
  • Loading branch information
drdanz committed Jun 11, 2021
1 parent de89bbe commit ae370c4
Show file tree
Hide file tree
Showing 51 changed files with 570 additions and 420 deletions.
4 changes: 2 additions & 2 deletions bindings/lua/examples/driver_qos.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ if ipos == nil then
os.exit()
end

icm = driver:viewIControlMode2()
icm = driver:viewIControlMode()
if icm == nil then
print("Cannot open the IControlMode2 interface");
print("Cannot open the IControlMode interface");
driver:close()
os.exit()
end
Expand Down
30 changes: 15 additions & 15 deletions bindings/yarp.i
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,6 @@ void setExternal2(yarp::sig::Image *img, PyObject* mem, int w, int h) {
%include <yarp/os/Semaphore.h>
%include <yarp/os/Thread.h>
%include <yarp/os/PeriodicThread.h>
#ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
%include <yarp/os/RateThread.h>
#endif
%include <yarp/os/Time.h>
%include <yarp/os/RFModule.h>
%include <yarp/os/Stamp.h>
Expand All @@ -373,6 +370,10 @@ void setExternal2(yarp::sig::Image *img, PyObject* mem, int w, int h) {
%include <yarp/os/Wire.h>
%include <yarp/os/WireLink.h>

#ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
%include <yarp/os/RateThread.h>
#endif

%define MAKE_COMMS(name)
%feature("notabstract") yarp::os::BufferedPort<name>;
%feature("notabstract") BufferedPort ## name;
Expand All @@ -399,10 +400,6 @@ MAKE_COMMS(Bottle)
%include <yarp/dev/DeviceDriver.h>
%include <yarp/dev/PolyDriver.h>
%include <yarp/dev/Drivers.h>
#ifndef YARP_NO_DEPRECATED // Since YARP 3.5.0
%include <yarp/dev/IFrameGrabber.h>
%include <yarp/dev/IFrameGrabberRgb.h>
#endif YARP_NO_DEPRECATED // Since YARP 3.5.0
%include <yarp/dev/IFrameGrabberImage.h>
%include <yarp/dev/IFrameGrabberControls.h>
%include <yarp/dev/IFrameGrabberControlsDC1394.h>
Expand All @@ -421,9 +418,6 @@ MAKE_COMMS(Bottle)
%include <yarp/dev/CalibratorInterfaces.h>
%include <yarp/dev/ControlBoardPid.h>
%include <yarp/dev/IControlMode.h>
#ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
%include <yarp/dev/IControlMode2.h>
#endif
%include <yarp/dev/IInteractionMode.h>
%include <yarp/dev/IEncodersTimed.h>
%include <yarp/dev/IMotor.h>
Expand All @@ -435,15 +429,21 @@ MAKE_COMMS(Bottle)
%include <yarp/dev/ICurrentControl.h>
%include <yarp/dev/IAnalogSensor.h>
%include <yarp/dev/IRemoteVariables.h>
#ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
#define YARP_INCLUDING_DEPRECATED_HEADER_ON_PURPOSE
%include <yarp/dev/FrameGrabberControl2.h>
#undef YARP_INCLUDING_DEPRECATED_HEADER_ON_PURPOSE
#endif
%include <yarp/dev/IPidControl.h>
%include <yarp/dev/IPositionDirect.h>
%include <yarp/dev/MultipleAnalogSensorsInterfaces.h>

#ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
%include <yarp/dev/FrameGrabberControl2.h>
%include <yarp/dev/IControlMode2.h>
#endif

#ifndef YARP_NO_DEPRECATED // Since YARP 3.5.0
%include <yarp/dev/IFrameGrabber.h>
%include <yarp/dev/IFrameGrabberRgb.h>
#endif YARP_NO_DEPRECATED // Since YARP 3.5.0


%template(DVector) std::vector<double>;
%template(BVector) std::vector<bool>;
%template(SVector) std::vector<std::string>;
Expand Down
7 changes: 3 additions & 4 deletions src/devices/ControlBoardRemapper/ControlBoardRemapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3590,7 +3590,7 @@ bool ControlBoardRemapper::getControlModes(int *modes)
return ret;
}

// iControlMode2
// IControlMode interface
bool ControlBoardRemapper::getControlModes(const int n_joints, const int *joints, int *modes)
{
bool ret=true;
Expand Down Expand Up @@ -3867,9 +3867,8 @@ bool ControlBoardRemapper::getRefPositions(const int n_joints, const int *joints
}


//
// IVelocityControl2 Interface
//

// IVelocityControl interface
bool ControlBoardRemapper::velocityMove(const int n_joints, const int *joints, const double *spds)
{
bool ret=true;
Expand Down
6 changes: 2 additions & 4 deletions src/devices/ControlBoardRemapper/ControlBoardRemapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ class ControlBoardRemapper :

bool getControlModes(int *modes) override;

// iControlMode2
// IControlMode interface
bool getControlModes(const int n_joint, const int *joints, int *modes) override;

bool setControlMode(const int j, const int mode) override;
Expand All @@ -525,9 +525,7 @@ class ControlBoardRemapper :

yarp::os::Stamp getLastInputStamp() override;

//
// IVelocityControl2 Interface
//
// IVelocityControl interface
bool velocityMove(const int n_joints, const int *joints, const double *spds) override;

bool getRefVelocity(const int joint, double *vel) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,13 @@ bool RemappedSubControlBoard::attach(yarp::dev::PolyDriver *d, const std::string
// checking minimum set of intefaces required
if( !(pos) )
{
yCError(CONTROLBOARDREMAPPER, "IPositionControl2 interface was not found in subdevice. Quitting");
yCError(CONTROLBOARDREMAPPER, "IPositionControl interface was not found in subdevice. Quitting");
return false;
}

if( ! (vel) )
{
yCError(CONTROLBOARDREMAPPER, "IVelocityControl2 interface was not found in subdevice. Quitting");
yCError(CONTROLBOARDREMAPPER, "IVelocityControl interface was not found in subdevice. Quitting");
return false;
}

Expand All @@ -190,7 +190,7 @@ bool RemappedSubControlBoard::attach(yarp::dev::PolyDriver *d, const std::string

if(!iMode)
{
yCError(CONTROLBOARDREMAPPER, "IControlMode2 interface was not found in subdevice, exiting.");
yCError(CONTROLBOARDREMAPPER, "IControlMode interface was not found in subdevice, exiting.");
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <yarp/dev/ControlBoardInterfaces.h>
#include <yarp/dev/IInteractionMode.h>
#include <yarp/dev/IControlLimits2.h>
#include <yarp/dev/IControlLimits.h>
#include <yarp/dev/PolyDriver.h>
#include <yarp/dev/IPreciselyTimed.h>

Expand Down
2 changes: 1 addition & 1 deletion src/devices/ControlBoardWrapper/RPCMessagesParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ void RPCMessagesParser::handleControlModeMsg(const yarp::os::Bottle& cmd,
// try to be compatible as much as I can

yCError(CONTROLBOARD) << " Error, received a set control mode message using a legacy version, trying to be handle the message anyway "
<< " but please update your client to be compatible with the IControlMode2 interface";
<< " but please update your client to be compatible with the IControlMode interface";

yCTrace(CONTROLBOARD) << " cmd.get(4).asVocab() is " << Vocab::decode(cmd.get(4).asVocab());
int axis = cmd.get(3).asInt32();
Expand Down
2 changes: 1 addition & 1 deletion src/devices/ControlBoardWrapper/SubDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ bool SubDevice::attach(yarp::dev::PolyDriver* d, const std::string& k)
}

if (!vel) {
yCError(CONTROLBOARD, "Part <%s>: IVelocityControl nor IVelocityControl2 interface was not found in subdevice. Quitting", parentName.c_str());
yCError(CONTROLBOARD, "Part <%s>: IVelocityControl interface was not found in subdevice. Quitting", parentName.c_str());
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/devices/RGBDSensorClient/RGBDSensorClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <yarp/os/Portable.h>
#include <yarp/os/LogComponent.h>
#include <yarp/os/LogStream.h>
#include <yarp/dev/GenericVocabs.h>
#include <yarp/proto/framegrabber/CameraVocabs.h>

using namespace yarp::os;
using namespace yarp::sig;
Expand Down
7 changes: 6 additions & 1 deletion src/devices/ServerFrameGrabber/ServerFrameGrabber.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@
#include <yarp/os/Vocab.h>
#include <yarp/os/Bottle.h>

// #define YARP_INCLUDING_DEPRECATED_HEADER_YARP_OS_RATETHREAD_H_ON_PURPOSE
#define YARP_INCLUDING_DEPRECATED_HEADER_ON_PURPOSE
#include <yarp/os/RateThread.h>
#include <yarp/dev/DataSource.h>
#undef YARP_INCLUDING_DEPRECATED_HEADER_ON_PURPOSE
// #undef YARP_INCLUDING_DEPRECATED_HEADER_YARP_OS_RATETHREAD_H_ON_PURPOSE

#define YARP_INCLUDING_DEPRECATED_HEADER_YARP_DEV_DATASOURCE_H_ON_PURPOSE
#include <yarp/dev/DataSource.h>
#undef YARP_INCLUDING_DEPRECATED_HEADER_YARP_DEV_DATASOURCE_H_ON_PURPOSE

#include <yarp/proto/framegrabber/RgbVisualParams_Responder.h>
#include <yarp/proto/framegrabber/FrameGrabberControls_Responder.h>
Expand Down
2 changes: 1 addition & 1 deletion src/devices/fakeFrameGrabber/FakeFrameGrabber.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <yarp/os/Vocab.h>
#include <yarp/os/Log.h>
#include <yarp/os/Value.h>
#include <yarp/dev/IVisualParams.h>
#include <yarp/dev/IRgbVisualParams.h>

#include <cstdio>
#include <random>
Expand Down
4 changes: 2 additions & 2 deletions src/devices/fakeMotionControl/fakeMotionControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2714,7 +2714,7 @@ bool FakeMotionControl::getJointTypeRaw(int axis, yarp::dev::JointTypeEnum& type
}
}

// IControlLimits2
// IControlLimits
bool FakeMotionControl::setVelLimitsRaw(int axis, double min, double max)
{
return NOT_YET_IMPLEMENTED("setVelLimitsRaw");
Expand Down Expand Up @@ -2827,7 +2827,7 @@ bool FakeMotionControl::setMotorTorqueParamsRaw(int j, const MotorTorqueParamete
return true;
}

// IVelocityControl2
// IVelocityControl interface
bool FakeMotionControl::velocityMoveRaw(const int n_joint, const int *joints, const double *spds)
{
bool ret = true;
Expand Down
4 changes: 3 additions & 1 deletion src/devices/fakeMotionControl/fakeMotionControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <yarp/dev/ControlBoardInterfacesImpl.h>
#include <yarp/dev/IVirtualAnalogSensor.h>
#include <yarp/dev/ImplementVirtualAnalogSensor.h>
#include <yarp/dev/ImplementPositionControl.h>
#include <yarp/dev/ImplementVelocityControl.h>

#include <mutex>

Expand Down Expand Up @@ -432,7 +434,7 @@ class FakeMotionControl :
bool setMotorTorqueParamsRaw(int j, const yarp::dev::MotorTorqueParameters params) override;
// int32_t getRefSpeedInTbl(uint8_t boardNum, int j, eOmeas_position_t pos) override;

// IVelocityControl2
// IVelocityControl interface
bool velocityMoveRaw(const int n_joint, const int *joints, const double *spds) override;
bool getRefVelocityRaw(const int joint, double *ref) override;
bool getRefVelocitiesRaw(double *refs) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@
*/
constexpr yarp::conf::vocab32_t VOCAB_FRAMEGRABBER_IMAGE = yarp::os::createVocab('f','g','i');
constexpr yarp::conf::vocab32_t VOCAB_FRAMEGRABBER_IMAGERAW = yarp::os::createVocab('f','g','i','r');

constexpr yarp::conf::vocab32_t VOCAB_RGB_VISUAL_PARAMS = yarp::os::createVocab('v','i','s','r');
constexpr yarp::conf::vocab32_t VOCAB_DEPTH_VISUAL_PARAMS = yarp::os::createVocab('v','i','s','d');
constexpr yarp::conf::vocab32_t VOCAB_RGBD_SENSOR = yarp::os::createVocab('r','g','d','b');
constexpr yarp::conf::vocab32_t VOCAB_RGBD_PROTOCOL_VERSION = yarp::os::createVocab('p','r','o','t');

/*
* Generic capabilities defines
*/

constexpr yarp::conf::vocab32_t VOCAB_BRIGHTNESS = yarp::os::createVocab('b','r','i');
constexpr yarp::conf::vocab32_t VOCAB_EXPOSURE = yarp::os::createVocab('e','x','p','o');
constexpr yarp::conf::vocab32_t VOCAB_SHARPNESS = yarp::os::createVocab('s','h','a','r');
Expand Down Expand Up @@ -99,4 +101,28 @@ constexpr yarp::conf::vocab32_t VOCAB_DRSETCAP = yarp::os::createVocab('D','R','
constexpr yarp::conf::vocab32_t VOCAB_DRSETBPP = yarp::os::createVocab('D','R','2','N'); // 39
constexpr yarp::conf::vocab32_t VOCAB_DRGETBPP = yarp::os::createVocab('D','R','2','O'); // 40


// Rgb and depth
constexpr yarp::conf::vocab32_t VOCAB_RGB = yarp::os::createVocab('r','g','b');
constexpr yarp::conf::vocab32_t VOCAB_DEPTH = yarp::os::createVocab('d','e','p','t');
constexpr yarp::conf::vocab32_t VOCAB_MIRROR = yarp::os::createVocab('m','i','r','r');

// Methods
constexpr yarp::conf::vocab32_t VOCAB_RESOLUTION = yarp::os::createVocab('r','e','s');
constexpr yarp::conf::vocab32_t VOCAB_FOV = yarp::os::createVocab('f','o','v');
constexpr yarp::conf::vocab32_t VOCAB_INTRINSIC_PARAM = yarp::os::createVocab('i','n','t','p');
constexpr yarp::conf::vocab32_t VOCAB_SUPPORTED_CONF = yarp::os::createVocab('c','o','n','f');

// Depth only
constexpr yarp::conf::vocab32_t VOCAB_ACCURACY = yarp::os::createVocab('a','c','r','c');
constexpr yarp::conf::vocab32_t VOCAB_CLIP_PLANES = yarp::os::createVocab('c','l','i','p');

// IRGBDSensor Methods
constexpr yarp::conf::vocab32_t VOCAB_EXTRINSIC_PARAM = yarp::os::createVocab('e','x','t');
constexpr yarp::conf::vocab32_t VOCAB_ERROR_MSG = yarp::os::createVocab('m','e','s','s');
constexpr yarp::conf::vocab32_t VOCAB_RGB_IMAGE = yarp::os::createVocab('i','m','g','r');
constexpr yarp::conf::vocab32_t VOCAB_DEPTH_IMAGE = yarp::os::createVocab('i','m','g','d');
constexpr yarp::conf::vocab32_t VOCAB_IMAGES = yarp::os::createVocab('i','m','m','s');
constexpr yarp::conf::vocab32_t VOCAB_STATUS = yarp::os::createVocab('s','t','a','t');

#endif // YARP_FRAMEGRABBER_PROTOCOL_CAMERAVOCABS_H
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef YARP_FRAMEGRABBER_PROTOCOL_DEPTHVISUALPARAMS_FORWARDER_H
#define YARP_FRAMEGRABBER_PROTOCOL_DEPTHVISUALPARAMS_FORWARDER_H

#include <yarp/dev/IVisualParams.h>
#include <yarp/dev/IDepthVisualParams.h>
#include <yarp/os/Port.h>

namespace yarp {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define YARP_FRAMEGRABBER_PROTOCOL_DEPTHVISUALPARAMS_RESPONDER_H

#include <yarp/dev/DeviceDriver.h>
#include <yarp/dev/IVisualParams.h>
#include <yarp/dev/IDepthVisualParams.h>

namespace yarp {
namespace proto {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#ifndef YARP_FRAMEGRABBER_PROTOCOL_RGBVISUALPARAMS_FORWARDER_H
#define YARP_FRAMEGRABBER_PROTOCOL_RGBVISUALPARAMS_FORWARDER_H

#include <yarp/dev/IVisualParams.h>
#include <yarp/dev/IRgbVisualParams.h>
#include <yarp/os/Port.h>

namespace yarp {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#define YARP_FRAMEGRABBER_PROTOCOL_RGBVISUALPARAMS_RESPONDER_H

#include <yarp/dev/DeviceDriver.h>
#include <yarp/dev/IVisualParams.h>
#include <yarp/dev/IRgbVisualParams.h>

namespace yarp {
namespace proto {
Expand Down
2 changes: 1 addition & 1 deletion src/devices/usbCamera/common/USBcamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <yarp/dev/DeviceDriver.h>
#include <yarp/dev/IFrameGrabberControls.h>
#include <yarp/dev/IFrameGrabberImage.h>
#include <yarp/dev/IVisualParams.h>
#include <yarp/dev/IRgbVisualParams.h>
#include <yarp/dev/IPreciselyTimed.h>

/**
Expand Down
2 changes: 1 addition & 1 deletion src/devices/usbCamera/linux/V4L_camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <yarp/dev/DeviceDriver.h>
#include <yarp/dev/IFrameGrabberImage.h>
#include <yarp/dev/IFrameGrabberControls.h>
#include <yarp/dev/IVisualParams.h>
#include <yarp/dev/IRgbVisualParams.h>
#include <yarp/dev/IPreciselyTimed.h>

#include <asm/types.h>
Expand Down
Loading

0 comments on commit ae370c4

Please sign in to comment.