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
¶
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.
cell_temperature
class-attribute
instance-attribute
¶
The battery cells temperature
is_registered
classmethod
¶
Checks if a class is registered.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if registered. |
ontology_tag
classmethod
¶
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., |
Raises:
| Type | Description |
|---|---|
Exception
|
If the class was not properly initialized via |
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
¶
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.
is_registered
classmethod
¶
Checks if a class is registered.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if registered. |
ontology_tag
classmethod
¶
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., |
Raises:
| Type | Description |
|---|---|
Exception
|
If the class was not properly initialized via |
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]}")