pycram.ros.ros2#

Submodules#

Attributes#

Classes#

Time

Class to abstract the ROS2 Time, to make it more consistent with the ROS1 Time class.

LoggerLevel

Enum for the different logger levels.

ServiceProxy

Functions#

to_sec(self)

Returns the time in seconds from a builtin_interfaces.msg.Time message.

Duration([duration])

Rate(rate)

set_logger_level(level)

Set the logger level for the pycram logger. Possible values are: DEBUG, INFO, WARN, ERROR, FATAL.

set_logger_format(logger_format)

Set the logger format for the pycram logger. The format can contain the following placeholders:

logwarn(message)

loginfo(message)

logerr(message)

logdebug(message)

logwarn_once(message)

loginfo_once(message)

logerr_once(message)

logdebug_once(message)

create_action_client(→ rclpy.action.ActionClient)

loginfo_once(message)

get_service_proxy(→ rclpy.client.Client)

wait_for_service(topic_name, service_message)

create_publisher(→ rclpy.publisher.Publisher)

create_subscriber(→ rclpy.subscription.Subscription)

Package Contents#

pycram.ros.ros2.to_sec(self)#

Returns the time in seconds from a builtin_interfaces.msg.Time message.

Returns:

The time in seconds.

pycram.ros.ros2.node#
class pycram.ros.ros2.Time(time=0, nsecs=0)#

Bases: builtin_interfaces.msg.Time

Class to abstract the ROS2 Time, to make it more consistent with the ROS1 Time class.

classmethod now()#
to_sec()#
pycram.ros.ros2.Duration(duration=0.0)#
pycram.ros.ros2.Rate(rate)#
class pycram.ros.ros2.LoggerLevel#

Bases: enum.Enum

Enum for the different logger levels.

DEBUG = 'debug'#
INFO = 'info'#
WARN = 'warn'#
ERROR = 'error'#
FATAL = 'fatal'#
pycram.ros.ros2.set_logger_level(level: pycram.datastructures.enums.LoggerLevel)#

Set the logger level for the pycram logger. Possible values are: DEBUG, INFO, WARN, ERROR, FATAL.

Parameters:

level – The level to set the logger to.

pycram.ros.ros2.set_logger_format(logger_format: str)#

Set the logger format for the pycram logger. The format can contain the following placeholders: - {severity} - {name} - {message} - {function_name} - {file_name} - {line_number} The format is set to the environment variable RCUTILS_CONSOLE_OUTPUT_FORMAT. Therefore, the format is not only applied to the pycram logger but to all loggers in the environment.

Parameters:

logger_format – The format to set the logger to.

pycram.ros.ros2.logwarn(message: str)#
pycram.ros.ros2.loginfo(message: str)#
pycram.ros.ros2.logerr(message: str)#
pycram.ros.ros2.logdebug(message: str)#
pycram.ros.ros2.logwarn_once(message: str)#
pycram.ros.ros2.loginfo_once(message: str)#
pycram.ros.ros2.logerr_once(message: str)#
pycram.ros.ros2.logdebug_once(message: str)#
pycram.ros.ros2.create_action_client(topic_name: str, action_message) rclpy.action.ActionClient#
pycram.ros.ros2.loginfo_once(message: str)#
pycram.ros.ros2.services#
class pycram.ros.ros2.ServiceProxy(topic_name, service_message)#
service#
message_type#
__call__(*args, **kwargs)#
wait_for_service(*args, **kwargs)#
pycram.ros.ros2.get_service_proxy(topic_name: str, service_message) rclpy.client.Client#
pycram.ros.ros2.wait_for_service(topic_name: str, service_message)#
pycram.ros.ros2.create_publisher(topic, msg_type, queue_size=10) rclpy.publisher.Publisher#
pycram.ros.ros2.create_subscriber(topic, msg_type, callback, queue_size=10) rclpy.subscription.Subscription#