Skip to content

Commit

Permalink
node: Add '**kwargs' in the initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
jara001 committed Apr 22, 2024
1 parent b824655 commit f327ea7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Expand Down
4 changes: 2 additions & 2 deletions autopsy/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions autopsy/ros1_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f327ea7

Please sign in to comment.