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 class-attribute instance-attribute

voltage = MosaicoField(
    description="The battery voltage in V."
)

The battery voltage value

temperature class-attribute instance-attribute

temperature = MosaicoField(
    default=None,
    description="The battery temperature in °C",
)

The optional battery temperature in °C

current class-attribute instance-attribute

current = MosaicoField(
    default=None,
    description="Optional battery charge in A.",
)

The optional battery current in A

charge class-attribute instance-attribute

charge = MosaicoField(
    default=None,
    description="Optional battery charge in Ah.",
)

The optional battery charge in Ah

capacity class-attribute instance-attribute

capacity = MosaicoField(
    default=None,
    description="Optional batterty capacity in Ah.",
)

The optional battery capacity in Ah

design_capacity class-attribute instance-attribute

design_capacity = MosaicoField(
    default=None,
    description="Optional battery design capacity in Ah.",
)

The optional battery design capacity in Ah

percentage class-attribute instance-attribute

percentage = MosaicoField(
    description="Battery percentage in %."
)

The battery percentage in %

power_supply_status class-attribute instance-attribute

power_supply_status = MosaicoField(
    description="The charging status."
)

The charging status

power_supply_health class-attribute instance-attribute

power_supply_health = MosaicoField(
    description="The battery health."
)

The battery health

power_supply_technology class-attribute instance-attribute

power_supply_technology = MosaicoField(
    description="The battery technology."
)

The battery technology

present class-attribute instance-attribute

present = MosaicoField(description='Battery presence.')

The battery presence

location class-attribute instance-attribute

location = MosaicoField(
    description="Battery location (like the slot)."
)

The battery location (like the slot)

serial_number class-attribute instance-attribute

serial_number = MosaicoField(
    description="Battery serial number."
)

The battery serial number

cell_voltage class-attribute instance-attribute

cell_voltage = MosaicoField(
    default=None, description="Battery cells voltage."
)

The battery cells voltage

cell_temperature class-attribute instance-attribute

cell_temperature = MosaicoField(
    default=None, description="Battery cells temperature."
)

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 __pydantic_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 class-attribute instance-attribute

transforms = MosaicoField(
    description="List of coordinate frames transformations."
)

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 __pydantic_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 class-attribute instance-attribute

height = MosaicoField(
    description="The height of the point cloud."
)

The height of the point cloud.

width class-attribute instance-attribute

width = MosaicoField(
    description="The width of the point cloud."
)

The width of the point cloud.

fields class-attribute instance-attribute

fields = MosaicoField(
    description="The fields of the point cloud."
)

The fields of the point cloud.

is_bigendian class-attribute instance-attribute

is_bigendian = MosaicoField(
    description="Whether the data is big-endian."
)

Whether the data is big-endian.

point_step class-attribute instance-attribute

point_step = MosaicoField(
    description="Length of a point in bytes."
)

Length of a point in bytes.

row_step class-attribute instance-attribute

row_step = MosaicoField(
    description="Length of a row in bytes."
)

Length of a row in bytes.

data class-attribute instance-attribute

data = MosaicoField(
    description="The point cloud data. Expected size: row_step * height bytes."
)

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

is_dense class-attribute instance-attribute

is_dense = MosaicoField(
    description="True if there are no invalid points."
)

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 __pydantic_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 class-attribute instance-attribute

name = MosaicoField(description='Name of the field.')

The name of the point field.

offset class-attribute instance-attribute

offset = MosaicoField(
    description="Staring position of the field."
)

The Offset from start of point struct.

datatype class-attribute instance-attribute

datatype = MosaicoField(
    description="Datatype of the field."
)

The data type of the point field, see PointFieldDatatype.

count class-attribute instance-attribute

count = MosaicoField(
    description="Number of elements in the point field."
)

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