Skip to content

ROS Custom Ontology

The following data models are specific to the ROS bridge and are not part of the official Mosaico Data Ontology yet.

mosaicolabs.ros_bridge.data_ontology.BatteryState

Bases: Serializable, HeaderMixin

Represents the state of a battery power supply.

modeled after: sensor_msgs/msg/BatteryState

Note

This model is still not included in the default ontology of Mosaico and is defined specifically for the ros-bridge module

header class-attribute instance-attribute

header = None

An optional metadata header providing temporal and spatial context to the ontology model.

This field is injected into the model via composition, ensuring that sensor data is paired with standard acquisition attributes like sequence IDs and high-precision timestamps.

Querying with the .Q Proxy

Check the documentation of the HeaderMixin to construct a valid expression for the QueryOntologyCatalog builder involving the header component.

voltage instance-attribute

voltage

The battery voltage value

temperature instance-attribute

temperature

The optional battery temperature in °C

current instance-attribute

current

The optional battery current in A

charge instance-attribute

charge

The optional battery charge in Ah

capacity instance-attribute

capacity

The optional battery capacity in Ah

design_capacity instance-attribute

design_capacity

The optional battery design capacity in Ah

percentage instance-attribute

percentage

The battery percentage in %

power_supply_status instance-attribute

power_supply_status

The charging status

power_supply_health instance-attribute

power_supply_health

The battery health

power_supply_technology instance-attribute

power_supply_technology

The battery technology

present instance-attribute

present

The battery presence

location instance-attribute

location

The battery location (like the slot)

serial_number instance-attribute

serial_number

The battery serial number

cell_voltage class-attribute instance-attribute

cell_voltage = None

The battery cells voltage

cell_temperature class-attribute instance-attribute

cell_temperature = None

The battery cells temperature

is_registered classmethod

is_registered()

Checks if a class is registered.

Returns:

Name Type Description
bool bool

True if registered.

ontology_tag classmethod

ontology_tag()

Retrieves the unique identifier (tag) for the current ontology class, automatically generated during class definition.

This method provides the string key used by the Mosaico platform to identify and route specific data types within the ontology registry. It abstracts away the internal naming conventions, ensuring that you always use the correct identifier for queries and serialization.

Returns:

Type Description
str

The registered string tag for this class (e.g., "imu", "gps").

Raises:

Type Description
Exception

If the class was not properly initialized via __init_subclass__.

Practical Application: Topic Filtering

This method is particularly useful when constructing QueryTopic requests. By using the convenience method QueryTopic.with_ontology_tag(), you can filter topics by data type without hardcoding strings that might change.

Example:

from mosaicolabs import MosaicoClient, Topic, IMU, QueryTopic

with MosaicoClient.connect("localhost", 6726) as client:
    # Filter for a specific data value (using constructor)
    qresponse = client.query(
        QueryTopic(
            Topic.with_ontology_tag(IMU.ontology_tag()),
        )
    )

    # Inspect the response
    if qresponse is not None:
        # Results are automatically grouped by Sequence for easier data management
        for item in qresponse:
            print(f"Sequence: {item.sequence.name}")
            print(f"Topics: {[topic.name for topic in item.topics]}")

mosaicolabs.ros_bridge.data_ontology.FrameTransform

Bases: Serializable, HeaderMixin

Represents a list of transformations between two coordinates.

modeled after: tf2_msgs/msg/TFMessage

Note

This model is not included in the default ontology of Mosaico and is defined specifically for the ros-bridge module

header class-attribute instance-attribute

header = None

An optional metadata header providing temporal and spatial context to the ontology model.

This field is injected into the model via composition, ensuring that sensor data is paired with standard acquisition attributes like sequence IDs and high-precision timestamps.

Querying with the .Q Proxy

Check the documentation of the HeaderMixin to construct a valid expression for the QueryOntologyCatalog builder involving the header component.

transforms instance-attribute

transforms

List of coordinate frames transformations.

is_registered classmethod

is_registered()

Checks if a class is registered.

Returns:

Name Type Description
bool bool

True if registered.

ontology_tag classmethod

ontology_tag()

Retrieves the unique identifier (tag) for the current ontology class, automatically generated during class definition.

This method provides the string key used by the Mosaico platform to identify and route specific data types within the ontology registry. It abstracts away the internal naming conventions, ensuring that you always use the correct identifier for queries and serialization.

Returns:

Type Description
str

The registered string tag for this class (e.g., "imu", "gps").

Raises:

Type Description
Exception

If the class was not properly initialized via __init_subclass__.

Practical Application: Topic Filtering

This method is particularly useful when constructing QueryTopic requests. By using the convenience method QueryTopic.with_ontology_tag(), you can filter topics by data type without hardcoding strings that might change.

Example:

from mosaicolabs import MosaicoClient, Topic, IMU, QueryTopic

with MosaicoClient.connect("localhost", 6726) as client:
    # Filter for a specific data value (using constructor)
    qresponse = client.query(
        QueryTopic(
            Topic.with_ontology_tag(IMU.ontology_tag()),
        )
    )

    # Inspect the response
    if qresponse is not None:
        # Results are automatically grouped by Sequence for easier data management
        for item in qresponse:
            print(f"Sequence: {item.sequence.name}")
            print(f"Topics: {[topic.name for topic in item.topics]}")