From 6d2f382585937416deb3dc3d0b0151d6d332782f Mon Sep 17 00:00:00 2001 From: Marco Randazzo Date: Mon, 5 Feb 2024 20:31:39 +0100 Subject: [PATCH] added log/extra cleanup --- doc/release/master.md | 10 +++++++++- src/devices/deviceBundler/DeviceBundler.cpp | 10 +++++----- src/devices/deviceBundler/DeviceBundler.h | 2 +- .../deviceBundler/DeviceBundler_ParamsParser.cpp | 2 +- src/devices/deviceBundler/DeviceBundler_params.md | 2 +- src/devices/map2DStorage/map2DStorage.h | 3 --- src/libYARP_dev/src/yarp/dev/Drivers.cpp | 13 +++++++++++++ 7 files changed, 30 insertions(+), 12 deletions(-) diff --git a/doc/release/master.md b/doc/release/master.md index a8317fccdfe..f646cf6762c 100644 --- a/doc/release/master.md +++ b/doc/release/master.md @@ -22,6 +22,7 @@ Deprecations and removals * Removed library `libYARP_wire_rep_utils`. * Removed `extern/md5` * Removed `extern/ros` messages and examples. +* The syntax yarpdev --device xxx --subdevice yyy has been deprecated. See discussion: https://github.com/robotology/yarp/discussions/3078 Fixes ----- @@ -31,4 +32,11 @@ Fixes New Features ------------ -* Added new command line tool `yarpDeviceParamParserGenerator`. See official yarp documentation (cmd_yarpDeviceParamParserGenerator.dox) \ No newline at end of file +* Added new command line tool `yarpDeviceParamParserGenerator`. See official yarp documentation (cmd_yarpDeviceParamParserGenerator.dox) + +### Devices + +#### deviceBundler + +* Added new device `deviceBundler` which can be useful to open two devices and attach them while using a single yarpdev command line. + See https://github.com/robotology/yarp/discussions/3078 \ No newline at end of file diff --git a/src/devices/deviceBundler/DeviceBundler.cpp b/src/devices/deviceBundler/DeviceBundler.cpp index 9a232205631..010b379aa91 100644 --- a/src/devices/deviceBundler/DeviceBundler.cpp +++ b/src/devices/deviceBundler/DeviceBundler.cpp @@ -37,7 +37,7 @@ bool DeviceBundler::open(yarp::os::Searchable& config) ret = m_pdev_wrapper.open(config_wrap); if (!ret || !m_pdev_wrapper.isValid()) { - yCError(DEVICEBUNDLER, "Unable to open device:%s", m_wrapper_device); + yCError(DEVICEBUNDLER, "Unable to open device:%s", m_wrapper_device.c_str()); return false; } @@ -49,7 +49,7 @@ bool DeviceBundler::open(yarp::os::Searchable& config) ret = m_pdev_subdevice.open(config_sub); if (!ret || !m_pdev_subdevice.isValid()) { - yCError(DEVICEBUNDLER, "Unable to open subdevice:%s", m_attached_device); + yCError(DEVICEBUNDLER, "Unable to open subdevice:%s", m_attached_device.c_str()); return false; } @@ -63,18 +63,18 @@ bool DeviceBundler::open(yarp::os::Searchable& config) ret = m_pdev_wrapper.view(m_iWrapper); if (!ret) { - yCError(DEVICEBUNDLER, "Unable to open iWrapper interface. Maybe %s is not a wrapper device?", m_wrapper_device); + yCError(DEVICEBUNDLER, "Unable to open iWrapper interface. Maybe %s is not a wrapper device?", m_wrapper_device.c_str()); return false; } ret = m_iWrapper->attach(&m_pdev_subdevice); if (!ret) { - yCError(DEVICEBUNDLER, "Unable to attach the two devices: %s and %s", m_wrapper_device, m_attached_device); + yCError(DEVICEBUNDLER, "Unable to attach the two devices: %s and %s", m_wrapper_device.c_str(), m_attached_device.c_str()); return false; } - yCDebug(DEVICEBUNDLER, "Attach operation between %s and %s completed.", m_wrapper_device, m_attached_device); + yCDebug(DEVICEBUNDLER, "Attach operation between %s and %s completed.", m_wrapper_device.c_str(), m_attached_device.c_str()); return true; } diff --git a/src/devices/deviceBundler/DeviceBundler.h b/src/devices/deviceBundler/DeviceBundler.h index ff00dd6ddda..35a2a832fff 100644 --- a/src/devices/deviceBundler/DeviceBundler.h +++ b/src/devices/deviceBundler/DeviceBundler.h @@ -7,7 +7,7 @@ #define YARP_DEVICEBUNDLER_H #include -#include +#include #include #include "DeviceBundler_ParamsParser.h" diff --git a/src/devices/deviceBundler/DeviceBundler_ParamsParser.cpp b/src/devices/deviceBundler/DeviceBundler_ParamsParser.cpp index d1a8f0444d2..84cf2c1d4f0 100644 --- a/src/devices/deviceBundler/DeviceBundler_ParamsParser.cpp +++ b/src/devices/deviceBundler/DeviceBundler_ParamsParser.cpp @@ -35,7 +35,7 @@ bool DeviceBundler_ParamsParser::parseParams(const yarp::os::Searchable & c //Check for --help option if (config.check("help")) { - yCInfo(DeviceBundlerParamsCOMPONENT) << getDocumentationOfDeviceParams(); + yCInfo(DeviceBundlerParamsCOMPONENT) << getDocumentationOfDeviceParams(); } std::string config_string = config.toString(); diff --git a/src/devices/deviceBundler/DeviceBundler_params.md b/src/devices/deviceBundler/DeviceBundler_params.md index 283b7a48bc4..86cfb220bf0 100644 --- a/src/devices/deviceBundler/DeviceBundler_params.md +++ b/src/devices/deviceBundler/DeviceBundler_params.md @@ -2,4 +2,4 @@ |:----------:|:---------------:|:------:|:-----:|:--------------:|:--------:|:---------------------------------------------------------------------:|:-----------------------------------------------------:| | | wrapper_device | string | - | device_name1 | Yes | Name of the wrapper device | This device must derive from yarp::dev::IWrapper | | | attached_device | string | - | device_name2 | Yes | Name of the subdevice that will be attached to the wrapper device | | - | | doNotAttach | bool | - | false | No | If set to true, the two devices are opened, but not attached | It should not be used, except for debugging purposes | \ No newline at end of file + | | doNotAttach | bool | - | false | No | If set to true, the two devices are opened, but not attached | It should not be used, except for debugging purposes | diff --git a/src/devices/map2DStorage/map2DStorage.h b/src/devices/map2DStorage/map2DStorage.h index 9594a87f47b..da88da87b65 100644 --- a/src/devices/map2DStorage/map2DStorage.h +++ b/src/devices/map2DStorage/map2DStorage.h @@ -47,9 +47,6 @@ * |:--------------:|:--------------:|:-------:|:--------------:|:----------------:|:-----------: |:-----------------------------------------------------------------:|:-----:| * | name | - | string | - | /mapServer/rpc | No | Full name of the rpc port opened by the Map2DServer device. | | * | mapCollection | - | string | - | - | No | The name of .ini file containing a map collection. | | - - * \section Notes: - * Integration with ROS map server is currently under development. */ class Map2DStorage : diff --git a/src/libYARP_dev/src/yarp/dev/Drivers.cpp b/src/libYARP_dev/src/yarp/dev/Drivers.cpp index 60e98473623..88d60503548 100644 --- a/src/libYARP_dev/src/yarp/dev/Drivers.cpp +++ b/src/libYARP_dev/src/yarp/dev/Drivers.cpp @@ -412,6 +412,19 @@ int Drivers::yarpdev(int argc, char *argv[]) { return 0; } + //The following syntax is deprecated: generate an error! + if (options.check("device") && options.check("subdevice")) + { + std::string dev_name = options.find("device").asString(); + std::string subdev_name = options.find("subdevice").asString(); + yCError(DRIVERS, "The syntax:"); + yCError(DRIVERS, "yarpdev --device %s --subdevice %s", dev_name.c_str(), subdev_name.c_str()); + yCError(DRIVERS, "has been deprecated."); + yCError(DRIVERS, "Use the following command line instead:"); + yCError(DRIVERS, "yarpdev --device deviceBundler --wrapper_device %s --attached_device %s", dev_name.c_str(), subdev_name.c_str()); + return 0; + } + //yarpdev enables the wrapping mechanism, which is not enabled by default if, //for example a device is opened from the code, using PolyDriver.open() //When enabled, it asks for a wrapped, remotable device rather than raw device