Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup interfaces #1691

Merged
merged 26 commits into from
May 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
29b1969
YARP_dev: deprecate ICalibrateControl2 in favour of ICalibrateControl.
Nicogene May 17, 2018
83f489d
YARP_dev: deprecate ICalibrateControl2Raw in favour of ICalibrateCont…
Nicogene May 17, 2018
2100ee9
YARP_dev: deprecate IFrameGrabberControl2 in favour of IFrameGrabberC…
Nicogene May 17, 2018
b0d7604
libYARP_dev: cleanup, remove unused class
Nicogene May 17, 2018
a4112fa
YARP_dev: rename vocab of IFrameGrabberControl after deprecating the "2"
Nicogene May 17, 2018
084e39b
YARP_dev: rename FrameGrabberControl2Impl after deprecating the "2"
Nicogene May 17, 2018
db680d4
YARP_dev: deprecate IControlLimits2 in favour of IControlLimits.
Nicogene May 18, 2018
ba881a6
YARP_dev: deprecate IControlLimits2Raw in favour of IControlLimitsRaw.
Nicogene May 18, 2018
655abc6
YARP_dev: deprecate ImplementControlLimits2 in favour of ImplementCon…
Nicogene May 18, 2018
7996b09
YARP_dev: deprecate IControlMode2 in favour of IControlMode.
Nicogene May 18, 2018
9de339f
YARP_dev: deprecate IControlMode2Raw in favour of IControlModeRaw.
Nicogene May 18, 2018
a64c8f4
YARP_dev: deprecate ImplementControlMode2 in favour of ImplementContr…
Nicogene May 18, 2018
b3f6bce
YARP_dev: deprecate IPositionControl2Raw in favour of IPositionContro…
Nicogene May 18, 2018
382541f
YARP_dev: deprecate IPositionControl2 in favour of IPositionControl.
Nicogene May 18, 2018
6a1ac29
YARP_dev: deprecate ImplementPositionControl2 in favour of ImplementP…
Nicogene May 18, 2018
c9228ba
YARP_dev: deprecate IVelocityControl2Raw in favour of IVelocityContro…
Nicogene May 18, 2018
9aa0871
YARP_dev: deprecate IVelocityControl2 in favour of IVelocityControl.
Nicogene May 18, 2018
57c500c
YARP_dev: deprecate ImplementVelocityControl2 in favour of ImplementV…
Nicogene May 18, 2018
964a28d
ControlBoardRemapperTest: cleanup after deprecations
Nicogene May 18, 2018
db6d063
Devices: fix Fakebot after the cleanup of interfaces
Nicogene May 19, 2018
774b563
Devices: fix SerialServoBoard after the cleanup of interfaces
Nicogene May 19, 2018
28541b7
bindings: fix after the cleaning of interfaces
Nicogene May 21, 2018
af914db
Increase tweak number
Nicogene May 21, 2018
e967e4d
Update release notes
Nicogene May 21, 2018
0fad66a
YARP_dev: cleanup after deprecation cleanupInterfaces
Nicogene May 22, 2018
fc375ee
YARP_dev: added VOCAB_FRAMEGRABBER_CONTROL_DC1394
Nicogene May 22, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ list(APPEND CMAKE_MODULE_PATH ${YARP_MODULE_PATH})

# Main project
project(YARP
VERSION 2.3.73.2
VERSION 2.3.73.3
LANGUAGES C CXX)
set(PROJECT_DESCRIPTION "YARP: A thin middleware for humanoid robots and more")

Expand Down
86 changes: 84 additions & 2 deletions bindings/yarp.i
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,9 @@ 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/IEncoders.h>
%include <yarp/dev/IMotorEncoders.h>
%include <yarp/dev/ITorqueControl.h>
Expand All @@ -430,7 +432,9 @@ 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
%include <yarp/dev/FrameGrabberControl2.h>
#endif
%include <yarp/dev/IPidControl.h>
%include <yarp/dev/IPositionDirect.h>

Expand Down Expand Up @@ -786,12 +790,13 @@ typedef yarp::os::BufferedPort<ImageRgbFloat> BufferedPortImageRgbFloat;
self->view(result);
return result;
}

#ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
yarp::dev::IControlMode2 *viewIControlMode2() {
yarp::dev::IControlMode2 *result;
self->view(result);
return result;
}
#endif

yarp::dev::IPWMControl *viewIPWMControl() {
yarp::dev::IPWMControl *result;
Expand All @@ -810,12 +815,18 @@ typedef yarp::os::BufferedPort<ImageRgbFloat> BufferedPortImageRgbFloat;
self->view(result);
return result;
}

#ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
yarp::dev::IFrameGrabberControls2 *viewIFrameGrabberControls2() {
yarp::dev::IFrameGrabberControls2 *result;
self->view(result);
return result;
}
#endif
yarp::dev::IFrameGrabberControls *viewIFrameGrabberControls() {
yarp::dev::IFrameGrabberControls *result;
self->view(result);
return result;
}

yarp::dev::IPositionDirect *viewIPositionDirect() {
yarp::dev::IPositionDirect *result;
Expand Down Expand Up @@ -1065,8 +1076,21 @@ typedef yarp::os::BufferedPort<ImageRgbFloat> BufferedPortImageRgbFloat;
bool getControlModes(std::vector<int>& data) {
return self->getControlModes(&data[0]);
}

bool getControlModes(int n_joint, std::vector<int>& joints, std::vector<int>& data) {
return self->getControlModes(n_joint, &joints[0], &data[0]);
}

bool setControlModes(std::vector<int>& data) {
return self->setControlModes(&data[0]);
}

bool setControlModes(int n_joint, std::vector<int>& joints, std::vector<int>& data) {
return self->setControlModes(n_joint, &joints[0], &data[0]);
}
}

#ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
%extend yarp::dev::IControlMode2 {
bool getControlModes(int n_joint, std::vector<int>& joints, std::vector<int>& data) {
return self->getControlModes(n_joint, &joints[0], &data[0]);
Expand All @@ -1080,6 +1104,7 @@ typedef yarp::os::BufferedPort<ImageRgbFloat> BufferedPortImageRgbFloat;
return self->setControlModes(n_joint, &joints[0], &data[0]);
}
}
#endif

%extend yarp::dev::IPositionDirect {
int getAxes() {
Expand Down Expand Up @@ -1383,7 +1408,63 @@ public:

//////////////////////////////////////////////////////////////////////////
// Deal with IFrameGrabberControls2 pointer arguments that don't translate
%extend yarp::dev::IFrameGrabberControls {
CameraDescriptor getCameraDescription() {
CameraDescriptor result;
self->getCameraDescription(&result);
return result;
}

bool hasFeature(int feature) {
bool result;
self->hasFeature(feature, &result);
return result;
}

double getFeature(int feature) {
double result;
self->getFeature(feature, &result);
return result;
}

bool hasOnOff(int feature) {
bool result;
self->hasOnOff(feature, &result);
return result;
}

bool getActive(int feature) {
bool result;
self->getActive(feature, &result);
return result;
}

bool hasAuto(int feature) {
bool result;
self->hasAuto(feature, &result);
return result;
}

bool hasManual(int feature) {
bool result;
self->hasManual(feature, &result);
return result;
}

bool hasOnePush(int feature) {
bool result;
self->hasOnePush(feature, &result);
return result;
}

FeatureMode getMode(int feature) {
FeatureMode result;
self->getMode(feature, &result);
return result;
}
}

#ifndef YARP_NO_DEPRECATED // Since YARP 3.0.0
%extend yarp::dev::IFrameGrabberControls2 {
CameraDescriptor getCameraDescription() {
CameraDescriptor result;
Expand Down Expand Up @@ -1439,3 +1520,4 @@ public:
return result;
}
}
#endif
25 changes: 24 additions & 1 deletion doc/release/v3_0_0.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ Important Changes
* `/yarp/dev/ServerSerial.h`
* `/yarp/dev/ServerSoundGrabber.h`
* `/yarp/dev/TestMotor.h`
* `/yarp/dev/RemoteFrameGrabberDC1394.h`
* A class of interfaces to wrap multiple analog sensors is now available in:
* `/yarp/dev/MultipleAnalogSensorsInterfaces.h`
* The devices `multipleanalogsensorsserver`, `multipleanalogsensorsclient` and
Expand All @@ -122,7 +123,29 @@ Important Changes
interface.
* Removed all control board interfaces methods e.g. `setTorquePid()`,
`setPositionMode()` etc, marked as deprecated since 2.3.70
* In ControlBoardWrapper functions for all joints invoke the equivalent function for all joints of motion control device. In the previous versions, that funcions call the equivalent function single-joint in a for-cicle, so the function for all joints in motion control devices have never been called. So please, check the implementation of function for all joints in your motion control device because now they will be invoked for the fisrt time.
* In ControlBoardWrapper functions for all joints invoke the equivalent function
for all joints of motion control device. In the previous versions, that
function call the equivalent function single-joint in a for-cicle, so the
function for all joints in motion control devices have never been called.
So please, check the implementation of function for all joints in your motion
control device because now they will be invoked for the fisrt time.
* The following classes have been deprecated:
- `ICalibrateControl2` in favour of `ICalibrateControl`.
- `ICalibrateControl2Raw` in favour of `ICalibrateControlRaw`.
- `IFrameGrabberControl2` in favour of `IFrameGrabberControl.`
- `FrameGrabberControl2Impl` in favour of `FrameGrabberControlImpl`
- `IControlLimits2` in favour of `IControlLimits`.
- `IControlLimits2Raw` in favour of `IControlLimitsRaw`.
- `ImplementControlLimits2` in favour of `ImplementControlLimits`.
- `IControlMode2` in favour of `IControlMode`.
- `IControlMode2Raw` in favour of `IControlModeRaw`.
- `ImplementControlMode2` in favour of `ImplementControlMode`.
- `IPositionControl2Raw` in favour of `IPositionControlRaw`.
- `IPositionControl2` in favour of `IPositionControl`.
- `ImplementPositionControl2` in favour of `ImplementPositionControl`.
- `IVelocityControl2Raw` in favour of `IVelocityControlRaw`.
- `IVelocityControl2` in favour of `IVelocityControl`.
- `ImplementVelocityControl2` in favour of `ImplementVelocityControl`.

#### `YARP_sig`

Expand Down
24 changes: 24 additions & 0 deletions src/devices/SerialServoBoard/SerialServoBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,30 @@ bool SerialServoBoard::stop() {
return true;
}

bool SerialServoBoard::positionMove(const int n_joint, const int *joints, const double *refs) {
return true;
}
bool SerialServoBoard::relativeMove(const int n_joint, const int *joints, const double *deltas) {
return true;
}
bool SerialServoBoard::checkMotionDone(const int n_joint, const int *joints, bool *flags) {
return true;
}
bool SerialServoBoard::setRefSpeeds(const int n_joint, const int *joints, const double *spds) {
return true;
}
bool SerialServoBoard::setRefAccelerations(const int n_joint, const int *joints, const double *accs) {
return true;
}
bool SerialServoBoard::getRefSpeeds(const int n_joint, const int *joints, double *spds) {
return true;
}
bool SerialServoBoard::getRefAccelerations(const int n_joint, const int *joints, double *accs) {
return true;
}
bool SerialServoBoard::stop(const int n_joint, const int *joints) {
return true;
}



Expand Down
8 changes: 8 additions & 0 deletions src/devices/SerialServoBoard/SerialServoBoard.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ class SerialServoBoard : public DeviceDriver, public IPositionControl {
bool getRefAccelerations(double *accs) override;
bool stop(int j) override;
bool stop() override;
virtual bool positionMove(const int n_joint, const int *joints, const double *refs) override;
virtual bool relativeMove(const int n_joint, const int *joints, const double *deltas) override;
virtual bool checkMotionDone(const int n_joint, const int *joints, bool *flags) override;
virtual bool setRefSpeeds(const int n_joint, const int *joints, const double *spds) override;
virtual bool setRefAccelerations(const int n_joint, const int *joints, const double *accs) override;
virtual bool getRefSpeeds(const int n_joint, const int *joints, double *spds) override;
virtual bool getRefAccelerations(const int n_joint, const int *joints, double *accs) override;
virtual bool stop(const int n_joint, const int *joints) override;

virtual bool open(Searchable& config) override {
if(config.check("help")==true) {
Expand Down
6 changes: 3 additions & 3 deletions src/devices/depthCamera/depthCameraDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace yarp
* @ingroup dev_impl_media
*
*
* This device is a YARP plugin for OpenNI2 compatible devices, and exposes the IRGBDSensor and IFrameGrabberControls2
* This device is a YARP plugin for OpenNI2 compatible devices, and exposes the IRGBDSensor and IFrameGrabberControls
* interfaces to read the images and operate on the available settings.
*
* See the documentation for more details about each interface.
Expand Down Expand Up @@ -184,7 +184,7 @@ transformation (1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.

class yarp::dev::depthCameraDriver : public yarp::dev::DeviceDriver,
public yarp::dev::IRGBDSensor,
public yarp::dev::IFrameGrabberControls2
public yarp::dev::IFrameGrabberControls
{
private:
typedef yarp::sig::ImageOf<yarp::sig::PixelFloat> depthImage;
Expand Down Expand Up @@ -237,7 +237,7 @@ class yarp::dev::depthCameraDriver : public yarp::dev::DeviceDriver,
virtual RGBDSensor_status getSensorStatus() override;
virtual std::string getLastErrorMsg(Stamp* timeStamp = NULL) override;

//IFrameGrabberControls2
//IFrameGrabberControls
virtual bool getCameraDescription(CameraDescriptor *camera) override;
virtual bool hasFeature(int feature, bool* hasFeature) override;
virtual bool setFeature(int feature, double value) override;
Expand Down
34 changes: 17 additions & 17 deletions src/devices/fakeMotionControl/fakeMotionControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,17 +355,17 @@ bool FakeMotionControl::dealloc()

FakeMotionControl::FakeMotionControl() :
RateThread(10.0),
ImplementControlCalibration2<FakeMotionControl, IControlCalibration2>(this),
ImplementControlCalibration<FakeMotionControl, IControlCalibration>(this),
ImplementAmplifierControl<FakeMotionControl, IAmplifierControl>(this),
ImplementPidControl(this),
ImplementEncodersTimed(this),
ImplementPositionControl2(this),
ImplementVelocityControl2(this),
ImplementControlMode2(this),
ImplementPositionControl(this),
ImplementVelocityControl(this),
ImplementControlMode(this),
ImplementImpedanceControl(this),
ImplementMotorEncoders(this),
ImplementTorqueControl(this),
ImplementControlLimits2(this),
ImplementControlLimits(this),
ImplementPositionDirect(this),
ImplementInteractionMode(this),
ImplementCurrentControl(this),
Expand Down Expand Up @@ -583,17 +583,17 @@ bool FakeMotionControl::open(yarp::os::Searchable &config)

ControlBoardHelper cb(_njoints, _axisMap, _angleToEncoder, nullptr, _newtonsToSensor, _ampsToSensor, _dutycycleToPWM);
ControlBoardHelper cb_copy_test(cb);
ImplementControlCalibration2<FakeMotionControl, IControlCalibration2>::initialize(_njoints, _axisMap, _angleToEncoder, nullptr);
ImplementControlCalibration<FakeMotionControl, IControlCalibration>::initialize(_njoints, _axisMap, _angleToEncoder, nullptr);
ImplementAmplifierControl<FakeMotionControl, IAmplifierControl>::initialize(_njoints, _axisMap, _angleToEncoder, nullptr);
ImplementEncodersTimed::initialize(_njoints, _axisMap, _angleToEncoder, nullptr);
ImplementMotorEncoders::initialize(_njoints, _axisMap, _angleToEncoder, nullptr);
ImplementPositionControl2::initialize(_njoints, _axisMap, _angleToEncoder, nullptr);
ImplementPositionControl::initialize(_njoints, _axisMap, _angleToEncoder, nullptr);
ImplementPidControl::initialize(_njoints, _axisMap, _angleToEncoder, nullptr, _newtonsToSensor, _ampsToSensor, _dutycycleToPWM);
ImplementPidControl::setConversionUnits(PidControlTypeEnum::VOCAB_PIDTYPE_POSITION, PidFeedbackUnitsEnum::METRIC, PidOutputUnitsEnum::DUTYCYCLE_PWM_PERCENT);
ImplementPidControl::setConversionUnits(PidControlTypeEnum::VOCAB_PIDTYPE_TORQUE, PidFeedbackUnitsEnum::METRIC, PidOutputUnitsEnum::DUTYCYCLE_PWM_PERCENT);
ImplementControlMode2::initialize(_njoints, _axisMap);
ImplementVelocityControl2::initialize(_njoints, _axisMap, _angleToEncoder, nullptr);
ImplementControlLimits2::initialize(_njoints, _axisMap, _angleToEncoder, nullptr);
ImplementControlMode::initialize(_njoints, _axisMap);
ImplementVelocityControl::initialize(_njoints, _axisMap, _angleToEncoder, nullptr);
ImplementControlLimits::initialize(_njoints, _axisMap, _angleToEncoder, nullptr);
ImplementImpedanceControl::initialize(_njoints, _axisMap, _angleToEncoder, nullptr, _newtonsToSensor);
ImplementTorqueControl::initialize(_njoints, _axisMap, _angleToEncoder, nullptr, _newtonsToSensor, _ampsToSensor, _dutycycleToPWM, bemfToRaw.data(), ktauToRaw.data());
ImplementPositionDirect::initialize(_njoints, _axisMap, _angleToEncoder, nullptr);
Expand Down Expand Up @@ -1453,16 +1453,16 @@ bool FakeMotionControl::close()
{
yTrace() << " FakeMotionControl::close()";

ImplementControlMode2::uninitialize();
ImplementControlMode::uninitialize();
ImplementEncodersTimed::uninitialize();
ImplementMotorEncoders::uninitialize();
ImplementPositionControl2::uninitialize();
ImplementVelocityControl2::uninitialize();
ImplementPositionControl::uninitialize();
ImplementVelocityControl::uninitialize();
ImplementPidControl::uninitialize();
ImplementControlCalibration2<FakeMotionControl, IControlCalibration2>::uninitialize();
ImplementControlCalibration<FakeMotionControl, IControlCalibration>::uninitialize();
ImplementAmplifierControl<FakeMotionControl, IAmplifierControl>::uninitialize();
ImplementImpedanceControl::uninitialize();
ImplementControlLimits2::uninitialize();
ImplementControlLimits::uninitialize();
ImplementTorqueControl::uninitialize();
ImplementPositionDirect::uninitialize();
ImplementInteractionMode::uninitialize();
Expand Down Expand Up @@ -1882,9 +1882,9 @@ bool FakeMotionControl::setCalibrationParametersRaw(int j, const CalibrationPara
return true;
}

bool FakeMotionControl::calibrate2Raw(int j, unsigned int type, double p1, double p2, double p3)
bool FakeMotionControl::calibrateRaw(int j, unsigned int type, double p1, double p2, double p3)
{
yTrace() << "calibrate2Raw for joint" << j;
yTrace() << "calibrateRaw for joint" << j;
return true;
}

Expand Down
Loading