Using DeviceInterfaces

Robotics API devices expose the operations they can perform via DeviceInterfaces. Each device provides some standard DeviceInterfaces, like e.g. an implementation of MotionInterface in case of a Robot device. Robotics API extensions can add further DeviceInterfaces to devices at runtime. Thus, the set of DeviceInterfaces supported by a device can vary and depends on the application configuration.

As an application developer, you can use the following methods of a Device to access DeviceInterfaces:

The following example demonstrates the access to DeviceInterfaces; in that case, the implementation of PtpInterface of a Light Weight Robot is retrieved:

LWR lwr = RoboticsRegistry.get("lwr", LWR.class); 
PtpInterface ptpInterface = lwr.use(PtpInterface.class);

The use() method may return different instances of the same type of DeviceInterface when called multiple times. Thus, developers should be careful to re-use the same instance of a DeviceInterface when e.g. setting default parameters for device operations (see 1.4.5).


Be sure to re-use DeviceInterface instances by e.g. storing them in variables when needed. Multiple calls to use() may return different instances of the same type of DeviceInterface!