Accessing devices in programs
All connected and configured Devices can be accessed via static methods of the class
RoboticsRegistry. When a Robotics API application is started, Devices are
registered there according to their configurations (if these are correct) and can be
retrieved.
The RoboticsRegistry provides two static methods:
- RoboticsRegistry.get(Class<T> type) queries for Devices of a certain
type (or types derived from that). A list of all matching Devices is
returned.
- RoboticsRegistry.get(String name, Class<T> type) queries for a
Device with the given, unique name that is of a certain type. The Device
will be returned, or null, if such a Device does not exist.
Here are a few examples for accessing a Light Weight Robot device:
- Accessing a Light Weight Robot by type (multiple results possible):
LWR lwr = RoboticsRegistry.get(LWR.class).get(0);
- Accessing a Light Weight Robot by name and type:
LWR lwr = RoboticsRegistry.get("lwr", LWR.class);