Skip to content

Commit

Permalink
Parse axisNames property from mapper as fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBowman committed Aug 24, 2023
1 parent 5161ac9 commit 8c3a39a
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion programs/launchCanBus/LaunchCanBus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,21 @@ bool LaunchCanBus::configure(yarp::os::ResourceFinder &rf)
yarp::os::Property calibratorDeviceOptions;
calibratorDeviceOptions.fromString(calibratorDeviceGroup.toString());
calibratorDeviceOptions.put("robotConfig", yarp::os::Value::makeBlob(&robotConfigPtr, sizeof(robotConfigPtr)));
calibratorDeviceOptions.put("joints", mapperDeviceOptions.find("joints"));

if (mapperDeviceOptions.check("joints"))
{
calibratorDeviceOptions.put("joints", mapperDeviceOptions.find("joints"));
}
else if (mapperDeviceOptions.check("axesNames"))
{
const auto & axesNames = mapperDeviceOptions.find("axesNames");
calibratorDeviceOptions.put("joints", yarp::os::Value((int)axesNames.asList()->size()));
}
else
{
yCError(LCB) << "Missing joints or axesNames property in mapper device" << mapperDeviceLabel;
return false;
}

yarp::dev::PolyDriver * calibratorDevice = new yarp::dev::PolyDriver;
yarp::dev::PolyDriverDescriptor descriptor(calibratorDevice, "calibrator"); // key name enforced by ControlBoardRemapper::attachAllXxx()
Expand Down

0 comments on commit 8c3a39a

Please sign in to comment.