Skip to content

Commit

Permalink
Fix compatibility with YARP 3.10 (#206)
Browse files Browse the repository at this point in the history
* Fix compatibility with YARP 3.10
  • Loading branch information
traversaro authored Feb 29, 2024
1 parent 3d57b0b commit a485998
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
5 changes: 0 additions & 5 deletions devices/Paexo/src/Paexo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ class Paexo::PaexoImpl
std::unique_ptr<CmdParser> cmdPro;
yarp::os::RpcServer rpcPort;

std::string serialComPortName;

// Paexo data buffer
PaexoData paexoData;

Expand Down Expand Up @@ -806,9 +804,6 @@ bool Paexo::attach(yarp::dev::PolyDriver* poly)
yInfo() << LogPrefix << "ISerialDevice interface viewed correctly";
}

// Get the comport name of the serial device
pImpl->serialComPortName = poly->getValue("comport").asString();

// TODO: Check if the ISerialDevice interface is configured correctly
// I do not see any method to check this

Expand Down
11 changes: 6 additions & 5 deletions wrappers/IWearActuators/src/IWearActuatorsWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ constexpr double DefaultPeriod = 0.01;
class IWearActuatorsWrapper::impl : public wearable::msg::WearableActuatorCommand
{
public:
std::string attachedWearableDeviceName;
std::string attachedWearableDeviceKey = "defaultIWearActuatorsWrapperDevice";

std::string actuatorCommandInputPortName;
yarp::os::BufferedPort<wearable::msg::WearableActuatorCommand> actuatorCommandInputPort;
Expand Down Expand Up @@ -94,7 +94,7 @@ void IWearActuatorsWrapper::onRead(msg::WearableActuatorCommand& wearableActuato
// Check if the commanded actuator name is available
if (pImpl->actuatorsMap.find(info.name) == pImpl->actuatorsMap.end())
{
yWarning() << "Requested actuator with name " << info.name << " is not available in " << pImpl->attachedWearableDeviceName << " wearable device \n \t Ignoring wearable actuation command.";
yWarning() << "Requested actuator with name " << info.name << " is not available in " << pImpl->attachedWearableDeviceKey << " wearable device \n \t Ignoring wearable actuation command.";
}
else // process the wearable actuator command
{
Expand Down Expand Up @@ -153,16 +153,14 @@ bool IWearActuatorsWrapper::attach(yarp::dev::PolyDriver* poly)
return false;
}

pImpl->attachedWearableDeviceName = poly->getValue("device").asString();

if (pImpl->iWear || !poly->view(pImpl->iWear) || !pImpl->iWear) {
yError() << LogPrefix << "Failed to view the IWear interface from the PolyDriver.";
return false;
}

// Check and add all the available actuators

yInfo() << LogPrefix << "Finding available actuators from " << pImpl->attachedWearableDeviceName << " wearable deive ...";
yInfo() << LogPrefix << "Finding available actuators from " << pImpl->attachedWearableDeviceKey << " wearable deive ...";

for (const auto& a : pImpl->iWear->getHapticActuators())
{
Expand Down Expand Up @@ -226,6 +224,9 @@ bool IWearActuatorsWrapper::attachAll(const yarp::dev::PolyDriverList& driverLis
yError() << LogPrefix << "Passed PolyDriverDescriptor is nullptr.";
return false;
}

// Save key that identifies the driver
pImpl->attachedWearableDeviceKey = driver->key;

return attach(driver->poly);
}
Expand Down

0 comments on commit a485998

Please sign in to comment.