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#

Mount

A static placement of a sensor relative to something else.

Functions#

quaternion_from_euler

Convert roll/pitch/yaw (radians) to a quaternion (x, y, z, w).

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]

class ros_sugar.robot.mount.Mount#

Bases: ros_sugar.config.BaseAttrs

A static placement of a sensor relative to something else.

Name

Type, Default

Description

parent

str | Plugin

What 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]]#