rclpy.exceptions module

exception rclpy.exceptions.InvalidNamespaceException(name: str, error_msg: str, invalid_index: int)

Bases: NameValidationException

Raised when a namespace is invalid.

exception rclpy.exceptions.InvalidNodeNameException(name: str, error_msg: str, invalid_index: int)

Bases: NameValidationException

Raised when a node name is invalid.

exception rclpy.exceptions.InvalidParameterException(parameter_name: str)

Bases: ParameterException

Raised when a parameter to be declared has an invalid name.

exception rclpy.exceptions.InvalidParameterTypeException(desired_parameter: Parameter, expected_type: str)

Bases: ParameterException

Raised when a parameter is rejected for having an invalid type.

class Parameter(name: str, type_: Type | None = None)
class Parameter(name: str, type_: Type, value: AllowableParameterValueT)
class Parameter(name: str, *, value: AllowableParameterValueT)

Bases: Generic[AllowableParameterValueT]

class Type(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntEnum

check(parameter_value: AllowableParameterValueT) bool
classmethod from_parameter_value(parameter_value: AllowableParameterValueT) Type

Get a Parameter.Type from a given variable.

Returns:

A Parameter.Type corresponding to the instance type of the given value.

Raises:

TypeError if the conversion to a type was not possible.

classmethod from_parameter_msg(param_msg: rcl_interfaces.msg.Parameter) Parameter[AllowableParameterValueT]
get_parameter_value() rcl_interfaces.msg.ParameterValue
property name: str
to_parameter_msg() rcl_interfaces.msg.Parameter
property type_: Type
property value: AllowableParameterValueT
exception rclpy.exceptions.InvalidParameterValueException(parameter: str, value: AllowableParameterValue, reason: str)

Bases: ParameterException

Raised when a parameter is rejected by a user callback or when applying a descriptor.

exception rclpy.exceptions.InvalidServiceNameException(name: str, error_msg: str, invalid_index: int)

Bases: NameValidationException

Raised when a service name is invalid.

exception rclpy.exceptions.InvalidTopicNameException(name: str, error_msg: str, invalid_index: int)

Bases: NameValidationException

Raised when a topic name is invalid.

exception rclpy.exceptions.NameValidationException(name_type: str, name: str, error_msg: str, invalid_index: int)

Bases: Exception

Raised when a topic name, node name, or namespace are invalid.

exception rclpy.exceptions.NoTypeSupportImportedException

Bases: Exception

Raised when there is no type support imported.

exception rclpy.exceptions.NotInitializedException(message: str | None = None)

Bases: Exception

Raised when the rclpy implementation is accessed before rclpy.init().

exception rclpy.exceptions.ParameterAlreadyDeclaredException(parameters: str | List[str])

Bases: ParameterException

Raised when declaring a parameter that had been declared before.

exception rclpy.exceptions.ParameterException(error_msg: str, parameters: str | List[str])

Bases: Exception

Base exception for parameter-related errors.

exception rclpy.exceptions.ParameterImmutableException(parameter_name: str)

Bases: ParameterException

Raised when a read-only parameter is modified.

exception rclpy.exceptions.ParameterNotDeclaredException(parameters: str | List[str])

Bases: ParameterException

Raised when handling an undeclared parameter when it is not allowed.

exception rclpy.exceptions.ParameterUninitializedException(parameter_name: str)

Bases: ParameterException

Raised when an uninitialized parameter is accessed.

exception rclpy.exceptions.ROSInterruptException

Bases: Exception

Raised when an operation is canceled by rclpy shutting down.