YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
yarp::robotinterface YARP RobotInterface library

The libYARP_robotinterface library is useful to programatically launch YARP devices from C++ code using the same xml files used with the yarprobotinterface tool, that are described in YARP robotinterface XML files . More...

+ Collaboration diagram for yarp::robotinterface YARP RobotInterface library:

Modules

 yarprobotinterface: Start multiple YARP devices as specified in an xml file.
 
 YARP robotinterface XML files
 This tutorial covers how to write and read XML files that are used by yarprobotinterface tool and by the libYARP_robotinterface C++ library.
 

Classes

class  yarp::robotinterface::XMLReaderResult
 Result of the parsing of yarp::robotinterface::XMLReader. More...
 
class  yarp::robotinterface::XMLReader
 Class to read an XML file. More...
 

Detailed Description

The libYARP_robotinterface library is useful to programatically launch YARP devices from C++ code using the same xml files used with the yarprobotinterface tool, that are described in YARP robotinterface XML files .

An example of use of this library is:

// Load the XML configuration file
std::string pathToXmlConfigurationFile = ...;
yarp::robotinterface::XMLReaderResult result = reader.getRobotFromFile(pathToXmlConfigurationFile);
if (!result.parsingIsSuccessful) {
// Handle error
// ...
}
// Optional: specify externally created devices to which robotinterface's devices can attach
// It is assumed that the devices contained in externalDriverList will remain valid and open until
// result.robot.enterPhase(yarp::robotinterface::ActionPhaseShutdown) will be called
// bool ok = result.robot.setExternalDevices(externalDriverList);
// Enter the startup phase, that will open all the devices and call attach if necessary
if (!ok) {
// Handle error
// ...
}
// At this point, the system is running and the thread that called the
// enterPhase methods does not need to do anything else
// This code need to be executed when you want to close the robot
// Close robot, that will close all the devices and call detach if necessary
if (!ok) {
// Handle error
// ...
}
bool enterPhase(yarp::robotinterface::ActionPhase phase)
Definition Robot.cpp:629
Result of the parsing of yarp::robotinterface::XMLReader.
Definition XMLReader.h:26
bool parsingIsSuccessful
True if the parsing was successful, false otherwise.
Definition XMLReader.h:38
Robot robot
If parsingIsSuccessful is true, contains a valid robot instance.
Definition XMLReader.h:43
Class to read an XML file.
Definition XMLReader.h:52
XMLReaderResult getRobotFromFile(const std::string &filename, const yarp::os::Searchable &config=yarp::os::Property())
Parse the XML description of a robotinterface from a file.
Definition XMLReader.cpp:74