Dealing with devices. More...
Modules | |
Device Creation/Configuration | |
Basic classes and methods related to creating and configuring devices, and network communication to and from devices. | |
Device Implementations | |
Concrete device drivers that implement sets of interfaces. | |
Device invocation examples | |
Example configuration files. | |
Tutorials and Examples about Devices | |
Tutorials and Examples about Devices. | |
Dealing with devices.
What do you need to know to use devices in YARP? First, we try to write our devices so that they implement a set of interfaces. Your program ideally would use the minimal set of interfaces needed for the particular task you have in mind. Then you'll be later able to switch to any implementation that meets your interface. This is something you often have to do in robotics.
Of course, pretty much every device has some special magic numbers you need to set up at the beginning. This process of configuration process is separated out in YARP to make it easy to control it via external command line switches or configuration files.
YARP devices can be started from the commandline, via yarprobotinterface or from c++ code.
Devices that can be created and configured from the command-line. Generally you can create them with the yarpdev command by specifying a "--device" option followed by their name, for example:
yarpdev --device fakeFrameGrabber
This creates a fakeFrameGrabber device with default options. You will generally need to specify additional options, for example:
yarpdev --device fakeFrameGrabber --width 640 --height 480 --name /test
How do you know what options are available? You can check the documentation of that device (list of all devices Device Implementations here). Or When you try to run "yarpdev --device yourdevice" and add the "--verbose" flag, it will tell you what options it is checking, and any documentation present for those options.
For example, try running:
yarpdev --device fakeFrameGrabber --verbose
You can also write the parameters in a .ini file a load it from command line. For example, you create a grabber_test.ini file with the following text:
device frameGrabber_nws_yarp subdevice fakeFrameGrabber name /test width 640 height 480
and launch the device with:
yarpdev --file grabber_test.ini
Finally, you can open a device from your C++ application by with: