Skip to content

Small issue with argument in example code for TF Broadcaster #19

@ArneF-oss

Description

@ArneF-oss

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions