ros_sugar.robot.command#
Robot command descriptor.
A RobotCommand declares one command surface a plugin exposes: which standard
message type it stands in for, which transport carries it, and how to encode
a component’s output into a wire payload.
Module Contents#
Classes#
A robot command surface. |
|
Introspection record for a |
API#
- class ros_sugar.robot.command.RobotCommand#
Bases:
ros_sugar.config.BaseAttrsA robot command surface.
- Parameters:
key – Registry key on
plugin.commands. A recipe routes an output topic through this command withTopic(..., use_plugin=True); resolution matches the topic’snameagainst this key first, then falls back to a unique message-type match. For plugins that expose exactly one command per message type, conventionally the message-type name ("Twist"). For plugins with multiple commands of the same type (e.g. a humanoid’s"left_arm"/"right_arm"JointStates), choose a descriptive role name and name the recipe’s topic to match it.transport – Transport the command is sent on.
encoder –
encoder(output) -> payload— turns a component’s output (the value it would have published) into the transport’s wire payload (bytesfor UDP/HTTP, an SDK object for SDK, a request forRosServiceTransport).msg_type – Optional
SupportedTypesubclass — set only when the transport is ROS-typed (RosTopicTransport).description – Human-readable description.
- property channel: str#
Command bus channel, used when
transport.route_via_hostis set.
- spec() ros_sugar.robot.command.CommandSpec#
Return the introspection spec for this command.
- asdict(filter: Optional[Callable] = None) Dict#
- to_dict() Dict#
- from_dict(dict_obj: Dict) None#
- from_file(file_path: str, nested_root_name: Union[str, None] = None, get_common: bool = False) bool#
- to_json() Union[str, bytes, bytearray]#
- from_json(json_obj: Union[str, bytes, bytearray]) None#
- has_attribute(attr_name: str) bool#
- get_attribute_type(attr_name: str) Optional[type]#
- update_value(attr_name: str, attr_value: Any) bool#
- classmethod get_fields_info(class_object) Dict[str, Dict[str, Any]]#
- class ros_sugar.robot.command.CommandSpec#
Bases:
ros_sugar.config.BaseAttrsIntrospection record for a
RobotCommand(seeplugin.list_commands).keyis the registry key onplugin.commands. To route an output through this command, setTopic(use_plugin=True)and name the topic after this key (needed only to disambiguate multiple commands of the same message type).- asdict(filter: Optional[Callable] = None) Dict#
- to_dict() Dict#
- from_dict(dict_obj: Dict) None#
- from_file(file_path: str, nested_root_name: Union[str, None] = None, get_common: bool = False) bool#
- to_json() Union[str, bytes, bytearray]#
- from_json(json_obj: Union[str, bytes, bytearray]) None#
- has_attribute(attr_name: str) bool#
- get_attribute_type(attr_name: str) Optional[type]#
- update_value(attr_name: str, attr_value: Any) bool#
- classmethod get_fields_info(class_object) Dict[str, Dict[str, Any]]#