ros_sugar.robot.types¶
Dynamic SupportedType construction for robot plugins.
create_supported_type wraps a robot’s custom ROS message in a
io.supported_types.SupportedType subclass, optionally with a
converter (python output -> ROS message, for commands) and a callback
(ROS message -> python value, for feedback).
Module Contents¶
Functions¶
Add a new |
API¶
- ros_sugar.robot.types.create_supported_type(ros_msg_type: type, converter: Optional[Callable] = None, callback: Optional[Callable] = None) Type[ros_sugar.io.supported_types.SupportedType]¶
Add a new
SupportedTypederived class wrappingros_msg_type.- Parameters:
ros_msg_type – A valid ROS2 message type.
converter –
converter(output) -> ros_msg_type— python value to ROS message; its return annotation must equalros_msg_type.callback –
callback(msg: ros_msg_type) -> <python type>— ROS message to python value; its first-arg annotation must equalros_msg_typeand its return annotation must be a non-ROS python type.
- Returns:
The newly registered
SupportedTypesubclass.