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

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

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

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

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]}")

mosaicolabs.ros_bridge.data_ontology.PointCloud2

Bases: Serializable

Represents a point cloud in ROS2.

modeled after: sensor_msgs/msg/PointCloud2

Note

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

height instance-attribute

height

The height of the point cloud.

width instance-attribute

width

The width of the point cloud.

fields instance-attribute

fields

The fields of the point cloud.

is_bigendian instance-attribute

is_bigendian

Whether the data is big-endian.

point_step instance-attribute

point_step

Length of a point in bytes.

row_step instance-attribute

row_step

Length of a row in bytes.

data instance-attribute

data

The point cloud data. Expected size: row_step * height bytes.

is_dense instance-attribute

is_dense

True if there are no invalid points.

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.PointField

Bases: Serializable

Represents a point field in a point cloud in ROS2.

modeled after: sensor_msgs/msg/PointField

name instance-attribute

name

The name of the point field.

offset instance-attribute

offset

The Offset from start of point struct.

datatype instance-attribute

datatype

The data type of the point field, see PointFieldDatatype.

count instance-attribute

count

The number of elements in the point field.

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]}")