ros-industrial/ros2_i_training

Small issue with argument in example code for TF Broadcaster

ArneF-oss opened this issue · 0 comments

At ros2_i_training/workshop/source/_source/navigation/ROS2-TF2.md

At the chapter 1. Dynamic TF Broadcaster example

...
def main(argv=sys.argv[1]):
    rclpy.init(args=argv)
    node = DynamicBroadcaster(sys.argv[1])
...

gives me an error:
TypeError: init(): incompatible constructor arguments. The following argument types are supported:
1. rclpy._rclpy_pybind11.Context(arg0: list, arg1: int)
due to the second line: rclpy.init(args=argv)

So I deleted the [1] (first line) at def main and the sys. ( third line) at the node definition

...
def main(argv=sys.argv):
    rclpy.init(args=argv)
    node = DynamicBroadcaster(argv[1])
...

and it works fine for me. But I'm not sure if it is as intended. So maybe someone could double check it.

Thanks