-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from robotology/feature/paexo
This PR add the wearable device implementation for an Adaptive Paexo
- Loading branch information
Showing
6 changed files
with
916 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#/* | ||
# * Copyright (C) 2020 iCub Facility | ||
#* Authors: Yeshasvi Tirupachuri | ||
#* CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT | ||
#*/ | ||
|
||
# Compile the plugin by default | ||
yarp_prepare_plugin(paexo TYPE wearable::devices::Paexo | ||
INCLUDE Paexo.h | ||
CATEGORY device | ||
ADVANCED | ||
DEFAULT ON | ||
) | ||
|
||
yarp_add_plugin(Paexo src/Paexo.cpp include/Paexo.h) | ||
|
||
target_include_directories(Paexo PRIVATE | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>) | ||
|
||
target_link_libraries(Paexo | ||
PUBLIC | ||
YARP::YARP_dev | ||
YARP::YARP_init | ||
Wearable::IWear) | ||
|
||
yarp_install(TARGETS Paexo | ||
COMPONENT runtime | ||
LIBRARY DESTINATION ${YARP_DYNAMIC_PLUGINS_INSTALL_DIR} | ||
ARCHIVE DESTINATION ${YARP_STATIC_PLUGINS_INSTALL_DIR} | ||
YARP_INI DESTINATION ${YARP_PLUGIN_MANIFESTS_INSTALL_DIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!DOCTYPE robot PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd"> | ||
<robot name="PaexoWearableDevice" build=0 portprefix=""> | ||
<!--Following the example in https://github.com/robotology/robots-configuration/blob/devel/experimentalSetups/battery/hardware/battery/icubbattery.xml--> | ||
|
||
<!--Serial Device--> | ||
<device type="serialport" name="SerialportDevice"> | ||
<param name="verbose"> 0 </param> | ||
<!--param name="comport"> COM2 </param--> <!-- //windows --> | ||
<param name="comport"> /dev/ttyACM1 </param> <!-- //linux --> | ||
<param name="baudrate"> 115200 </param> | ||
<param name="xonlim"> 0 </param> | ||
<param name="xofflim"> 0 </param> | ||
<param name="readmincharacters"> 0 </param> | ||
<param name="readtimeoutmsec"> 50 </param> | ||
<param name="parityenb"> 0 </param> | ||
<param name="paritymode"> none </param> | ||
<param name="ctsenb"> 0 </param> | ||
<param name="rtsenb"> 0 </param> | ||
<param name="xinenb"> 0 </param> | ||
<param name="xoutenb"> 0 </param> | ||
<param name="modem"> 0 </param> | ||
<param name="rcvenb"> 0 </param> | ||
<param name="dsrenb"> 0 </param> | ||
<param name="dtrdisable"> 0 </param> | ||
<param name="databits"> 8 </param> | ||
<param name="stopbits"> 1 </param> | ||
<param name="line_terminator_char1"> 10 </param> | ||
<param name="line_terminator_char2"> 13 </param> | ||
</device> | ||
|
||
<!--Paexo Device--> | ||
<device type="paexo" name="PaexoWearableDevice"> | ||
<param name="period">0.01</param> | ||
<param name="portsPrefixName">/wearable/paexo</param> | ||
<action phase="startup" level="5" type="attach"> | ||
<paramlist name="networks"> | ||
<elem name="PaexoWearableDeviceLabel">SerialportDevice</elem> | ||
</paramlist> | ||
</action> | ||
<action phase="shutdown" level="5" type="detach"/> | ||
</device> | ||
|
||
<device type="iwear_wrapper" name="PaexoWearableDeviceWrapper"> | ||
<param name="period">0.01</param> | ||
<param name="dataPortName">/Paexo/WearableData/data:o</param> | ||
<param name="rpcPortName">/Paexo/WearableData/metadataRpc:o</param> | ||
<action phase="startup" level="5" type="attach"> | ||
<paramlist name="networks"> | ||
<elem name="PaexoWearableDeviceWrapperLabel"> PaexoWearableDevice </elem> | ||
</paramlist> | ||
</action> | ||
<action phase="shutdown" level="4" type="detach"/> | ||
</device> | ||
|
||
</robot> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
/* | ||
* Copyright (C) 2020 iCub Facility | ||
* Authors: Yeshasvi Tirupachuri | ||
* CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT | ||
*/ | ||
|
||
#ifndef WEARABLE_PAEXO_H | ||
#define WEARABLE_PAEXO_H | ||
|
||
#include "Wearable/IWear/IWear.h" | ||
|
||
#include <yarp/dev/DeviceDriver.h> | ||
#include <yarp/dev/PolyDriver.h> | ||
#include <yarp/dev/Wrapper.h> | ||
#include <yarp/dev/SerialInterfaces.h> | ||
#include <yarp/dev/PreciselyTimed.h> | ||
|
||
#include <yarp/os/PeriodicThread.h> | ||
|
||
namespace wearable { | ||
namespace devices { | ||
class Paexo; | ||
} // namespace devices | ||
} // namespace wearable | ||
|
||
class wearable::devices::Paexo : | ||
public yarp::dev::DeviceDriver, | ||
public yarp::os::PeriodicThread, | ||
public yarp::dev::IWrapper, | ||
public yarp::dev::IMultipleWrapper, | ||
public yarp::dev::IPreciselyTimed, | ||
public wearable::IWear | ||
{ | ||
|
||
private: | ||
class PaexoImpl; | ||
std::unique_ptr<PaexoImpl> pImpl; | ||
|
||
public: | ||
Paexo(); | ||
~Paexo() override; | ||
|
||
// DeviceDriver | ||
bool open(yarp::os::Searchable& config) override; | ||
bool close() override; | ||
|
||
// PeriodicThread | ||
void run() override; | ||
void threadRelease() override; | ||
|
||
// IWrapper interface | ||
bool attach(yarp::dev::PolyDriver* poly) override; | ||
bool detach() override; | ||
|
||
// IMultipleWrapper interface | ||
bool attachAll(const yarp::dev::PolyDriverList& driverList) override; | ||
bool detachAll() override; | ||
|
||
// ================ | ||
// IPRECISELY TIMED | ||
// ================ | ||
|
||
yarp::os::Stamp getLastInputStamp() override; | ||
|
||
// ===== | ||
// IWEAR | ||
// ===== | ||
|
||
// GENERIC | ||
// ------- | ||
|
||
WearableName getWearableName() const override; | ||
WearStatus getStatus() const override; | ||
TimeStamp getTimeStamp() const override; | ||
|
||
SensorPtr<const sensor::ISensor> getSensor(const sensor::SensorName name) const override; | ||
|
||
VectorOfSensorPtr<const sensor::ISensor> getSensors(const sensor::SensorType) const override; | ||
|
||
// IMPLEMENTED SENSORS | ||
// ------------------- | ||
|
||
SensorPtr<const sensor::IVirtualJointKinSensor> | ||
getVirtualJointKinSensor(const sensor::SensorName name) const override; | ||
|
||
SensorPtr<const sensor::IForce3DSensor> | ||
getForce3DSensor(const sensor::SensorName name) const override; | ||
|
||
SensorPtr<const sensor::ITorque3DSensor> | ||
getTorque3DSensor(const sensor::SensorName name) const override; | ||
|
||
// UNIMPLEMENTED SENSORS | ||
// --------------------- | ||
|
||
inline SensorPtr<const sensor::IForceTorque6DSensor> | ||
getForceTorque6DSensor(const sensor::SensorName /*name*/) const override; | ||
|
||
inline SensorPtr<const sensor::IVirtualLinkKinSensor> | ||
getVirtualLinkKinSensor(const sensor::SensorName /*name*/) const override; | ||
|
||
inline SensorPtr<const sensor::IFreeBodyAccelerationSensor> | ||
getFreeBodyAccelerationSensor(const sensor::SensorName /*name*/) const override; | ||
|
||
inline SensorPtr<const sensor::IMagnetometer> | ||
getMagnetometer(const sensor::SensorName /*name*/) const override; | ||
|
||
inline SensorPtr<const sensor::IOrientationSensor> | ||
getOrientationSensor(const sensor::SensorName /*name*/) const override; | ||
|
||
inline SensorPtr<const sensor::IPoseSensor> | ||
getPoseSensor(const sensor::SensorName /*name*/) const override; | ||
|
||
inline SensorPtr<const sensor::IPositionSensor> | ||
getPositionSensor(const sensor::SensorName /*name*/) const override; | ||
|
||
inline SensorPtr<const sensor::IVirtualSphericalJointKinSensor> | ||
getVirtualSphericalJointKinSensor(const sensor::SensorName /*name*/) const override; | ||
|
||
inline SensorPtr<const sensor::IAccelerometer> | ||
getAccelerometer(const sensor::SensorName /*name*/) const override; | ||
|
||
inline SensorPtr<const sensor::IEmgSensor> | ||
getEmgSensor(const sensor::SensorName /*name*/) const override; | ||
|
||
inline SensorPtr<const sensor::IGyroscope> | ||
getGyroscope(const sensor::SensorName /*name*/) const override; | ||
|
||
inline SensorPtr<const sensor::ISkinSensor> | ||
getSkinSensor(const sensor::SensorName /*name*/) const override; | ||
|
||
inline SensorPtr<const sensor::ITemperatureSensor> | ||
getTemperatureSensor(const sensor::SensorName /*name*/) const override; | ||
|
||
}; | ||
|
||
inline wearable::SensorPtr<const wearable::sensor::IForceTorque6DSensor> | ||
wearable::devices::Paexo::getForceTorque6DSensor(const sensor::SensorName /*name*/) const | ||
{ | ||
return nullptr; | ||
} | ||
|
||
inline wearable::SensorPtr<const wearable::sensor::IVirtualLinkKinSensor> | ||
wearable::devices::Paexo::getVirtualLinkKinSensor(const sensor::SensorName /*name*/) const | ||
{ | ||
return nullptr; | ||
} | ||
|
||
inline wearable::SensorPtr<const wearable::sensor::IFreeBodyAccelerationSensor> | ||
wearable::devices::Paexo::getFreeBodyAccelerationSensor(const sensor::SensorName /*name*/) const | ||
{ | ||
return nullptr; | ||
} | ||
|
||
inline wearable::SensorPtr<const wearable::sensor::IMagnetometer> | ||
wearable::devices::Paexo::getMagnetometer(const sensor::SensorName /*name*/) const | ||
{ | ||
return nullptr; | ||
} | ||
|
||
inline wearable::SensorPtr<const wearable::sensor::IOrientationSensor> | ||
wearable::devices::Paexo::getOrientationSensor(const sensor::SensorName /*name*/) const | ||
{ | ||
return nullptr; | ||
} | ||
|
||
inline wearable::SensorPtr<const wearable::sensor::IPoseSensor> | ||
wearable::devices::Paexo::getPoseSensor(const sensor::SensorName /*name*/) const | ||
{ | ||
return nullptr; | ||
} | ||
|
||
inline wearable::SensorPtr<const wearable::sensor::IPositionSensor> | ||
wearable::devices::Paexo::getPositionSensor(const sensor::SensorName /*name*/) const | ||
{ | ||
return nullptr; | ||
} | ||
|
||
inline wearable::SensorPtr<const wearable::sensor::IVirtualSphericalJointKinSensor> | ||
wearable::devices::Paexo::getVirtualSphericalJointKinSensor(const sensor::SensorName /*name*/) const | ||
{ | ||
return nullptr; | ||
} | ||
|
||
inline wearable::SensorPtr<const wearable::sensor::IAccelerometer> | ||
wearable::devices::Paexo::getAccelerometer(const sensor::SensorName /*name*/) const | ||
{ | ||
return nullptr; | ||
} | ||
|
||
inline wearable::SensorPtr<const wearable::sensor::IEmgSensor> | ||
wearable::devices::Paexo::getEmgSensor(const sensor::SensorName /*name*/) const | ||
{ | ||
return nullptr; | ||
} | ||
|
||
inline wearable::SensorPtr<const wearable::sensor::IGyroscope> | ||
wearable::devices::Paexo::getGyroscope(const sensor::SensorName /*name*/) const | ||
{ | ||
return nullptr; | ||
} | ||
|
||
inline wearable::SensorPtr<const wearable::sensor::ISkinSensor> | ||
wearable::devices::Paexo::getSkinSensor(const sensor::SensorName /*name*/) const | ||
{ | ||
return nullptr; | ||
} | ||
|
||
inline wearable::SensorPtr<const wearable::sensor::ITemperatureSensor> | ||
wearable::devices::Paexo::getTemperatureSensor(const sensor::SensorName /*name*/) const | ||
{ | ||
return nullptr; | ||
} | ||
|
||
#endif // WEARABLE_PAEXO_H |
Oops, something went wrong.