2Stand-ins for `rospy.core` in ROS2.
4------------------------------------------------------------------------------
5This file is part of rosros - simple unified interface to ROS1 / ROS2.
6Released under the BSD License.
11------------------------------------------------------------------------------
13## @namespace rosros.rospify.core
16from . import exceptions
17from . log import logdebug, logwarn, loginfo, logout, logerr, logfatal, \
18 logdebug_throttle, logwarn_throttle, loginfo_throttle, logerr_throttle, \
20 logdebug_throttle_identical, logwarn_throttle_identical, \
21 loginfo_throttle_identical, logerr_throttle_identical, \
22 logfatal_throttle_identical, \
23 logdebug_once, logwarn_once, loginfo_once, logerr_once, logfatal_once
27 """Returns whether ROS2 has been started and shut down."""
31def signal_shutdown(reason):
33 Initiates shutdown process.
35 @param reason ignored (ROS1 compatibility stand-
in)
41 """Returns empty string (ROS1 compatibility stand-in)."""
45def get_ros_root(required=False, env=None):
47 Returns rclpy share directory.
49 In ROS1, this returns a path along the lines of "/opt/ros/noetic/share/ros".
51 @param env ignored (ROS1 compatibility stand-
in)
52 @param required fail
with ROSException
if not found
53 @return rclpy share directory path
55 @throws ROSException
if `require`
is True and result unavailable
58 return ros2.get_package_share_directory(
"rclpy")
67def parse_rosrpc_uri(uri):
69 Utility function for parsing ROS-RPC URIs.
72 @return (address, port)
74 @throws ParameterInvalid
if uri
is not a valid ROSRPC URI
76 if uri.startswith(ROSRPC):
77 dest_addr = uri[len(ROSRPC):]
82 dest_addr = dest_addr[:dest_addr.find(
"/")]
83 dest_addr, dest_port = dest_addr.split(
":")
84 dest_port = int(dest_port)
85 except Exception
as e:
87 return dest_addr, dest_port
91 "ROSRPC",
"get_node_uri",
"get_ros_root",
"is_shutdown",
"parse_rosrpc_uri",
"signal_shutdown",
92 "logdebug",
"logwarn",
"loginfo",
"logout",
"logerr",
"logfatal",
93 "logdebug_throttle",
"logwarn_throttle",
"loginfo_throttle",
"logerr_throttle",
95 "logdebug_throttle_identical",
"logwarn_throttle_identical",
"loginfo_throttle_identical",
96 "logerr_throttle_identical",
"logfatal_throttle_identical",
97 "logdebug_once",
"logwarn_once",
"loginfo_once",
"logerr_once",
"logfatal_once"
Base exception class for ROS clients.
is_shutdown()
Returns whether ROS2 has been started and shut down.
get_node_uri()
Returns empty string (ROS1 compatibility stand-in).