ros_sugar.core.node
#
Module Contents#
Classes#
BaseNode. |
API#
- class ros_sugar.core.node.BaseNode(node_name: str, node_config: Optional[ros_sugar.config.BaseConfig] = None, callback_group=None, start_on_init: bool = True, *args, **kwargs)#
Bases:
rclpy.node.Node
BaseNode.
- rclpy_init_node(*args, **kwargs)#
To init the node with rclpy and activate default services
- configure(config_file: str)#
Configure component from yaml file
- Parameters:
config_file (str) – Path to file
- add_execute_once(method: Callable)#
Add method to be executed once when the component is started
- Parameters:
method (Callable) – Callable to be executed
- add_execute_in_loop(method: Callable)#
Add method to be executed each loop_step in the component
- Parameters:
method (Callable) – Callable to be executed
- get_ros_time() builtin_interfaces.msg.Time #
Helper method to get ROS time from the node
- Returns:
ROS time now
- Return type:
Time
- get_secs_time() float #
Gets the current ROS time as float in seconds
- Parameters:
node (Node) – ROS node
- Returns:
ROS time as float
- Return type:
float
- property launch_cmd_args: List[str]#
List of command line arguments
- Returns:
ROS launch command line arguments
- Return type:
List[str]
- property config_json: Union[str, bytes]#
Component config as a json string
- Returns:
Config json
- Return type:
str
- activate()#
Create required subscriptions, publications, timers, … etc. to activate the node
- deactivate()#
Destroy all declared subscriptions, publications, timers, … etc. to deactivate the node
- setup_qos(qos_policy: ros_sugar.config.QoSConfig) rclpy.qos.QoSProfile #
Setup QoS profile from given QoSConfig
- Parameters:
qos_policy (QoSConfig) – QoS policy config parameters
- Returns:
QoS Profile to use in ros publishers/subscribers
- Return type:
rclpy.qos.QoSProfile
- init_flags()#
Set up node flags
- init_variables()#
Set up node variables
- create_tf_listener(tf_config: ros_sugar.tf.TFListenerConfig) ros_sugar.tf.TFListener #
Creates a new transform listener to lookup a transform with given config and return the transform lookup handler
- Parameters:
tf_config (TFListenerConfig) – Transform listener config
- Returns:
Transform lookup handler object
- Return type:
TransformListener
- create_client(*args, **kwargs) rclpy.client.Client #
Overwrites the Node create client method to add to the clients list
- Returns:
ROS service client
- Return type:
rclpy.client.Client
- create_all_subscribers()#
Creates all node subscribers
- create_all_publishers()#
Creates all node publishers
- create_all_services()#
Creates all node service servers
- create_all_service_clients()#
Creates all node service clients
- create_all_action_servers()#
Creates all node action servers
- create_all_action_clients()#
Creates all node action clients
- create_all_timers()#
Creates all node timers
- destroy_all_subscribers()#
Destroys all node subscribers
- destroy_all_publishers()#
Destroys all node publishers
- destroy_all_services()#
Destroys all node services
- destroy_all_action_servers()#
Destroys all action servers
- destroy_all_action_clients()#
Destroys all action clients
- destroy_all_service_clients()#
destroy_all_service_clients.
- destroy_all_timers()#
destroy_all_timers.