ros_sugar.robot.mount#
Where a sensor sits on the robot.
A Mount is a recipe-level statement: this sensor is mounted there on this
robot.
Mounts only describe static transforms. A sensor with moving parts (a pan-tilt head) publishes the dynamic transform from its own base frame to the moving one itself; the recipe then only has to say where that base frame sits, and the two compose in the TF tree.
Module Contents#
Classes#
A static placement of a sensor relative to something else. |
Functions#
Convert roll/pitch/yaw (radians) to a quaternion |
|
Where one mounted thing sits in another’s frame. |
API#
- ros_sugar.robot.mount.quaternion_from_euler(roll: float, pitch: float, yaw: float) Tuple[float, float, float, float]#
Convert roll/pitch/yaw (radians) to a quaternion
(x, y, z, w).ROS transforms carry quaternions while people describe mounts in roll, pitch and yaw, so a recipe states the readable form and this converts. Rotations compose in the ROS convention: yaw about Z, then pitch about Y, then roll about X.
- Parameters:
roll – Rotation about X, in radians
pitch – Rotation about Y, in radians
yaw – Rotation about Z, in radians
- Returns:
Quaternion as
(x, y, z, w)- Return type:
Tuple[float, float, float, float]
- ros_sugar.robot.mount.pose_relative_to(pose: Tuple[Tuple[float, float, float], Tuple[float, float, float]], frame: Tuple[Tuple[float, float, float], Tuple[float, float, float]]) Tuple[Tuple[float, float, float], Tuple[float, float, float]]#
Where one mounted thing sits in another’s frame.
A robot knows where each of its sensors sits on its body, while whatever reads one of them usually wants another in its own frame. Both arguments and the result are
(xyz, rpy)against the same parent.- Parameters:
pose – What is being placed, as
(xyz, rpy)on the parentframe – Whose frame to place it in, as
(xyz, rpy)on the parent
- Returns:
(xyz, rpy)ofposeinframe
- class ros_sugar.robot.mount.Mount#
Bases:
ros_sugar.config.BaseAttrsA static placement of a sensor relative to something else.
Name
Type, Default
Description
parent
str | PluginWhat the sensor is mounted on: the robot plugin, another sensor plugin, or a frame name such as the world frame for a fixed sensor.
xyz
tuple,(0, 0, 0)Translation from the parent frame to the sensor frame, in metres.
rpy
tuple,(0, 0, 0)Rotation from the parent frame to the sensor frame, in radians.
- property parent_frame: str#
Frame this mount is relative to.
- property child_frame: str#
Frame being placed.
- asdict(filter: Optional[Callable] = None) Dict#
- to_dict() Dict#
- asdict_explicit() 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]]#