Skip to content

FlightSimulationPolito/ros2-assgn-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

is designed to be the primary interface for your students. It is intentionally "verbose" to minimize common support requests regarding environment setup and cross-platform compatibility. SMV ROS2 Assignment Workspace

This repository provides a standardized development environment for the Flight Simulation course assignments at Politecnico di Torino. It uses Docker technology to ensure that all students have access to the same tools, libraries, and dependencies, regardless of their operating system. 📖 How it Works: The "Containerized Workspace" Concept

Instead of installing ROS2 and its dozens of complex dependencies directly on your computer (the "Host"), you will use a Docker Container. The Bind-Mount Mechanism

This repository uses a Bind Mount between your local folder and the container.

The Local Side: The ros2_ws folder on your computer.

The Container Side: The /home/student/ros2_ws folder inside the running environment.

What this means for you: Any code you write or modify in the src folder using your favorite editor on Windows, macOS, or Linux will instantly appear inside the container. Conversely, any build artifacts (the install folder) generated inside the container will persist on your physical hard drive even after you close Docker. 🛠 Prerequisites & Installation

Before cloning this repository, you must install the following tools based on your operating system.

  1. Essential Tools (All Platforms)

    Git: Install Git

    Docker Desktop: Install Docker Desktop (Windows and macOS) or Docker Engine (Linux).

     Note for Windows: Ensure you have WSL2 installed and configured as the Docker backend.
    
  2. Choose Your Interface

You can interact with this environment in two ways:

Option A (Recommended): VS Code + Remote Containers. This provides the most integrated experience (debugging, IntelliSense, ROS tools).

    Install Visual Studio Code.

    Install the Dev Containers extension (ms-vscode-remote.remote-containers).

Option B (CLI Only): Use your preferred IDE (Sublime, PyCharm, Vim) on the Host and use a standard terminal to run Docker commands.

💻 OS-Specific Setup (X11 / Graphics)

Since ROS2 often requires GUI tools, you need an X11 server to see windows from inside the container. Windows

Install VcXsrv.

Run XLaunch. Select:

    "Multiple windows" -> "Start no client".

    Crucial: Check "Disable access control".

The Docker Compose file is already configured to route the display to your host IP.

macOS (Intel & Apple Silicon)

Install XQuartz.

Open XQuartz Preferences -> Security -> Check "Allow connections from network clients".

Restart your Mac.

Run xhost +localhost in your terminal before starting the container.

Ubuntu Linux

No extra software is needed.

Before launching the container, run:
Bash

xhost +local:docker

🚀 Getting Started with the Assignment

  1. Clone the Repository Bash

git clone https://github.com/FlightSimulationPolito/smv-assignment-workspace.git cd smv-assignment-workspace

  1. Launch the Environment Using VS Code (DevContainer)

    Open the folder in VS Code.

    A notification will appear: "Folder contains a Dev Container configuration file. Reopen in Container?"

    Click Reopen in Container.

    VS Code will pull the image and set up the terminal. You are now "inside" the environment.

    If the notification does not appear, open the Command Palette (Ctrl+Shift+P in Windows or Cmd+Shift+P on macOS) and select (or type) "Dev Containers: Reopen in Container".

Using Standard Terminal (Docker Compose)

If you prefer not to use VS Code: Bash

docker compose up -d docker exec -it smv_ros2_dev bash

  1. Development Workflow: Build & Source

Once inside the container, you will find your workspace in ~/ros2_ws.

Create/Modify Packages: Place your ROS2 packages inside src/.

Build your code:
Bash

cd ~/ros2_ws
colcon build

Source the Environment: After a successful build, a new folder named install is generated. To make ROS2 aware of your new nodes, you must source the setup file:
Bash

source install/setup.bash

Note: You must run this command in every new terminal you open if you want to run your specific nodes.

📁 Persistence & Submission

Persistence: All changes made to ros2_ws/src are permanent. You can safely delete the container; your code will remain on your computer.

Submission: When your assignment is ready, you only need to submit the contents of the src folder (unless otherwise specified by the professor). The build, install, and log folders should not be submitted as they are machine-specific.

❓ Troubleshooting

Graphics not working: Ensure your X11 server (VcXsrv/XQuartz) is running and "Access Control" is disabled.

Permission Denied: If you encounter permission issues on Linux, the container automatically attempts to chown the workspace to the student user. If it fails, try running sudo chown -R student:student ~/ros2_ws inside the container.

Command not found: Ensure you have sourced the main ROS2 setup (source /opt/ros/jazzy/setup.bash) and your local setup (source install/setup.bash).

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors