VS Code & SSH Setup Guide
This guide will walk you through setting connecting to a Remote Virtual Machine (VM) via SSH (to the robot), and installing the essential extensions for ROS 2 and Python development.
1. Install the Remote - SSH Extension
VS Code does not support SSH out of the box; you need the official extension from Microsoft.
- Open VS Code.
- Click on the Extensions icon on the left-hand sidebar (the four squares) or press
Ctrl+Shift+X. - Search for "Remote - SSH".
- Click Install on the version published by Microsoft.
2. Connect to a remote machine
- In VS Code, press
F1orCtrl+Shift+Pto open the Command Palette. - Type
Remote-SSH: Connect to Host...and select it. - Select Add New SSH Host.
- Enter:
ssh username@remote_machine_ip - Select the SSH configuration file to update (usually the first option in the list).
- When prompted, click Connect in the bottom-right notification.
- Important: Once connected, the bottom-left corner should display
SSH: [IP_ADDRESS].
3. Recommended Extensions
Note: When working over SSH, you must install extensions on the Remote VM. In the Extensions view, look for the button that says "Install on SSH: [IP]".
ROS 2 & Robotics
- Robot Developer Extension for URDF/Xacro: Essential for visualizing and editing your TurtleBot 4 robot models.
- YAML (Red Hat): Provides syntax checking for ROS 2 launch files and parameter files.
Python & Quality Control
- Python (Microsoft): The base extension for all Python development.
- Pylance: High-performance "IntelliSense" (autocompletion and type checking).
- Ruff: The fastest linter and formatter available in 2026.
- Error Lens: Highlights errors and warnings directly in the line of code where they occur, so you don't have to check the "Problems" tab.
General Productivity
- GitLens: Helps you see who changed a line of code and provides a deep history of your repository.
- Peacock: Changes the color of your VS Code window border. This is very helpful when you have multiple SSH windows open (e.g., one for the VM, one for the TurtleBot).
- Path Intellisense: Autocompletes filenames when you are typing paths in your code.
4. Format on Save
To ensure your code always follows professional standards, enable Format on Save.
- Open Settings (
Ctrl + ,). - Search for "Format on Save" and check the box.
- Search for "Default Formatter" and set it to Ruff for Python files.
5. Powering OFF
To prevent data loss, always shut down the software before cutting hardware power.
- Shutdown the Pi/VM: In the VS Code terminal, run:
sudo shutdown now - Close Connection: Once the VM shuts down, VS Code will notify you that the connection was lost. You can then safely close the window.