rosros 0.2.5
Simple unified interface to ROS1 / ROS2 Python API
Loading...
Searching...
No Matches
rosros.rclify.node.Node Class Reference

Public Member Functions

 __init__ (self, node_name, *context=None, cli_args=None, namespace=None, use_global_arguments=True, enable_rosout=True, start_parameter_services=None, parameter_overrides=None, allow_undeclared_parameters=False, automatically_declare_parameters_from_overrides=False)
 Creates a ROS1 node.
 
 add_on_set_parameters_callback (self, callback)
 Add a callback in front to the list of callbacks.
 
 add_waitable (self, waitable)
 Does nothing (ROS2 API compatibility stand-in).
 
 count_publishers (self, topic_name)
 Return the number of publishers on a given topic, globally.
 
 count_subscribers (self, topic_name)
 Return the number of subscribers on a given topic.
 
 create_client (self, srv_type, srv_name, *qos_profile=None, callback_group=None)
 Creates a new service client.
 
 create_guard_condition (self, callback, callback_group=None)
 Does nothing and returns None (ROS2 API compatibility stand-in).
 
 create_publisher (self, msg_type, topic, qos_profile, *callback_group=None, event_callbacks=None)
 Creates a new publisher.
 
 create_rate (self, frequency, clock=None)
 Creates a rate object.
 
 create_service (self, srv_type, srv_name, callback, *qos_profile=None, callback_group=None)
 Creates a new service server.
 
 create_subscription (self, msg_type, topic, callback, qos_profile, *callback_group=None, event_callbacks=None, raw=False)
 Creates a new subscription.
 
 create_timer (self, timer_period_sec, callback, callback_group=None, clock=None)
 Creates a new timer.
 
 declare_parameter (self, name, value=None, descriptor=None, ignore_override=False)
 Sets and initializes a node parameter.
 
 declare_parameters (self, namespace, parameters, ignore_override=False)
 Sets a list of parameters.
 
 describe_parameter (self, name)
 Get the parameter descriptor of a given parameter.
 
 describe_parameters (self, names)
 Get the parameter descriptors of a given list of parameters.
 
 destroy_client (self, client)
 Destroy a service client created by the node.
 
 destroy_guard_condition (self, guard)
 Does nothing (ROS2 API compatibility stand-in).
 
 destroy_node (self)
 Destroys the node and shuts down rospy.
 
 destroy_publisher (self, publisher)
 Destroy a publisher created by the node.
 
 destroy_rate (self, rate)
 Does nothing (ROS2 API compatibility stand-in).
 
 destroy_service (self, service)
 Destroy a service server created by the node.
 
 destroy_subscription (self, subscription)
 Destroy a subscription created by the node.
 
 destroy_timer (self, timer)
 Destroy a timer created by the node.
 
 get_client_names_and_types_by_node (self, node_name, node_namespace)
 Returns an empty list (ROS2 API compatibility stand-in)
 
 get_clock (self)
 Returns `clock.Clock` using ROS time.
 
 get_logger (self)
 Get the node's logger.
 
 get_name (self)
 Returns the name of the node, without namespace.
 
 get_namespace (self)
 Returns the namespace of the node.
 
 get_node_names (self)
 Get a list of names for discovered nodes.
 
 get_node_names_and_namespaces (self)
 Get a list of names and namespaces for discovered nodes.
 
 get_node_names_and_namespaces_with_enclaves (self)
 Get a list of names, namespaces and enclaves for discovered nodes.
 
 get_parameter (self, name)
 Returns a parameter by name.
 
 get_parameter_or (self, name, alternative_value=None)
 Returns a parameter or the alternative value.
 
 get_parameters (self, names)
 Returns a list of parameters.
 
 get_parameters_by_prefix (self, prefix)
 Get parameters that have a given prefix in their names as a dictionary.
 
 get_publisher_names_and_types_by_node (self, node_name, node_namespace, no_demangle=False)
 Gets a list of discovered topics for publishers of a remote node.
 
 get_publishers_info_by_topic (self, topic_name, no_mangle=False)
 Return a list of publishers on a given topic.
 
 get_service_names_and_types (self)
 Gets a list of available services.
 
 get_service_names_and_types_by_node (self, node_name, node_namespace)
 Gets a list of discovered service server topics for a remote node.
 
 get_subscriber_names_and_types_by_node (self, node_name, node_namespace, no_demangle=False)
 Gets a list of discovered topics for subscriptions of a remote node.
 
 get_subscriptions_info_by_topic (self, topic_name, no_mangle=False)
 Return a list of subscriptions on a given topic.
 
 get_topic_names_and_types (self, no_demangle=False)
 Gets a list of available topic names and types.
 
 has_parameter (self, name)
 Returns whether parameter exists.
 
 remove_on_set_parameters_callback (self, callback)
 Remove a callback from list of callbacks.
 
 remove_waitable (self, waitable)
 Does nothing (ROS2 API compatibility stand-in).
 
 set_descriptor (self, name, descriptor, alternative_value=None)
 Set a new descriptor for a given parameter.
 
 set_parameters (self, parameter_list)
 Set parameters for the node, and return the result for the set action.
 
 set_parameters_atomically (self, parameter_list)
 Set the given parameters, all at one time, and then aggregate result.
 
 set_parameters_callback (self, callback)
 Register a set parameters callback.
 
 undeclare_parameter (self, name)
 Unset a previously set parameter.
 

Static Public Attributes

int PARAM_REL_TOL = 1e-6
 Relative tolerance for floating-point parameter range steps.
 

Protected Member Functions

 _apply_descriptor (self, parameter, descriptor=None, check_read_only=True)
 Apply a descriptor to a parameter and return a result without saving the parameter.
 
 _apply_descriptor_and_set (self, parameter, descriptor=None, check_read_only=True)
 Apply parameter descriptor and set parameter if successful.
 
 _apply_descriptors (self, parameter_list, descriptors, check_read_only=True)
 Apply descriptors to parameters and return an aggregated result without saving parameters.
 
 _apply_floating_point_range (self, parameter, floating_point_range)
 Returns whether parameter value passes floating-point range check.
 
 _apply_integer_range (self, parameter, integer_range)
 Returns whether parameter value passes integer range check.
 
 _check_undeclared_parameters (self, parameter_list)
 Check if all parameters in list have correct types and were declared beforehand.
 
 _get_info_by_topic (self, topic_name, endpoint_type, no_mangle)
 Returns a list of `TopicEndpointInfo`.
 
 _set_parameters (self, parameter_list, descriptors=None, raise_on_failure=False, allow_undeclared_parameters=False)
 Set parameters for the node, and return the result for the set action.
 
 _set_parameters_atomically (self, parameter_list, descriptors=None, allow_not_set_type=False)
 Set the given parameters, all at one time, and then aggregate result.
 

Protected Attributes

 _allow_undeclared_parameters
 
 _clock
 
 _descriptors
 
 _parameter_overrides
 
 _parameters
 
 _parameters_callbacks
 

Properties

 clients = property
 Yields clients that have been created on this node.
 
 context = property
 Returns None (ROS2 API compatibility stand-in).
 
 default_callback_group = property
 Returns None (ROS2 API compatibility stand-in).
 
 executor = property
 Returns None (ROS2 API compatibility stand-in).
 
 guards = property
 Yields (ROS2 API compatibility stand-in).
 
 handle = property
 Returns None (ROS2 API compatibility stand-in).
 
 publishers = property
 Yields publishers that have been created on this node.
 
 services = property
 Yields services that have been created on this node.
 
 subscriptions = property
 Yields subscriptions that have been created on this node.
 
 timers = property
 Yields timers that have been created on this node.
 
 waitables = property
 Yields (ROS2 API compatibility stand-in).
 

Detailed Description

Definition at line 63 of file node.py.

Constructor & Destructor Documentation

◆ __init__()

rosros.rclify.node.Node.__init__ (   self,
  node_name,
context = None,
  cli_args = None,
  namespace = None,
  use_global_arguments = True,
  enable_rosout = True,
  start_parameter_services = None,
  parameter_overrides = None,
  allow_undeclared_parameters = False,
  automatically_declare_parameters_from_overrides = False 
)

Creates a ROS1 node.

Parameters
node_namea name to give to this node
contextignored (ROS2 API compatibility stand-in)
cli_argsa list of strings of command line args to be used only by this node; these arguments are used to extract remappings used by the node and other ROS specific settings, as well as user defined non-ROS arguments
namespacethe namespace to which relative topic and service names will be prefixed
use_global_arguments`False` if the node should ignore process-wide command line args
enable_rosout`False` if the node should ignore rosout logging
start_parameter_servicesignored (ROS2 API compatibility stand-in)
parameter_overrideslist of `Parameter` overrides for initial values of parameters declared on the node
allow_undeclared_parameterstrue if undeclared parameters are allowed; this flag affects the behavior of parameter-related operations
automatically_declare_parameters_from_overridesif True, `parameter_overrides` will be used to implicitly declare parameters on the node

Definition at line 88 of file node.py.

Member Function Documentation

◆ _apply_descriptor()

rosros.rclify.node.Node._apply_descriptor (   self,
  parameter,
  descriptor = None,
  check_read_only = True 
)
protected

Apply a descriptor to a parameter and return a result without saving the parameter.

This method sets the type in the descriptor to match the parameter type. If a descriptor is provided, its name will be set to the name of the parameter.

Parameters
parameter`Parameter` to be checked
descriptor`ParameterDescriptor` to apply, or None to use the stored descriptor
check_read_onlywhether to check for read-only descriptor
Returns
a `SetParametersResult` for all checks
Exceptions
ParameterNotDeclaredExceptionif descriptor is not provided, the given parameter is unknown and undeclared parameters are not allowed

Definition at line 699 of file node.py.

◆ _apply_descriptor_and_set()

rosros.rclify.node.Node._apply_descriptor_and_set (   self,
  parameter,
  descriptor = None,
  check_read_only = True 
)
protected

Apply parameter descriptor and set parameter if successful.

Parameters
parameter`Parameter` to be checked
descriptor`ParameterDescriptor` to apply, or None to use the stored descriptor
check_read_onlywhether to check for read-only descriptors

Definition at line 826 of file node.py.

◆ _apply_descriptors()

rosros.rclify.node.Node._apply_descriptors (   self,
  parameter_list,
  descriptors,
  check_read_only = True 
)
protected

Apply descriptors to parameters and return an aggregated result without saving parameters.

In case no descriptors are provided to the method, existing descriptors shall be used. In any case, if a given parameter doesn't have a descriptor it shall be skipped.

Parameters
parameter_listlist of `Parameter` to be checked
descriptors`{name: `ParameterDescriptor}` to apply
check_read_onlywhether to check for read-only descriptors
Returns
a single `SetParametersResult` for all checks
Exceptions
ParameterNotDeclaredExceptionif a descriptor is not provided, a given parameter is unknown and undeclared parameters are not allowed

Definition at line 674 of file node.py.

◆ _apply_floating_point_range()

rosros.rclify.node.Node._apply_floating_point_range (   self,
  parameter,
  floating_point_range 
)
protected

Returns whether parameter value passes floating-point range check.

Value must fall into given min-max range, endpoints included, and be a tolerably exact number of steps from range start if range has step defined.

Parameters
parameter`Parameter` to check
floating_point_range`FloatingPointRange` to use
Returns
`SetParametersResult` with success or failure reason

Definition at line 775 of file node.py.

◆ _apply_integer_range()

rosros.rclify.node.Node._apply_integer_range (   self,
  parameter,
  integer_range 
)
protected

Returns whether parameter value passes integer range check.

Value must fall into given min-max range, endpoints included, and be an exact number of steps from range start if range has step defined.

Parameters
parameter`Parameter` to check
integer_range`IntegerRange` to use
Returns
`SetParametersResult` with success or failure reason

Definition at line 732 of file node.py.

◆ _check_undeclared_parameters()

rosros.rclify.node.Node._check_undeclared_parameters (   self,
  parameter_list 
)
protected

Check if all parameters in list have correct types and were declared beforehand.

Parameters
parameter_listlist of `Parameter` to check
Exceptions
ParameterNotDeclaredExceptionif any given parameter is unknown

Definition at line 565 of file node.py.

◆ _get_info_by_topic()

rosros.rclify.node.Node._get_info_by_topic (   self,
  topic_name,
  endpoint_type,
  no_mangle 
)
protected

Returns a list of `TopicEndpointInfo`.

Parameters
endpoint_typeone of TopicEndpointTypeEnum
no_manglewhether topic name should be used as is, by default it will be namespaced under node and remapped

Definition at line 1324 of file node.py.

◆ _set_parameters()

rosros.rclify.node.Node._set_parameters (   self,
  parameter_list,
  descriptors = None,
  raise_on_failure = False,
  allow_undeclared_parameters = False 
)
protected

Set parameters for the node, and return the result for the set action.

Method for internal usage; applies a setter method for each parameters in the list. By default it checks if the parameters were declared, raising an exception if at least one of them was not.

If a callback was registered previously with `add_on_set_parameters_callback`, it will be called prior to setting the parameters for the node, once for each parameter. If the callback doesn't succeed for a given parameter, it won't be set and either an unsuccessful result will be returned for that parameter, or an exception will be raised according to `raise_on_failure` flag.

Parameters
parameter_listlist of `Parameter` to set.
descriptorsdescriptors to set to the given parameters, as ParameterDescriptor}`, either one for each parameter or none at all
raise_on_failureraise `InvalidParameterValueException` if any set-parameters callback rejects a parameter
allow_undeclared_parametersauto-declare unknown parameters
Returns
list of `SetParametersResult`, one for each input
Exceptions
InvalidParameterValueExceptionif any set-parameters callback rejects a parameter and `raise_on_failure` is true
ParameterNotDeclaredExceptionif undeclared parameters are not allowed, and any given parameter is unknown

Definition at line 508 of file node.py.

◆ _set_parameters_atomically()

rosros.rclify.node.Node._set_parameters_atomically (   self,
  parameter_list,
  descriptors = None,
  allow_not_set_type = False 
)
protected

Set the given parameters, all at one time, and then aggregate result.

This internal method does not reject undeclared parameters. If `allow_not_set_type` is False, a parameter with type `NOT_SET` will be undeclared.

If a callback was registered previously with `add_on_set_parameters_callback`, it will be called prior to setting the parameters for the node only once for all parameters. If the callback prevents the parameters from being set, then it will be reflected in the returned result; no exceptions will be raised in this case.

Parameters
parameter_listlist of `Parameter` to set
descriptorsnew descriptors to apply to the parameters before setting them, as ParameterDescriptor}`, one for each parameter or none at all
allow_not_set_typewhether to store parameters of `NOT_SET` type, or undeclare them if False
Returns
a single `SetParametersResult` for all parameters

Definition at line 595 of file node.py.

◆ add_on_set_parameters_callback()

rosros.rclify.node.Node.add_on_set_parameters_callback (   self,
  callback 
)

Add a callback in front to the list of callbacks.

Parameters
callbackfunction to call with (`[Parameter]`) when setting any node parameters, returning `SetParametersResult`

Definition at line 646 of file node.py.

◆ add_waitable()

rosros.rclify.node.Node.add_waitable (   self,
  waitable 
)

Does nothing (ROS2 API compatibility stand-in).

Definition at line 931 of file node.py.

◆ count_publishers()

rosros.rclify.node.Node.count_publishers (   self,
  topic_name 
)

Return the number of publishers on a given topic, globally.

`topic_name` may be a relative, private, or fully qualifed topic name. A relative or private topic is expanded using this node's namespace and name. The queried topic name is not remapped.

Parameters
topic_namethe topic_name on which to count the number of publishers
Returns
the number of publishers on the topic

Definition at line 1295 of file node.py.

◆ count_subscribers()

rosros.rclify.node.Node.count_subscribers (   self,
  topic_name 
)

Return the number of subscribers on a given topic.

`topic_name` may be a relative, private, or fully qualifed topic name. A relative or private topic is expanded using this node's namespace and name. The queried topic name is not remapped.

Parameters
topic_namethe topic_name on which to count the number of subscribers
Returns
the number of subscribers on the topic

Definition at line 1310 of file node.py.

◆ create_client()

rosros.rclify.node.Node.create_client (   self,
  srv_type,
  srv_name,
qos_profile = None,
  callback_group = None 
)

Creates a new service client.

Parameters
srv_typetype class of the service, like `std_srvs.srv.Trigger`
srv_namethe name of the service
qos_profileignored (ROS2 API compatibility stand-in)
callback_groupignored (ROS2 API compatibility stand-in)
Returns
`rospy.ServiceProxy` instance

Definition at line 986 of file node.py.

◆ create_guard_condition()

rosros.rclify.node.Node.create_guard_condition (   self,
  callback,
  callback_group = None 
)

Does nothing and returns None (ROS2 API compatibility stand-in).

Definition at line 1024 of file node.py.

◆ create_publisher()

rosros.rclify.node.Node.create_publisher (   self,
  msg_type,
  topic,
  qos_profile,
callback_group = None,
  event_callbacks = None 
)

Creates a new publisher.

Parameters
msg_typetype class of ROS messages the publisher will publish
topicthe name of the topic the publisher will publish to
qos_profilea `QoSProfile` or a queue size to apply to the publisher, publisher will be latched if `durability` is `TRANSIENT_LOCAL`
callback_groupignored (ROS2 API compatibility stand-in)
event_callbacksignored (ROS2 API compatibility stand-in)
Returns
`rospy.Publisher` instance

Definition at line 947 of file node.py.

◆ create_rate()

rosros.rclify.node.Node.create_rate (   self,
  frequency,
  clock = None 
)

Creates a rate object.

The timer will be started and every `timer_period_sec` number of seconds the provided callback function will be called.

Parameters
frequencythe frequency the Rate runs at (Hz)
clockignored (ROS2 API compatibility stand-in)
Returns
`rospy.Rate` instance

Definition at line 1037 of file node.py.

◆ create_service()

rosros.rclify.node.Node.create_service (   self,
  srv_type,
  srv_name,
  callback,
qos_profile = None,
  callback_group = None 
)

Creates a new service server.

Parameters
srv_typetype class of the service, like `std_srvs.srv.Trigger`
srv_namethe name of the service
callbacka user-defined callback function that is called when a service request is received by the server, as callback(request, response)
qos_profileignored (ROS2 API compatibility stand-in)
callback_groupignored (ROS2 API compatibility stand-in)
Returns
`rospy.Service` instance

Definition at line 1001 of file node.py.

◆ create_subscription()

rosros.rclify.node.Node.create_subscription (   self,
  msg_type,
  topic,
  callback,
  qos_profile,
callback_group = None,
  event_callbacks = None,
  raw = False 
)

Creates a new subscription.

Parameters
msg_typetype class of ROS messages the subscription will subscribe to.
topicthe name of the topic the subscription will subscribe to
callbacka user-defined callback function that is called when a message is received by the subscription
qos_profilea `QoSProfile` or a queue size to apply to the subscription
callback_groupignored (ROS2 API compatibility stand-in)
event_callbacksignored (ROS2 API compatibility stand-in)
rawif `True`, then subscription will be done with `rospy.AnyMsg`, providing message raw binary bytes
Returns
`rospy.Subscriber` instance

Definition at line 970 of file node.py.

◆ create_timer()

rosros.rclify.node.Node.create_timer (   self,
  timer_period_sec,
  callback,
  callback_group = None,
  clock = None 
)

Creates a new timer.

The timer will be started and every `timer_period_sec` number of seconds the provided callback function will be called.

Parameters
timer_period_secthe period (s) of the timer
callbacka user-defined callback function that is called when the timer expires
callback_groupignored (ROS2 API compatibility stand-in)
clockthe clock which the timer gets time from
Returns
`rospy.Timer` instance

Definition at line 1018 of file node.py.

◆ declare_parameter()

rosros.rclify.node.Node.declare_parameter (   self,
  name,
  value = None,
  descriptor = None,
  ignore_override = False 
)

Sets and initializes a node parameter.

This method, if successful, will result in any callback registered with `add_on_set_parameters_callback` to be called.

Parameters
namefully-qualified name of the parameter, including its namespace
valuevalue of the parameter to set, if any
descriptor`ParameterDescriptor` instance, if any
ignore_overridewhether to set value given here, ignoring any overrides
Returns
`Parameter` instance with the final assigned value
Exceptions
ParameterAlreadyDeclaredExceptionif the parameter has already been set
InvalidParameterExceptionif the parameter name is invalid
InvalidParameterValueExceptionif a registered callback rejects the parameter

Definition at line 244 of file node.py.

◆ declare_parameters()

rosros.rclify.node.Node.declare_parameters (   self,
  namespace,
  parameters,
  ignore_override = False 
)

Sets a list of parameters.

The tuples in the given parameter list shall contain the name for each parameter, optionally providing a value and a descriptor. For each entry in the list, a parameter with a name of "namespace.name" will be set. The resulting value for each set parameter will be returned, considering parameter overrides set upon node creation as the first choice, or provided parameter values as the second one.

The name expansion is naive, so if you set the namespace to be "foo.", then the resulting parameter names will be like "foo..name". However, if the namespace is an empty string, then no leading '.' will be placed before each name, which would have been the case when naively expanding "namespace.name". This allows you to declare several parameters at once without a namespace.

This method, if successful, will result in any callback registered with `add_on_set_parameters_callback` to be called once for each parameter. If one of those calls fail, an exception will be raised and the remaining parameters will not be declared. Parameters declared up to that point will not be undeclared.

Parameters
namespacenamespace for parameters (empty string for node root namespace)
parameterslist of tuples with parameters to set, as (name, ) or (name, value) or (name, value, descriptor)
ignore_overridewhether to set value given here, ignoring any overrides
Returns
`Parameter` list with the final assigned values
Exceptions
ParameterAlreadyDeclaredExceptionif a parameter has already been set
InvalidParameterExceptionif a parameter name is invalid.
InvalidParameterValueExceptionif a registered callback rejects any parameter
TypeErrorif any tuple in `parameters` does not match the annotated type

Definition at line 283 of file node.py.

◆ describe_parameter()

rosros.rclify.node.Node.describe_parameter (   self,
  name 
)

Get the parameter descriptor of a given parameter.

Parameters
namefully-qualified name of the parameter, including its namespace
Returns
`ParameterDescriptor` corresponding to the parameter, or default `ParameterDescriptor` if parameter is unknown and undeclared parameters are allowed
Exceptions
ParameterNotDeclaredExceptionif parameter is unknown and undeclared parameters are not allowed

Definition at line 842 of file node.py.

◆ describe_parameters()

rosros.rclify.node.Node.describe_parameters (   self,
  names 
)

Get the parameter descriptors of a given list of parameters.

Parameters
namelist of fully-qualified names of the parameters to describe
Returns
list of `ParameterDescriptor` corresponding to the given parameters. Default `ParameterDescriptor` shall be returned for parameters that had not been declared before if undeclared parameters are allowed.
Exceptions
ParameterNotDeclaredExceptionif any parameter is unknown and undeclared parameters are not allowed

Definition at line 861 of file node.py.

◆ destroy_client()

rosros.rclify.node.Node.destroy_client (   self,
  client 
)

Destroy a service client created by the node.

Returns
`True` if successful, `False` otherwise

Definition at line 1071 of file node.py.

◆ destroy_guard_condition()

rosros.rclify.node.Node.destroy_guard_condition (   self,
  guard 
)

Does nothing (ROS2 API compatibility stand-in).

Returns
``True``

Definition at line 1106 of file node.py.

◆ destroy_node()

rosros.rclify.node.Node.destroy_node (   self)

Destroys the node and shuts down rospy.

Frees resources used by the node, including any entities created by the following methods:

* `create_publisher` * `create_subscription` * `create_client` * `create_service` * `create_timer`

Definition at line 1129 of file node.py.

◆ destroy_publisher()

rosros.rclify.node.Node.destroy_publisher (   self,
  publisher 
)

Destroy a publisher created by the node.

Returns
`True` if successful, `False` otherwise

Definition at line 1047 of file node.py.

◆ destroy_rate()

rosros.rclify.node.Node.destroy_rate (   self,
  rate 
)

Does nothing (ROS2 API compatibility stand-in).

Returns
`True`

Definition at line 1114 of file node.py.

◆ destroy_service()

rosros.rclify.node.Node.destroy_service (   self,
  service 
)

Destroy a service server created by the node.

Returns
`True` if successful, `False` otherwise

Definition at line 1083 of file node.py.

◆ destroy_subscription()

rosros.rclify.node.Node.destroy_subscription (   self,
  subscription 
)

Destroy a subscription created by the node.

Returns
`True` if successful, `False` otherwise

Definition at line 1059 of file node.py.

◆ destroy_timer()

rosros.rclify.node.Node.destroy_timer (   self,
  timer 
)

Destroy a timer created by the node.

Returns
`True` if successful, `False` otherwise

Definition at line 1095 of file node.py.

◆ get_client_names_and_types_by_node()

rosros.rclify.node.Node.get_client_names_and_types_by_node (   self,
  node_name,
  node_namespace 
)

Returns an empty list (ROS2 API compatibility stand-in)

ROS1 does not provide service clients information.

Parameters
node_nameignored
node_namespaceignored
Returns
`[]`

Definition at line 1240 of file node.py.

◆ get_clock()

rosros.rclify.node.Node.get_clock (   self)

Returns `clock.Clock` using ROS time.

Definition at line 221 of file node.py.

◆ get_logger()

rosros.rclify.node.Node.get_logger (   self)

Get the node's logger.

Definition at line 225 of file node.py.

◆ get_name()

rosros.rclify.node.Node.get_name (   self)

Returns the name of the node, without namespace.

Definition at line 213 of file node.py.

◆ get_namespace()

rosros.rclify.node.Node.get_namespace (   self)

Returns the namespace of the node.

Definition at line 217 of file node.py.

◆ get_node_names()

rosros.rclify.node.Node.get_node_names (   self)

Get a list of names for discovered nodes.

Returns
list of node names without namespaces

Definition at line 1266 of file node.py.

◆ get_node_names_and_namespaces()

rosros.rclify.node.Node.get_node_names_and_namespaces (   self)

Get a list of names and namespaces for discovered nodes.

Returns
list of tuples containing two strings: the node name and node namespace

Definition at line 1274 of file node.py.

◆ get_node_names_and_namespaces_with_enclaves()

rosros.rclify.node.Node.get_node_names_and_namespaces_with_enclaves (   self)

Get a list of names, namespaces and enclaves for discovered nodes.

Returns
list of tuples containing three strings: the node name, node namespace and enclave (the latter always "/" in ROS1)

Definition at line 1283 of file node.py.

◆ get_parameter()

rosros.rclify.node.Node.get_parameter (   self,
  name 
)

Returns a parameter by name.

Parameters
namefully-qualified name of the parameter, including its namespace
Returns
`Parameter` for the given name. A default Parameter will be returned for an undeclared parameter if undeclared parameters are allowed.
Exceptions
ParameterNotDeclaredExceptionif undeclared parameters are not allowed, and the parameter is unknown

Definition at line 401 of file node.py.

◆ get_parameter_or()

rosros.rclify.node.Node.get_parameter_or (   self,
  name,
  alternative_value = None 
)

Returns a parameter or the alternative value.

If the alternative value is None, a default `Parameter` with the given name and `NOT_SET` type will be returned if the parameter was not declared.

Parameters
namefully-qualified name of the parameter, including its namespace
alternative_valuealternative parameter to return if unknown
Returns
requested `Parameter`, or `alternative_value` if unknown

Definition at line 418 of file node.py.

◆ get_parameters()

rosros.rclify.node.Node.get_parameters (   self,
  names 
)

Returns a list of parameters.

Parameters
namesfully-qualified names of the parameters to get, including namespaces
Returns
The values for the given parameter names. A default `Parameter` will be returned for undeclared parameters if undeclared parameters are allowed.
Exceptions
ParameterNotDeclaredExceptionif undeclared parameters are not allowed, and any given parameter is unknown

Definition at line 386 of file node.py.

◆ get_parameters_by_prefix()

rosros.rclify.node.Node.get_parameters_by_prefix (   self,
  prefix 
)

Get parameters that have a given prefix in their names as a dictionary.

The names which are used as keys in the returned dictionary have the prefix removed. For example, if you use the prefix "foo" and the parameters "foo.ping", "foo.pong" and "bar.baz" exist, then the returned dictionary will have the keys "ping" and "pong". Note that the parameter separator is also removed from the parameter name to create the keys.

An empty string for the prefix will match all parameters.

If no parameters with the prefix are found, an empty dictionary will be returned.

Parameters
prefixthe prefix of the parameters to get
Returns
list of `Parameter` under the given prefix, with prefix removed from names

Definition at line 438 of file node.py.

◆ get_publisher_names_and_types_by_node()

rosros.rclify.node.Node.get_publisher_names_and_types_by_node (   self,
  node_name,
  node_namespace,
  no_demangle = False 
)

Gets a list of discovered topics for publishers of a remote node.

Parameters
node_namename of a remote node to get publishers for
node_namespacenamespace of the remote node
no_demangleignored (ROS2 API compatibility stand-in)
Returns
list of tuples, the first element of each tuple is the topic name and the second element is a list of topic types
Exceptions
NodeNameNonExistentErrorif the node wasn't found
RuntimeErrorunexpected failure

Definition at line 1153 of file node.py.

◆ get_publishers_info_by_topic()

rosros.rclify.node.Node.get_publishers_info_by_topic (   self,
  topic_name,
  no_mangle = False 
)

Return a list of publishers on a given topic.

The returned parameter is a list of TopicEndpointInfo objects, where each will contain the node name, node namespace, topic type, topic endpoint's GID, and its QoS profile.

`topic_name` may be a relative, private, or fully qualified topic name. A relative or private topic will be expanded using this node's namespace and name. The queried `topic_name` is not remapped.

Parameters
topic_namethe topic_name on which to find the publishers
no_manglewhether topic name should be used as is, by default it will be namespaced under node and remapped
Returns
a list of `rosros.rclify.topic_endpoint_info.TopicEndpointInfo` for all the publishers on this topic

Definition at line 1356 of file node.py.

◆ get_service_names_and_types()

rosros.rclify.node.Node.get_service_names_and_types (   self)

Gets a list of available services.

Returns
list of tuples, the first element of each tuple is the service name and the second element is a list of service types

Definition at line 1258 of file node.py.

◆ get_service_names_and_types_by_node()

rosros.rclify.node.Node.get_service_names_and_types_by_node (   self,
  node_name,
  node_namespace 
)

Gets a list of discovered service server topics for a remote node.

Parameters
node_namename of a remote node to get services for
node_namespacenamespace of the remote node
Returns
list of tuples, the first element of each tuple is the service server name and the second element is a list of service types
Exceptions
NodeNameNonExistentErrorif the node wasn't found
RuntimeErrorunexpected failure

Definition at line 1215 of file node.py.

◆ get_subscriber_names_and_types_by_node()

rosros.rclify.node.Node.get_subscriber_names_and_types_by_node (   self,
  node_name,
  node_namespace,
  no_demangle = False 
)

Gets a list of discovered topics for subscriptions of a remote node.

Parameters
node_namename of a remote node to get subscriptions for
node_namespacenamespace of the remote node
no_demangleignored (ROS2 API compatibility stand-in)
Returns
list of tuples, the first element of each tuple is the topic name and the second element is a list of topic types
Exceptions
NodeNameNonExistentErrorif the node wasn't found
RuntimeErrorunexpected failure

Definition at line 1184 of file node.py.

◆ get_subscriptions_info_by_topic()

rosros.rclify.node.Node.get_subscriptions_info_by_topic (   self,
  topic_name,
  no_mangle = False 
)

Return a list of subscriptions on a given topic.

The returned parameter is a list of TopicEndpointInfo objects, where each will contain the node name, node namespace, topic type, topic endpoint's GID, and its QoS profile.

When the `no_mangle` parameter is `true`, the provided `topic_name` should be a valid topic name for the middleware (useful when combining ROS with native middleware (e.g. DDS) apps). When the `no_mangle` parameter is `false`, the provided `topic_name` should follow ROS topic name conventions.

`topic_name` may be a relative, private, or fully qualified topic name. A relative or private topic will be expanded using this node's namespace and name. The queried `topic_name` is not remapped.

Parameters
topic_namethe topic_name on which to find the subscriptions
no_manglewhether topic name should be used as is, by default it will be namespaced under node and remapped
Returns
a list of `rosros.rclify.topic_endpoint_info.TopicEndpointInfo` for all the subscriptions on this topic

Definition at line 1379 of file node.py.

◆ get_topic_names_and_types()

rosros.rclify.node.Node.get_topic_names_and_types (   self,
  no_demangle = False 
)

Gets a list of available topic names and types.

Parameters
no_demangleignored (ROS2 API compatibility stand-in)
Returns
list of tuples, the first element of each tuple is the topic name and the second element is a list of topic types

Definition at line 1249 of file node.py.

◆ has_parameter()

rosros.rclify.node.Node.has_parameter (   self,
  name 
)

Returns whether parameter exists.

Parameters
namefully-qualified name of the parameter, including its namespace

Definition at line 373 of file node.py.

◆ remove_on_set_parameters_callback()

rosros.rclify.node.Node.remove_on_set_parameters_callback (   self,
  callback 
)

Remove a callback from list of callbacks.

Parameters
callbackfunction registered with `add_on_set_parameters_callback()` or `set_parameters_callback()`
Exceptions
ValueErrorif the callback is unknown

Definition at line 655 of file node.py.

◆ remove_waitable()

rosros.rclify.node.Node.remove_waitable (   self,
  waitable 
)

Does nothing (ROS2 API compatibility stand-in).

Definition at line 935 of file node.py.

◆ set_descriptor()

rosros.rclify.node.Node.set_descriptor (   self,
  name,
  descriptor,
  alternative_value = None 
)

Set a new descriptor for a given parameter.

The name in the descriptor is ignored and set to given `name`.

Parameters
namefully-qualified name of the parameter to set the descriptor to
descriptornew `ParameterDescriptor` to apply to the parameter
alternative_value`ParameterValue` to set to the parameter if the existing value does not comply with the new descriptor
Returns
`ParameterValue` for the given parameter
Exceptions
ParameterNotDeclaredExceptionif the parameter is unknown and undeclared parameters are not allowed
ParameterImmutableExceptionif the parameter exists and is read-only
ParameterValueExceptionif neither the existing value nor the alternative value comply with the provided descriptor

Definition at line 883 of file node.py.

◆ set_parameters()

rosros.rclify.node.Node.set_parameters (   self,
  parameter_list 
)

Set parameters for the node, and return the result for the set action.

If any parameter in the list was not declared beforehand and undeclared parameters are not allowed for the node, this method will raise a ParameterNotDeclaredException exception.

Parameters are set in the order they are declared in the list. If setting a parameter fails due to not being declared, then the parameters which have already been set will stay set, and no attempt will be made to set the parameters which come after.

If undeclared parameters are allowed, then all the parameters will be implicitly declared before being set even if they were not declared beforehand. Parameter overrides are ignored by this method.

If a callback was registered previously with `add_on_set_parameters_callback`, it will be called prior to setting the parameters for the node, once for each parameter. If the callback prevents a parameter from being set, then it will be reflected in the returned result; no exceptions will be raised in this case.

If the value type of the parameter is NOT_SET, and the existing parameter type is something else, then the parameter will be implicitly undeclared.

Parameters
parameter_listlist of `Parameter` to set
Returns
list of `SetParametersResult`, one for each input
Exceptions
ParameterNotDeclaredExceptionif undeclared parameters are not allowed, and any given parameter is unknown

Definition at line 477 of file node.py.

◆ set_parameters_atomically()

rosros.rclify.node.Node.set_parameters_atomically (   self,
  parameter_list 
)

Set the given parameters, all at one time, and then aggregate result.

If any parameter in the list was not declared beforehand and undeclared parameters are not allowed for the node, this method will raise a `ParameterNotDeclaredException` exception.

Parameters are set all at once. If setting a parameter fails due to not being declared, then no parameter will be set. Either all of the parameters are set or none of them are set.

If undeclared parameters are allowed for the node, then all the parameters will be implicitly declared before being set even if they were not declared beforehand.

If a callback was registered previously with `add_on_set_parameters_callback`, it will be called prior to setting the parameters for the node only once for all parameters. If the callback prevents the parameters from being set, then it will be reflected in the returned result; no exceptions will be raised in this case.

If the value type of the parameter is `NOT_SET`, and the existing parameter type is something else, then the parameter will be implicitly undeclared.

Parameters
parameter_listlist of `Parameter` to set
Returns
a single `SetParametersResult` for all parameters
Exceptions
ParameterNotDeclaredExceptionif undeclared parameters are not allowed, and any named parameter is unknown

Definition at line 554 of file node.py.

◆ set_parameters_callback()

rosros.rclify.node.Node.set_parameters_callback (   self,
  callback 
)

Register a set parameters callback.

Calling this function will add a callback to the self._parameter_callbacks list.

Parameters
callbackfunction to call with `([`Parameter`])` when setting any node parameters, returning `SetParametersResult`

Definition at line 924 of file node.py.

◆ undeclare_parameter()

rosros.rclify.node.Node.undeclare_parameter (   self,
  name 
)

Unset a previously set parameter.

This method will not cause a callback registered with `add_on_set_parameters_callback` to be called.

Parameters
namefully-qualified name of the parameter, including its namespace

Definition at line 357 of file node.py.

Member Data Documentation

◆ _allow_undeclared_parameters

rosros.rclify.node.Node._allow_undeclared_parameters
protected

Definition at line 105 of file node.py.

◆ _clock

rosros.rclify.node.Node._clock
protected

Definition at line 123 of file node.py.

◆ _descriptors

rosros.rclify.node.Node._descriptors
protected

Definition at line 104 of file node.py.

◆ _parameter_overrides

rosros.rclify.node.Node._parameter_overrides
protected

Definition at line 103 of file node.py.

◆ _parameters

rosros.rclify.node.Node._parameters
protected

Definition at line 101 of file node.py.

◆ _parameters_callbacks

rosros.rclify.node.Node._parameters_callbacks
protected

Definition at line 102 of file node.py.

◆ PARAM_REL_TOL

int rosros.rclify.node.Node.PARAM_REL_TOL = 1e-6
static

Relative tolerance for floating-point parameter range steps.

Definition at line 66 of file node.py.

Property Documentation

◆ clients

rosros.rclify.node.Node.clients = property
static

Yields clients that have been created on this node.

Definition at line 141 of file node.py.

◆ context

rosros.rclify.node.Node.context = property
static

Returns None (ROS2 API compatibility stand-in).

Definition at line 189 of file node.py.

◆ default_callback_group

rosros.rclify.node.Node.default_callback_group = property
static

Returns None (ROS2 API compatibility stand-in).

Definition at line 196 of file node.py.

◆ executor

rosros.rclify.node.Node.executor = property
static

Returns None (ROS2 API compatibility stand-in).

Definition at line 176 of file node.py.

◆ guards

rosros.rclify.node.Node.guards = property
static

Yields (ROS2 API compatibility stand-in).

Definition at line 162 of file node.py.

◆ handle

rosros.rclify.node.Node.handle = property
static

Returns None (ROS2 API compatibility stand-in).

Definition at line 203 of file node.py.

◆ publishers

rosros.rclify.node.Node.publishers = property
static

Yields publishers that have been created on this node.

Definition at line 127 of file node.py.

◆ services

rosros.rclify.node.Node.services = property
static

Yields services that have been created on this node.

Definition at line 148 of file node.py.

◆ subscriptions

rosros.rclify.node.Node.subscriptions = property
static

Yields subscriptions that have been created on this node.

Definition at line 134 of file node.py.

◆ timers

rosros.rclify.node.Node.timers = property
static

Yields timers that have been created on this node.

Definition at line 155 of file node.py.

◆ waitables

rosros.rclify.node.Node.waitables = property
static

Yields (ROS2 API compatibility stand-in).

Definition at line 169 of file node.py.


The documentation for this class was generated from the following file: