diff --git a/remappers/CMakeLists.txt b/remappers/CMakeLists.txt index 3b6aa87bd..9e4a67c46 100644 --- a/remappers/CMakeLists.txt +++ b/remappers/CMakeLists.txt @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: Fondazione Istituto Italiano di Tecnologia (IIT) # SPDX-License-Identifier: BSD-3-Clause -add_subdirectory(HumanStateRemapper) +add_subdirectory(HumanState_nwc_yarp) add_subdirectory(HumanDynamics_nwc_yarp) add_subdirectory(HumanWrenchRemapper) add_subdirectory(WearableTargetsRemapper) diff --git a/remappers/HumanStateRemapper/CMakeLists.txt b/remappers/HumanState_nwc_yarp/CMakeLists.txt similarity index 60% rename from remappers/HumanStateRemapper/CMakeLists.txt rename to remappers/HumanState_nwc_yarp/CMakeLists.txt index e6457b0e7..2d09ba978 100644 --- a/remappers/HumanStateRemapper/CMakeLists.txt +++ b/remappers/HumanState_nwc_yarp/CMakeLists.txt @@ -1,21 +1,21 @@ # SPDX-FileCopyrightText: Fondazione Istituto Italiano di Tecnologia (IIT) # SPDX-License-Identifier: BSD-3-Clause -yarp_prepare_plugin(human_state_remapper - TYPE hde::devices::HumanStateRemapper - INCLUDE HumanStateRemapper.h +yarp_prepare_plugin(human_state_nwc_yarp + TYPE hde::devices::HumanState_nwc_yarp + INCLUDE HumanState_nwc_yarp.h CATEGORY device ADVANCED DEFAULT ON) -yarp_add_plugin(HumanStateRemapper - HumanStateRemapper.cpp - HumanStateRemapper.h) +yarp_add_plugin(HumanState_nwc_yarp + HumanState_nwc_yarp.cpp + HumanState_nwc_yarp.h) -target_include_directories(HumanStateRemapper PUBLIC +target_include_directories(HumanState_nwc_yarp PUBLIC $) -target_link_libraries(HumanStateRemapper PUBLIC +target_link_libraries(HumanState_nwc_yarp PUBLIC IHumanState HumanStateMsg YARP::YARP_OS @@ -23,7 +23,7 @@ target_link_libraries(HumanStateRemapper PUBLIC YARP::YARP_init) yarp_install( - TARGETS HumanStateRemapper + TARGETS HumanState_nwc_yarp COMPONENT runtime LIBRARY DESTINATION ${YARP_DYNAMIC_PLUGINS_INSTALL_DIR} ARCHIVE DESTINATION ${YARP_STATIC_PLUGINS_INSTALL_DIR} diff --git a/remappers/HumanStateRemapper/HumanStateRemapper.cpp b/remappers/HumanState_nwc_yarp/HumanState_nwc_yarp.cpp similarity index 81% rename from remappers/HumanStateRemapper/HumanStateRemapper.cpp rename to remappers/HumanState_nwc_yarp/HumanState_nwc_yarp.cpp index 0ff9a3909..807b50bea 100644 --- a/remappers/HumanStateRemapper/HumanStateRemapper.cpp +++ b/remappers/HumanState_nwc_yarp/HumanState_nwc_yarp.cpp @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Fondazione Istituto Italiano di Tecnologia (IIT) // SPDX-License-Identifier: BSD-3-Clause -#include "HumanStateRemapper.h" +#include "HumanState_nwc_yarp.h" #include @@ -11,8 +11,8 @@ #include #include -const std::string RemapperName = "HumanStateRemapper"; -const std::string LogPrefix = RemapperName + " :"; +const std::string ClientName = "HumanState_nwc_yarp"; +const std::string LogPrefix = ClientName + " :"; using namespace hde::devices; @@ -20,7 +20,7 @@ using namespace hde::devices; // IMPL AND UTILS // ============== -class HumanStateRemapper::impl +class HumanState_nwc_yarp::impl { public: std::mutex mtx; @@ -44,17 +44,17 @@ class HumanStateRemapper::impl }; // ==================== -// IHUMANSTATE REMAPPER +// IHUMANSTATE CLIENT // ==================== -HumanStateRemapper::HumanStateRemapper() +HumanState_nwc_yarp::HumanState_nwc_yarp() : PeriodicThread(1) , pImpl{new impl()} {} -HumanStateRemapper::~HumanStateRemapper() = default; +HumanState_nwc_yarp::~HumanState_nwc_yarp() = default; -bool HumanStateRemapper::open(yarp::os::Searchable& config) +bool HumanState_nwc_yarp::open(yarp::os::Searchable& config) { // =============================== // CHECK THE CONFIGURATION OPTIONS @@ -111,10 +111,10 @@ bool HumanStateRemapper::open(yarp::os::Searchable& config) return true; } -void HumanStateRemapper::threadRelease() +void HumanState_nwc_yarp::threadRelease() {} -bool HumanStateRemapper::close() +bool HumanState_nwc_yarp::close() { pImpl->terminationCall = true; @@ -125,12 +125,12 @@ bool HumanStateRemapper::close() return true; } -void HumanStateRemapper::run() +void HumanState_nwc_yarp::run() { return; } -void HumanStateRemapper::onRead(hde::msgs::HumanState& humanStateData) +void HumanState_nwc_yarp::onRead(hde::msgs::HumanState& humanStateData) { std::lock_guard lock(pImpl->mtx); if(!pImpl->terminationCall) { @@ -151,61 +151,61 @@ void HumanStateRemapper::onRead(hde::msgs::HumanState& humanStateData) } } -std::vector HumanStateRemapper::getJointNames() const +std::vector HumanState_nwc_yarp::getJointNames() const { std::lock_guard lock(pImpl->mtx); return pImpl->jointNames; } -std::string HumanStateRemapper::getBaseName() const +std::string HumanState_nwc_yarp::getBaseName() const { std::lock_guard lock(pImpl->mtx); return pImpl->baseName; } -size_t HumanStateRemapper::getNumberOfJoints() const +size_t HumanState_nwc_yarp::getNumberOfJoints() const { std::lock_guard lock(pImpl->mtx); return pImpl->jointPositions.size(); } -std::vector HumanStateRemapper::getJointPositions() const +std::vector HumanState_nwc_yarp::getJointPositions() const { std::lock_guard lock(pImpl->mtx); return pImpl->jointPositions; } -std::vector HumanStateRemapper::getJointVelocities() const +std::vector HumanState_nwc_yarp::getJointVelocities() const { std::lock_guard lock(pImpl->mtx); return pImpl->jointVelocities; } -std::array HumanStateRemapper::getBasePosition() const +std::array HumanState_nwc_yarp::getBasePosition() const { std::lock_guard lock(pImpl->mtx); return pImpl->basePosition; } -std::array HumanStateRemapper::getBaseOrientation() const +std::array HumanState_nwc_yarp::getBaseOrientation() const { std::lock_guard lock(pImpl->mtx); return pImpl->baseOrientation; } -std::array HumanStateRemapper::getBaseVelocity() const +std::array HumanState_nwc_yarp::getBaseVelocity() const { std::lock_guard lock(pImpl->mtx); return pImpl->baseVelocity; } -std::array HumanStateRemapper::getCoMPosition() const +std::array HumanState_nwc_yarp::getCoMPosition() const { std::lock_guard lock(pImpl->mtx); return pImpl->CoMPosition; } -std::array HumanStateRemapper::getCoMVelocity() const +std::array HumanState_nwc_yarp::getCoMVelocity() const { std::lock_guard lock(pImpl->mtx); return pImpl->CoMVelocity; diff --git a/remappers/HumanStateRemapper/HumanStateRemapper.h b/remappers/HumanState_nwc_yarp/HumanState_nwc_yarp.h similarity index 86% rename from remappers/HumanStateRemapper/HumanStateRemapper.h rename to remappers/HumanState_nwc_yarp/HumanState_nwc_yarp.h index 196404d16..e4228f694 100644 --- a/remappers/HumanStateRemapper/HumanStateRemapper.h +++ b/remappers/HumanState_nwc_yarp/HumanState_nwc_yarp.h @@ -1,8 +1,8 @@ // SPDX-FileCopyrightText: Fondazione Istituto Italiano di Tecnologia (IIT) // SPDX-License-Identifier: BSD-3-Clause -#ifndef HDE_DEVICES_HUMANSTATEREMAPPER -#define HDE_DEVICES_HUMANSTATEREMAPPER +#ifndef HDE_DEVICES_HUMANSTATE_NWC_YARP +#define HDE_DEVICES_HUMANSTATE_NWC_YARP #include @@ -17,10 +17,10 @@ namespace hde::msgs { class HumanState; } // namespace hde::msgs namespace hde::devices { - class HumanStateRemapper; + class HumanState_nwc_yarp; } // namespace hde::devices -class hde::devices::HumanStateRemapper final +class hde::devices::HumanState_nwc_yarp final : public yarp::dev::DeviceDriver , public hde::interfaces::IHumanState , public yarp::os::TypedReaderCallback @@ -31,8 +31,8 @@ class hde::devices::HumanStateRemapper final std::unique_ptr pImpl; public: - HumanStateRemapper(); - ~HumanStateRemapper() override; + HumanState_nwc_yarp(); + ~HumanState_nwc_yarp() override; std::mutex mtx; @@ -64,4 +64,4 @@ class hde::devices::HumanStateRemapper final std::array getCoMVelocity() const override; }; -#endif // HDE_DEVICES_HUMANSTATEREMAPPER +#endif // HDE_DEVICES_HUMANSTATE_NWC_YARP diff --git a/wrappers/CMakeLists.txt b/wrappers/CMakeLists.txt index fefe58717..abdb7c6ef 100644 --- a/wrappers/CMakeLists.txt +++ b/wrappers/CMakeLists.txt @@ -1,7 +1,7 @@ # SPDX-FileCopyrightText: Fondazione Istituto Italiano di Tecnologia (IIT) # SPDX-License-Identifier: BSD-3-Clause -add_subdirectory(HumanStateWrapper) +add_subdirectory(HumanState_nws_yarp) add_subdirectory(HumanDynamics_nws_yarp) add_subdirectory(HumanWrenchWrapper) add_subdirectory(WearableTargetsWrapper) diff --git a/wrappers/HumanStateWrapper/CMakeLists.txt b/wrappers/HumanState_nws_yarp/CMakeLists.txt similarity index 60% rename from wrappers/HumanStateWrapper/CMakeLists.txt rename to wrappers/HumanState_nws_yarp/CMakeLists.txt index 2e7a5607a..638e43f51 100644 --- a/wrappers/HumanStateWrapper/CMakeLists.txt +++ b/wrappers/HumanState_nws_yarp/CMakeLists.txt @@ -1,21 +1,21 @@ # SPDX-FileCopyrightText: Fondazione Istituto Italiano di Tecnologia (IIT) # SPDX-License-Identifier: BSD-3-Clause -yarp_prepare_plugin(human_state_wrapper - TYPE hde::wrappers::HumanStateWrapper - INCLUDE HumanStateWrapper.h +yarp_prepare_plugin(human_state_nws_yarp + TYPE hde::wrappers::HumanState_nws_yarp + INCLUDE HumanState_nws_yarp.h CATEGORY device ADVANCED DEFAULT ON) -yarp_add_plugin(HumanStateWrapper - HumanStateWrapper.cpp - HumanStateWrapper.h) +yarp_add_plugin(HumanState_nws_yarp + HumanState_nws_yarp.cpp + HumanState_nws_yarp.h) -target_include_directories(HumanStateWrapper PUBLIC +target_include_directories(HumanState_nws_yarp PUBLIC $) -target_link_libraries(HumanStateWrapper PUBLIC +target_link_libraries(HumanState_nws_yarp PUBLIC IHumanState HumanStateMsg YARP::YARP_OS @@ -23,7 +23,7 @@ target_link_libraries(HumanStateWrapper PUBLIC YARP::YARP_init) yarp_install( - TARGETS HumanStateWrapper + TARGETS HumanState_nws_yarp COMPONENT runtime LIBRARY DESTINATION ${YARP_DYNAMIC_PLUGINS_INSTALL_DIR} ARCHIVE DESTINATION ${YARP_STATIC_PLUGINS_INSTALL_DIR} diff --git a/wrappers/HumanStateWrapper/HumanStateWrapper.cpp b/wrappers/HumanState_nws_yarp/HumanState_nws_yarp.cpp similarity index 92% rename from wrappers/HumanStateWrapper/HumanStateWrapper.cpp rename to wrappers/HumanState_nws_yarp/HumanState_nws_yarp.cpp index 0c7eb881a..f279f2a4b 100644 --- a/wrappers/HumanStateWrapper/HumanStateWrapper.cpp +++ b/wrappers/HumanState_nws_yarp/HumanState_nws_yarp.cpp @@ -1,7 +1,7 @@ // SPDX-FileCopyrightText: Fondazione Istituto Italiano di Tecnologia (IIT) // SPDX-License-Identifier: BSD-3-Clause -#include "HumanStateWrapper.h" +#include "HumanState_nws_yarp.h" #include #include @@ -9,13 +9,13 @@ #include #include -const std::string DeviceName = "HumanStateWrapper"; +const std::string DeviceName = "HumanState_nws_yarp"; const std::string LogPrefix = DeviceName + " :"; constexpr double DefaultPeriod = 0.01; using namespace hde::wrappers; -class HumanStateWrapper::impl +class HumanState_nws_yarp::impl { public: hde::interfaces::IHumanState* iHumanState = nullptr; @@ -33,14 +33,14 @@ class HumanStateWrapper::impl std::string baseName; }; -HumanStateWrapper::HumanStateWrapper() +HumanState_nws_yarp::HumanState_nws_yarp() : PeriodicThread(DefaultPeriod) , pImpl{new impl()} {} -HumanStateWrapper::~HumanStateWrapper() {} +HumanState_nws_yarp::~HumanState_nws_yarp() {} -bool HumanStateWrapper::open(yarp::os::Searchable& config) +bool HumanState_nws_yarp::open(yarp::os::Searchable& config) { // =============================== // CHECK THE CONFIGURATION OPTIONS @@ -82,12 +82,12 @@ bool HumanStateWrapper::open(yarp::os::Searchable& config) #include -bool HumanStateWrapper::close() +bool HumanState_nws_yarp::close() { return true; } -void HumanStateWrapper::run() +void HumanState_nws_yarp::run() { // Get data from the interface @@ -154,7 +154,7 @@ void HumanStateWrapper::run() pImpl->outputPort.write(/*forceStrict=*/true); } -bool HumanStateWrapper::attach(yarp::dev::PolyDriver* poly) +bool HumanState_nws_yarp::attach(yarp::dev::PolyDriver* poly) { if (!poly) { yError() << LogPrefix << "Passed PolyDriver is nullptr"; @@ -199,9 +199,9 @@ bool HumanStateWrapper::attach(yarp::dev::PolyDriver* poly) return true; } -void HumanStateWrapper::threadRelease() {} +void HumanState_nws_yarp::threadRelease() {} -bool HumanStateWrapper::detach() +bool HumanState_nws_yarp::detach() { while (isRunning()) { stop(); @@ -215,7 +215,7 @@ bool HumanStateWrapper::detach() return true; } -bool HumanStateWrapper::attachAll(const yarp::dev::PolyDriverList& driverList) +bool HumanState_nws_yarp::attachAll(const yarp::dev::PolyDriverList& driverList) { if (driverList.size() > 1) { yError() << LogPrefix << "This wrapper accepts only one attached PolyDriver"; @@ -232,7 +232,7 @@ bool HumanStateWrapper::attachAll(const yarp::dev::PolyDriverList& driverList) return attach(driver->poly); } -bool HumanStateWrapper::detachAll() +bool HumanState_nws_yarp::detachAll() { return detach(); } diff --git a/wrappers/HumanStateWrapper/HumanStateWrapper.h b/wrappers/HumanState_nws_yarp/HumanState_nws_yarp.h similarity index 79% rename from wrappers/HumanStateWrapper/HumanStateWrapper.h rename to wrappers/HumanState_nws_yarp/HumanState_nws_yarp.h index 4bcd2209e..437779c78 100644 --- a/wrappers/HumanStateWrapper/HumanStateWrapper.h +++ b/wrappers/HumanState_nws_yarp/HumanState_nws_yarp.h @@ -1,8 +1,8 @@ // SPDX-FileCopyrightText: Fondazione Istituto Italiano di Tecnologia (IIT) // SPDX-License-Identifier: BSD-3-Clause -#ifndef HDE_DEVICES_HUMANSTATEWRAPPER -#define HDE_DEVICES_HUMANSTATEWRAPPER +#ifndef HDE_DEVICES_HUMANSTATE_NWS_YARP +#define HDE_DEVICES_HUMANSTATE_NWS_YARP #include #include @@ -13,11 +13,11 @@ namespace hde { namespace wrappers { - class HumanStateWrapper; + class HumanState_nws_yarp; } // namespace wrappers } // namespace hde -class hde::wrappers::HumanStateWrapper final +class hde::wrappers::HumanState_nws_yarp final : public yarp::dev::DeviceDriver , public yarp::dev::IWrapper , public yarp::dev::IMultipleWrapper @@ -28,8 +28,8 @@ class hde::wrappers::HumanStateWrapper final std::unique_ptr pImpl; public: - HumanStateWrapper(); - ~HumanStateWrapper() override; + HumanState_nws_yarp(); + ~HumanState_nws_yarp() override; // DeviceDriver interface bool open(yarp::os::Searchable& config) override; @@ -48,4 +48,4 @@ class hde::wrappers::HumanStateWrapper final bool detachAll() override; }; -#endif // HDE_DEVICES_HUMANSTATEWRAPPER +#endif // HDE_DEVICES_HUMANSTATE_NWS_YARP