Simple installation of all VS code extensions for C++/Python development
# Download Microsoft GPG key π
sudo wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo gpg --dearmor -o /usr/share/keyrings/microsoft-archive-keyring.gpg
# Add the Visual Studio Code repository π¦
echo "deb [arch=arm64 signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/vscode stable main" | sudo tee /etc/apt/sources.list.d/vscode.list
# Update package list π
sudo apt update
# Install Visual Studio Code βοΈ
sudo apt install code
# Download and install extensions π οΈ
git clone https://github.com/PiotrG1996/VSCode-extensions.git
cd VSCode-extensions/
chmod +x install-docker-and-vscode-extensions.sh
./install-docker-and-vscode-extensions.sh
This script installs several Visual Studio Code extensions to enhance your development environment. Here's a list of the installed extensions with brief descriptions:
-
Docker - ms-azuretools.vscode-docker
- Provides Docker integration, making it easier to manage containers.
-
CMake Tools - ms-vscode.cmake-tools
- Simplifies the CMake configuration process for C/C++ projects.
-
Python - ms-python.python
- Offers rich Python language support and debugging capabilities.
-
C/C++ Tools - ms-vscode.cpptools
- Provides C/C++ language support, IntelliSense, and debugging features.
-
ROS 2 - nonanonno.vscode-ros2
- Enhances the development of ROS 2 projects with support for ROS-specific features.
-
Markdown All in One - yzhang.markdown-all-in-one
- Streamlines Markdown editing with various features like preview, table of contents, and more.
-
YAML - redhat.vscode-yaml
- Offers YAML language support and validation.
Please ensure that Visual Studio Code is installed before running the script to enjoy the benefits of these extensions.
For installation instructions, please refer to the script itself.
These instructions will guide you through the process of adding an SSH key to your system and configuring it for use with your new internet connection.
Follow these steps to manage SSH keys and connect to remote servers securely using SSH.
If you don't already have an SSH key pair, generate one using the following command in your terminal:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
t rsa
- specifies the type of key to create (RSA in this case).b 4096
- specifies the key length (4096 bits recommended for increased security).C "your_email@example.com"
- Adds a comment to the key with your email address.
Start the SSH agent and add your SSH private key to the agent with the following commands:
eval $(ssh-agent)
ssh-add ~/.ssh/id_rsa
ssh-add -l
Use your SSH private key to establish a connection with the remote server by running the following command:
ssh -i ~/.ssh/id_rsa username@remote_server_ip
Replace username with your username on the remote server and remote_server_ip with the IP address or hostname of the remote server.
Copy your SSH public key to the remote server for authentication using the ssh-copy-id command:
ssh-copy-id username@remote_server_ip
Follow the prompts to enter your password and securely copy your public key to the appropriate location on the remote server.
After adding your SSH key to the remote server, you can connect to the remote host using SSH without entering a password:
ssh username@remote_server_ip
You should now be able to establish a secure SSH connection to the remote server without the need for a password, using your SSH key pair for authentication.
# Set ROS environment variables π
export ROS_DISTRO=neotic
export ROS_VERSION=1
export ROS_HOME="$HOME/ros"
export ROS_IP=127.0.0.1
export ROS_MASTER_URI=http://127.0.0.1:11311
export ROSPACKAGE_PATH=/opt/ros/noetic/share
export ROS_PYTHON_VERSION=3
export ROS_ROOT=/opt/ros/noetic/share/ros
In the context of ROS (Robot Operating System) development, the Command Palette in Visual Studio Code is a powerful tool that streamlines various actions and tasks. You can access the Command Palette by pressing Shift + Cmd + P
(on macOS) or Shift + Ctrl + P
(on Windows/Linux).
Execute ROS-specific commands such as launching nodes, inspecting topics, configuring launch files, and managing ROS packages.
Quickly install or manage Visual Studio Code extensions, including those tailored for ROS development (e.g., ROS language support, ROS-specific tools).
Modify editor settings and preferences to optimize your ROS development environment, such as adjusting syntax highlighting, indentation, and keybindings.
The Command Palette serves as a centralized hub for executing tasks efficiently and accessing essential functionalities within the ROS development context. Leverage these capabilities to enhance your productivity and streamline your workflow when working with ROS projects in Visual Studio Code.
To configure ROS debugging efficiently, follow these steps:
-
Create a Debug Configuration File in JSON Format:
- Ensure that your ROS package contains an
example.launch
file, which is required for debugging. - Navigate to the debug section of your Visual Studio Code (VS Code) environment.
- Ensure that your ROS package contains an
-
Select Your ROS Package:
- Choose your ROS package within the debug section of VS Code.
- This action will generate a JSON configuration file tailored to your ROS project.
-
Start Debugging:
- With the JSON configuration file in place, you can now set breakpoints and debug multiple nodes simultaneously within your ROS environment.
Simple docker startup project for ROS development
# Use a base image with Ubuntu 20.04 with the command:
# docker build -t ros_neotic.img .
FROM ros:noetic
# Set environment variables for ROS 1 Neotic
ENV ROS_DISTRO=neotic
ENV ROS_VERSION=1
ENV ROS_PYTHON_VERSION=3
RUN apt-get update && \
apt-get install -y --no-install-recommends \
gdb
ENTRYPOINT ["./ros_entrypoint.sh"]
CMD ["bash", "-c"]
# docker-compose up
# docker exec -it ros.img bash
version: '3'
services:
ros:
container_name: ros
privileged: true
restart: unless-stopped
image: ros:humble # Assuming this is a custom ROS image named "ros" with tag "humble"
environment:
- ROS_DISTRO=humble
- ROS_VERSION=2
- ROS_PYTHON_VERSION=3
- DEBUG=1
shm_size: '64mb'
build:
context: .
dockerfile: docker/main/Dockerfile
target: ros
ports:
- "8000:8000"
volumes:
- ./Workspace:/home/odroid/Workspace # Mount ROS workspace (if needed)
command: roscore # Example ROS command to run (replace with actual ROS command)
deploy:
resources:
reservations:
devices:
- driver: cpu # Correct driver specification
count: 1
- driver: gpu # Correctly specified as a separate device
count: 1 # Assuming you want 1 GPU device
+---------------------------------------------------+
| Start |
+---------------------------------------------------+
|
v
+---------------------------------------------------+
| Open Visual Studio Code |
+---------------------------------------------------+
|
v
+---------------------------------------------------+
| Install "Remote - SSH" Extension |
+---------------------------------------------------+
|
v
+---------------------------------------------------+
| Configure SSH Connection to Remote Machine |
+---------------------------------------------------+
|
v
+---------------------------------------------------+
| Connect to Remote Machine using SSH |
+---------------------------------------------------+
|
v
+---------------------------------------------------+
| Install "Remote - Containers" Extension |
+---------------------------------------------------+
|
v
+---------------------------------------------------+
| Attach to Running Docker Container |
+---------------------------------------------------+
|
v
+---------------------------------------------------+
| Develop Code inside Docker Container |
+---------------------------------------------------+
|
v
+---------------------------------------------------+
| Access Container Terminal and File System |
+---------------------------------------------------+
|
v
+---------------------------------------------------+
| Edit and Debug Code using VS Code |
+---------------------------------------------------+
|
v
+---------------------------------------------------+
| End |
+---------------------------------------------------+