Skip to content

Add example to record bagfile, launch variable number of nodes#269

Closed
adityapande-1995 wants to merge 2 commits intomasterfrom
aditya/add_examples_2
Closed

Add example to record bagfile, launch variable number of nodes#269
adityapande-1995 wants to merge 2 commits intomasterfrom
aditya/add_examples_2

Conversation

@adityapande-1995
Copy link
Copy Markdown
Contributor

This PR aims to add an example that shows how to launch a number of nodes defined by a command line parameter, record data to a bag file, and check if it was successful.

Main issue tracking launch_testing improvement plan : ros2/launch#531

Signed-off-by: Aditya Pande aditya050995@gmail.com

Signed-off-by: Aditya Pande <aditya050995@gmail.com>
Signed-off-by: Aditya Pande <aditya050995@gmail.com>
launch_test test/examples/check_multiple_node_launch_test.py number_of_nodes:=10
```

This test launches multiple nodes, specified by the ``number_of_nodes`` commandline parameter.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This test launches multiple nodes, specified by the ``number_of_nodes`` commandline parameter.
This test launches multiple nodes, specified by the ``number_of_nodes`` command line parameter.
Suggested change
This test launches multiple nodes, specified by the ``number_of_nodes`` commandline parameter.
This test launches multiple nodes, specified by the ``number_of_nodes`` commandline parameter.

```

This test launches multiple nodes, specified by the ``number_of_nodes`` commandline parameter.
It then records them to a ``rosbag2`` file, and checks if the nodes were launched correctly, and tha tht e bag file recorded some messages.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
It then records them to a ``rosbag2`` file, and checks if the nodes were launched correctly, and tha tht e bag file recorded some messages.
It then records them to a ``rosbag2`` file, and checks if the nodes were launched correctly, and that the bag file recorded some messages.
Suggested change
It then records them to a ``rosbag2`` file, and checks if the nodes were launched correctly, and tha tht e bag file recorded some messages.
It then records them to a ``rosbag2`` file, and checks if the nodes were launched correctly, and tha tht e bag file recorded some messages.


# Default number of nodes to be launched
n = 5
for item in sys.argv[::-1]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should use a launch argument instead of this

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of parsing argv, you can create a custom Action that uses a LaunchConfiguration substitution named number_of_nodes.

@adityapande-1995
Copy link
Copy Markdown
Contributor Author

Moved to ros2/examples#327

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants