Skip to content
/ cmp3103-ws Public template
forked from LCAS/ros2_pkg_template

A base workspace template for cmp3103

License

Notifications You must be signed in to change notification settings

UoL-SoCS/cmp3103-ws

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ROS2 Workspace Template

This repository serves as a template for creating ROS2 packages, equipped with a basic CI workflow and devcontainer configuration.

Development Environment Setup

To begin development in a containerized environment:

  1. Use this repo as a template (You only do this once!): The best way to work with this repo is to use it as a template for your ROS package development, to do so, in the top right corner select Use this template and then Create new repository: image

    Alternatively, you may choose to "Fork" the repository (read here about the differences)

    Then, in the next step specify the owner and the repository name you want to create as shown below (You are recommended to make this a private repository until the marking of the assessment is complete):

    image

    You will end up having your own repository, which looks something like this:

    image
  2. Open in Visual Studio Code: Open your new repository in VSCode. The easiest way is to go to the git tab in VSCode and select Clone Repository and then copy the URL to the repository into the dialog that opens, e.g. https://github.com/marc-hanheide/my-cmp3103-ws in the example case. Then, choose the local folder you want to repository to be checked out into and choose to open the new workspace.

    image

    After cloning the repository and opening it, VSCode will prompt you if you want to "Reopen in Container", as it has found a devContainer configuration. You should say "yes". Alternatively if you don't see the prompt, you can use the command palette (Ctrl+Shift+P) and search for the "Reopen in Container" command.

    image
  3. Container Setup: Once reopened in the container, VSCode will initiate the building process and pull all necessary dependencies. You can monitor the building log within VSCode. This may take a while (in particular if you have not previouly used the computer with the container), as you entire image with all installations is being pulled.

    image
  4. Verify Container Environment: After the build completes, VSCode will connect to the container. You can verify that you are within the container environment.

    image

    See bottom left, saying "Dev Container": image

    You can now open the virtual desktop (see next section) or a terminal in VSCode inside the DevContainer:

    image

Devcontainer Features

The devcontainer includes a virtual 3D accelerated (if the host has an NVIDIA GPU and docker runtime installed) desktop.

  1. Accessing the Desktop Interface: Open the user interface by navigating to the PORTS tab in VSCode, selected the URL labeled desktop to open it in your browser. You can also right-click on the URL it and choose "Preview in Editor" to have that desktop shown directly in VSCode, instead.

    image
  2. Complete the connection: Click on "Connect".

    image

    Your desktop will open. If you want the size of this virtual desktop to adjust automatically to your browser window, choose "Remote Resizing" in the options on the left hand side.

    image

Enjoy Development!

By leveraging this setup, you can develop on a remote machine with a lightweight desktop interface. Magic! Furthermore, this template package provides very nice ROS2 functionality like syntax highlight and template code generation.

You can now use the VSCode terminal to launch all the commands you need and run code directly from VSCode in your devcontainer. Any windows you open from the terminal or from your code will appear in the virtual desktop (i.e. you Browser).

All ROS2 packages should go into the src/ folder. Create them with ros2 pkg create....

The devcontainer installs all dependencies of the workspace automatically as much as possible, and also tries to build the workspace when it is created, to speed up later colcon builds.

References

  1. cmp3103-ws
  2. Get Started with Dev Containers in VS Code

About

A base workspace template for cmp3103

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%