pycram.ros.no_ros#

Submodules#

Attributes#

Exceptions#

ResourceNotFound

Exception raised when a resource is not found.

ServiceException

Exception class for service exceptions.

Classes#

Time

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

Functions#

get_ros_package_path(→ str)

Get the path of a ROS package. Using the os module to avoid importing rospkg.

sleep(duration)

get_node_names([namespace])

Get the names of all nodes in the ROS system.

create_ros_pack([ros_paths])

Creates a RosPack instance to search for resources of ros packages.

get_parameter(name)

Get a parameter from the ROS parameter server.

wait_for_message(topic_name, msg_type)

Wait for a message on a topic.

is_master_online()

Check if the ROS master is online.

get_time()

Get the current time from the ROS system.

logwarn(msg)

logerr(msg)

loginfo(msg)

logdebug(msg)

logwarn_once(msg)

logerr_once(msg)

loginfo_once(msg)

logdebug_once(msg)

set_logger_level(level)

Set the logging level for the logger.

Duration([duration])

Rate(rate)

get_service_proxy(→ None)

Get a service proxy for a given topic name and service message type.

wait_for_service(→ None)

Wait for a service to become available.

create_action_client(→ None)

Create an action client for the given topic name and action message type.

create_publisher(→ None)

Create a ROS publisher.

create_subscriber(topic, msg_type, callback[, queue_size])

Create a ROS subscriber.

Package Contents#

pycram.ros.no_ros.get_ros_package_path(package_name: str) str#

Get the path of a ROS package. Using the os module to avoid importing rospkg.

pycram.ros.no_ros.sleep(duration: float)#
pycram.ros.no_ros.get_node_names(namespace=None)#

Get the names of all nodes in the ROS system.

pycram.ros.no_ros.create_ros_pack(ros_paths=None)#

Creates a RosPack instance to search for resources of ros packages.

exception pycram.ros.no_ros.ResourceNotFound#

Bases: Exception

Exception raised when a resource is not found.

pycram.ros.no_ros.get_parameter(name: str)#

Get a parameter from the ROS parameter server.

pycram.ros.no_ros.wait_for_message(topic_name: str, msg_type)#

Wait for a message on a topic.

pycram.ros.no_ros.is_master_online()#

Check if the ROS master is online.

pycram.ros.no_ros.get_time()#

Get the current time from the ROS system.

pycram.ros.no_ros.format = '%(filename)s %(lineno)s %(funcName)s %(message)s'#
pycram.ros.no_ros.logger#
pycram.ros.no_ros.logwarn(msg: str)#
pycram.ros.no_ros.logerr(msg: str)#
pycram.ros.no_ros.loginfo(msg: str)#
pycram.ros.no_ros.logdebug(msg: str)#
pycram.ros.no_ros.logwarn_once(msg: str)#
pycram.ros.no_ros.logerr_once(msg: str)#
pycram.ros.no_ros.loginfo_once(msg: str)#
pycram.ros.no_ros.logdebug_once(msg: str)#
pycram.ros.no_ros.set_logger_level(level: int)#

Set the logging level for the logger. :param level: The logging level to set.

class pycram.ros.no_ros.Time(time=0.0, nsec=0.0)#

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

time = 0.0#
nsec = 0.0#
classmethod now()#
to_sec()#
pycram.ros.no_ros.Duration(duration=0.0)#
pycram.ros.no_ros.Rate(rate)#
exception pycram.ros.no_ros.ServiceException(message: str)#

Bases: Exception

Exception class for service exceptions.

message#
pycram.ros.no_ros.get_service_proxy(topic_name: str, service_message) None#

Get a service proxy for a given topic name and service message type.

Parameters:
  • topic_name – The name of the service.

  • service_message – The type of the service message.

Returns:

A service proxy for the specified topic and message type.

pycram.ros.no_ros.wait_for_service(topic_name: str) None#

Wait for a service to become available.

Parameters:

topic_name – The name of the service.

pycram.ros.no_ros.create_action_client(topic_name: str, action_message) None#

Create an action client for the given topic name and action message type.

Args:

topic_name (str): The name of the action topic. action_message: The action message type.

Returns:

None

pycram.ros.no_ros.create_publisher(topic, msg_type, queue_size=10, latch: bool = False) None#

Create a ROS publisher.

Parameters:
  • topic – The name of the topic to publish to.

  • msg_type – The type of message to publish.

  • queue_size – The size of the message queue.

  • latch – Whether to latch the last message sent.

Returns:

A ROS publisher object.

pycram.ros.no_ros.create_subscriber(topic, msg_type, callback, queue_size=10)#

Create a ROS subscriber.

Parameters:
  • topic – The name of the topic to subscribe to.

  • msg_type – The type of message to subscribe to.

  • callback – The callback function to call when a message is received.

  • queue_size – The size of the message queue.

Returns:

A ROS subscriber object.