Skip to content

Creating your Team's ROS 2 Package

You should use the same procedures as you did in the Simulation Labs to create a ROS 2 package for this assignment (described again below). You should create one package per team, so nominate one member of your team to do this bit.

You should do this from within your own local ROS installation (i.e. on your own computer), or a WSL-ROS2 terminal instance.

  1. Head to the src folder of your ROS 2 workspace in your terminal:

    cd ~/ros2_ws/src/
    
  2. Clone the ROS 2 Package Template from GitHub:

    git clone https://github.com/tom-howard/ros2_pkg_template.git
    
  3. Run the init_pkg.sh script as follows (pay attention to the further information below about the naming of your package):

    ./ros2_pkg_template/init_pkg.sh ele434_teamXX_2026
    

    Your package must be named as follows: ele434_teamXX_2026

    ... where XX should be replaced with your team number (see Blackboard if you are unsure what your team's number is).

    If your team number is less than 10: put a zero before it, so that the team number is always 2 digits long, e.g.:

    • ele434_team03_2026 for Team 3
    • ele434_team08_2026 for Team 8
    • ele434_team15_2026 for Team 15

    Important

    Your repository name should match the above format exactly:

    • The name should be 18 characters long in total.
    • All characters should be lower case (e.g. ele434, NOT ELE434)
  4. Next, navigate into the root of your new package:

    cd ./ele434_teamXX_2026/
    

    ...and create a new directory in there called launch:

    mkdir launch
    
  5. Inside here create an empty file called explore.launch.py:

    touch ./launch/explore.launch.py
    

    ... leave this empty for now. You'll need to populate this appropriately later (more details on the Task Brief).

  6. Open up your package's CMakeLists.txt file and add the following text just above the ament_package() line at the very bottom:

    ele434_teamXX_2026/CMakeLists.txt
    install(DIRECTORY
      launch
      DESTINATION share/${PROJECT_NAME}
    )
    
  7. You can now build this using Colcon by following the same three-step process that you have been following throughout the Simulation Lab Course:

    1. Step 1, navigate to the root of the ROS 2 workspace:

      cd ~/ros2_ws/
      
    2. Step 2, build your package with Colcon:

      colcon build --packages-select ele434_teamXX_2026 --symlink-install
      
    3. Step 3, re-source the .bashrc:

      source ~/.bashrc
      

    Don't forget

    You'll need to follow the above three-step colcon build process whenever you do things like:

    1. Add a new node to your package (don't forget to modify the CMakeLists.txt file too)
    2. Add or modify a launch file
    3. Add or modify a custom interface (like in Part 1)
    4. Copy your package onto a different computer

See Also