Skip to content

Commit

Permalink
Use RF to find kinematics config file
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBowman committed Nov 13, 2024
1 parent b7d3eb3 commit d5f0c9a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions libraries/YarpPlugins/AmorCartesianControl/DeviceDriverImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <yarp/os/Bottle.h>
#include <yarp/os/LogStream.h>
#include <yarp/os/Property.h>
#include <yarp/os/ResourceFinder.h>
#include <yarp/os/Value.h>

#include "KinematicRepresentation.hpp"
Expand Down Expand Up @@ -97,14 +98,17 @@ bool AmorCartesianControl::open(yarp::os::Searchable& config)
qMax.addFloat64(KinRepresentation::radToDeg(jointInfo.upperJointLimit));
}

auto kinematicsFile = config.check("kinematics", yarp::os::Value(""),
"path to file with description of AMOR kinematics").asString();
yarp::os::ResourceFinder rf;
rf.setDefaultContext("kinematics");

auto kinematicsFile = config.check("kinematics", yarp::os::Value(""), "path to file with description of AMOR kinematics").asString();
auto kinematicsFullPath = rf.findFileByName(kinematicsFile);

yarp::os::Property cartesianDeviceOptions;

if (!cartesianDeviceOptions.fromConfigFile(kinematicsFile))
if (!cartesianDeviceOptions.fromConfigFile(kinematicsFullPath))
{
yCError(ACC) << "Cannot read from --kinematics" << kinematicsFile;
yCError(ACC) << "Cannot read from --kinematics" << kinematicsFullPath;
return false;
}

Expand Down

0 comments on commit d5f0c9a

Please sign in to comment.