2Stand-in for `rclpy` in ROS1.
4Heavily modified copy from ROS2 `rclpy`,
5at https://github.com/ros2/rclpy (`rclpy/rclpy/__init__.py`),
6released under the Apache 2.0 License.
8------------------------------------------------------------------------------
9This file is part of rosros - simple unified interface to ROS1 / ROS2.
10Released under the BSD License.
15------------------------------------------------------------------------------
17## @namespace rosros.rclify.rclify
19# Original file copyright notice:
21# Copyright 2016 Open Source Robotics Foundation, Inc.
23# Licensed under the Apache License, Version 2.0 (the "License");
24# you may not use this file except in compliance with the License.
25# You may obtain a copy of the License at
27# http://www.apache.org/licenses/LICENSE-2.0
39from . node
import Node
42def init(*, args=None, context=None):
44 Does nothing (ROS2 API compatibility stand-in)
46 @param args ignored (ROS2 API compatibility stand-
in)
47 @param context ignored (ROS2 API compatibility stand-
in)
50 patch.patch_ros1_rclify()
53def create_node(node_name, *, context=None, cli_args=None, namespace=None,
54 use_global_arguments=True, enable_rosout=True, start_parameter_services=True,
55 parameter_overrides=None, allow_undeclared_parameters=False,
56 automatically_declare_parameters_from_overrides=False
61 @param node_name a name to give to the node
62 @param context ignored (ROS2 API compatibility stand-
in)
63 @param cli_args command-line arguments to be used by the node
64 @param namespace node namespace
65 @param use_global_arguments should the node use process-wide command-line arguments
66 @param enable_rosout publish logging to `/rosout`
67 @param start_parameter_services ignored (ROS2 API compatibility stand-
in)
68 @param parameter_overrides list of `Parameter` to override the
69 initial values of parameters declared on the node
70 @param allow_undeclared_parameters allow undeclared parameters;
71 this option doesn
't affect `parameter_overrides`
72 @param automatically_declare_parameters_from_overrides
73 implicitly declare parameters
from `parameter_overrides`
77 node_name, context=context, cli_args=cli_args, namespace=namespace,
78 use_global_arguments=use_global_arguments,
79 enable_rosout=enable_rosout,
80 start_parameter_services=start_parameter_services,
81 parameter_overrides=parameter_overrides,
82 allow_undeclared_parameters=allow_undeclared_parameters,
83 automatically_declare_parameters_from_overrides=automatically_declare_parameters_from_overrides
87def spin_once(node=None, *, executor=None, timeout_sec=None):
89 Waits until timeout or ROS shut down,
or forever
if timeout
not specified.
91 @param node ignored (ROS2 API compatibility stand-
in)
92 @param executor ignored (ROS2 API compatibility stand-
in)
93 @param timeout_sec time to wait,
as seconds
or ROS1 duration
95 ros1.spin_once(timeout_sec)
98def spin(node=None, executor=None):
102 @param node ignored (ROS2 API compatibility stand-
in)
103 @param executor ignored (ROS2 API compatibility stand-
in)
110 Waits until future complete or timeout reached
or ROS shut down.
112 @param node ignored (ROS2 API compatibility stand-
in)
113 @param future object
with `concurrent.futures.Future`-conforming interface to complete
114 @param executor ignored (ROS2 API compatibility stand-
in)
115 @param timeout_sec time to wait,
as seconds
or ROS1 duration
117 ros1.spin_until_future_complete(future, timeout_sec)
121 """Returns None (ROS2 API compatibility stand-in)."""
126 """Returns None (ROS2 API compatibility stand-in)."""
131 """Returns empty string (ROS2 API compatibility stand-in)."""
135def ok(*, context=None):
137 Returns whether rospy has been initialized and is not shut down.
139 @param context ignored (ROS2 API compatibility stand-
in)
146 Sends the shutdown signal to rospy.
148 @param context ignored (ROS2 API compatibility stand-
in)
150 rospy.signal_shutdown(reason="")
155 Sends the shutdown signal to rospy.
157 @param context ignored (ROS2 API compatibility stand-
in)
159 rospy.signal_shutdown(reason="")
163 "create_node",
"get_default_context",
"get_global_executor",
164 "get_rmw_implementation_identifier",
"init",
"ok",
"shutdown",
165 "spin",
"spin_once",
"spin_until_future_complete",
"try_shutdown"
spin()
Spins ROS node forever.
ok()
Returns whether ROS has been initialized and is not shut down.
spin_once(node=None, *executor=None, timeout_sec=None)
Waits until timeout or ROS shut down, or forever if timeout not specified.
get_rmw_implementation_identifier()
Returns empty string (ROS2 API compatibility stand-in).
shutdown(*context=None)
Sends the shutdown signal to rospy.
get_default_context()
Returns None (ROS2 API compatibility stand-in).
try_shutdown(*context=None)
Sends the shutdown signal to rospy.
get_global_executor()
Returns None (ROS2 API compatibility stand-in).
create_node(node_name, *context=None, cli_args=None, namespace=None, use_global_arguments=True, enable_rosout=True, start_parameter_services=True, parameter_overrides=None, allow_undeclared_parameters=False, automatically_declare_parameters_from_overrides=False)
Initializes ROS1 and returns an instance of `rosros.rclify.node.Node`.
spin_until_future_complete(node=None, future=None, executor=None, timeout_sec=None)
Waits until future complete or timeout reached or ROS shut down.
init(*args=None, context=None)
Does nothing (ROS2 API compatibility stand-in)