From f327ea72af54b9ea4656e0346796f945a489913e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20Klap=C3=A1lek?= Date: Mon, 22 Apr 2024 13:08:59 +0200 Subject: [PATCH 1/2] node: Add '**kwargs' in the initialization --- CHANGELOG.md | 5 +++++ autopsy/node.py | 4 ++-- autopsy/ros1_node.py | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eddae56..26e8c6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/). ## Unreleased +### Added +- `uninode`: + - `Node.__init__()` now allows to pass **kwargs that are forwarded to the base class initializer. + - ROS1: Node class support for `**kwargs`. + ## 0.10.6 - 2024-04-22 ### Changed - `unicode`: diff --git a/autopsy/node.py b/autopsy/node.py index f9c9a25..1912af6 100644 --- a/autopsy/node.py +++ b/autopsy/node.py @@ -109,13 +109,13 @@ def topic_callback(self, msg): class Node(NodeI): """Universal Node that supports both ROS1 and ROS2.""" - def __init__(self, name): + def __init__(self, name, **kwargs): """Initialize the class and ROS node. Arguments: name -- name of the ROS node """ - super(Node, self).__init__(name) + super(Node, self).__init__(name, **kwargs) # Workaround for Time.now() try: diff --git a/autopsy/ros1_node.py b/autopsy/ros1_node.py index 16cd697..347fe39 100644 --- a/autopsy/ros1_node.py +++ b/autopsy/ros1_node.py @@ -33,12 +33,12 @@ def __init__(self, name, **kwargs): Arguments: name -- name of the ROS node, str - **kwargs -- other, currently unsupported arguments + **kwargs -- other arguments passed to the rospy.init_node() Reference: https://docs.ros2.org/latest/api/rclpy/api/node.html#rclpy.node.Node """ - rospy.init_node(name = name) + rospy.init_node(name = name, **kwargs) # Part of workaround for Time.now() self.Time = Time From d21b9ceb199a62ea9b05499ae891c38de42a0847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20Klap=C3=A1lek?= Date: Mon, 22 Apr 2024 13:11:23 +0200 Subject: [PATCH 2/2] Release version 0.10.7 --- CHANGELOG.md | 1 + package.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26e8c6f..d6f32d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/). ## Unreleased +## 0.10.7 - 2024-04-22 ### Added - `uninode`: - `Node.__init__()` now allows to pass **kwargs that are forwarded to the base class initializer. diff --git a/package.xml b/package.xml index 613a562..bffe611 100644 --- a/package.xml +++ b/package.xml @@ -4,7 +4,7 @@ schematypens="http://www.w3.org/2001/XMLSchema"?> autopsy - 0.10.6 + 0.10.7 A set of Python utils for F1Tenth project. Jaroslav Klapálek