module documentation

The Parser: a ROS2 interface definition becomes a field structure and its types.

It reads the installed interface package by introspection over the generated class. The vendored parser in tools/catalog/ reads the other source and produces the same MessageDescription; a Jazzy CI job checks that the two agree. This is the one module that imports interface packages, and it imports no rclpy. Private: an interface class must not reach code above the seam.

Function describe Return the structure of a ROS2 message type, read off its installed interface class.
Function import_action_class Import and return the generated class for a ROS2 action type (package/action/Name).
Function import_interface_class Import and return the generated interface class for a ROS2 type name.
Function import_service_class Import and return the generated class for a ROS2 service type (package/srv/Name).
Function _action_member Return the generated class of an action's goal, feedback or result, or None.
Function _describe_class Model every field of an interface class, in declaration order.
Function _import_members Import an action or service class, which has no fields of its own and so skips import_interface_class.
Function _import_package Import the module one ROS2 type lives in, and return the parts of its name with it.
Function _nested_type_name Return the fully qualified name of a slot's nested type, or None when it has none.
def describe(type_name: str) -> MessageDescription:

Return the structure of a ROS2 message type, read off its installed interface class.

def import_action_class(type_name: str) -> Any:

Import and return the generated class for a ROS2 action type (package/action/Name).

Raises
InvalidMessageTypeNameErrorWhen the name has the wrong shape.
MissingInterfacePackageErrorWhen the interface package is not installed.
UnusableMessageTypeErrorWhen the package has no such action.
def import_interface_class(type_name: str) -> Any:

Import and return the generated interface class for a ROS2 type name.

Parameters
type_name:strpackage/kind/Name, or package/Name for a message.
Returns
AnyUndocumented
Raises
InvalidMessageTypeNameErrorWhen the name has neither shape.
MissingInterfacePackageErrorWhen the interface package is not installed. This is fatal at init: rclpy cannot subscribe to a type without its typesupport.
UnusableMessageTypeErrorWhen the package is installed but has no such message.
def import_service_class(type_name: str) -> Any:

Import and return the generated class for a ROS2 service type (package/srv/Name).

Raises
InvalidMessageTypeNameErrorWhen the name has the wrong shape.
MissingInterfacePackageErrorWhen the interface package is not installed.
UnusableMessageTypeErrorWhen the package has no such service.
def _action_member(module: Any, name: str) -> Any:

Return the generated class of an action's goal, feedback or result, or None.

The package exports only Fibonacci, while ROS2 names the goal Fibonacci_Goal elsewhere, so that spelling is resolved as Fibonacci.Goal. The suffix must be an action member name, so a message genuinely called Foo_Bar is not mistaken for a member of a missing Foo.

def _describe_class(type_name: str, interface_class: Any) -> MessageDescription:

Model every field of an interface class, in declaration order.

def _import_members(type_name: str, what: str, members: Iterable[str]) -> Any:

Import an action or service class, which has no fields of its own and so skips import_interface_class.

def _import_package(type_name: str) -> tuple[str, str, Any, str]:

Import the module one ROS2 type lives in, and return the parts of its name with it.

Raises
MissingInterfacePackageErrorWhen the interface package is not installed.
UnusableMessageTypeErrorWhen the package is installed but the module is not there.
def _nested_type_name(slot: object) -> str | None:

Return the fully qualified name of a slot's nested type, or None when it has none.

The field-type string drops the msg/srv/action namespace, which only the slot keeps.