Simple Shell Script to Help Create ROS2 Package

RoboFoundry
1 min readJul 18, 2021

I have been working with ROS2 foxy projects a lot and sometimes I do take pauses before I have to go back to working on the robotics projects again. When I get back and try to create a new project, I find myself trying to figure out what was the structure of the ROS project where was the launch folder, was it under package or under root etc.

So I finally sat down and created a shell script to build the ROS2 workspace, package and node with interactive prompts. I put the code on github so feel free to use it and improve on it.

Here is the link to github repo — https://github.com/robofoundry/ros2-pkg-gen-helper

Here is how it works:

The instructions for how to use it are in github Readme file.

It is not as sophisticated as a nodeJS or Rails or Angular package generator and its just a start. I first started writing the script in Python but soon realized that some of the operations like sourcing the ROS2 environment cannot be done that easily without jumping through the hoops as you cannot modify the environment that you are running on in the shell, so ultimately settled on using shell script. I’m not an expert in writing shell scripts so please keep that in mind.

It would be nice to add support for adding new node or package to existing workspace but it will need more work before getting there.

Enjoy and hope this is useful.

--

--