GithubHelp home page GithubHelp logo

edouardrolland / vscode_ros2_px4_workspace Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 1.0 2.63 MB

A template for generating a docker development environment suited for PX4, Gazebo and ROS2.

License: Apache License 2.0

Dockerfile 52.31% Python 33.52% Shell 14.17%
docker gazebo px4-autopilot ros2 vscode

vscode_ros2_px4_workspace's Introduction

ROS2 & PX4 VSCode Dev Envirnment

License Build Status Python Version

Welcome to our development environment template for ROS2, PX4, and Gazebo. This Docker-based setup enables seamless integration of ROS2, PX4, and Gazebo with VSCode, providing a robust environment for developing drone applications.

Table of Contents

Acknowledgment

This template extends the vscode_ros2_workspace template by incorporating the PX4-Autopilot library as well as simulations in Gazebo. For more information about the original template, please visit the author's website.

Features

  • ROS2 Integration
  • PX4 Integration and Micro XRCE-DDS Agent & Client Setup
  • Gazebo Simulation
  • VSCode Workflow

How to Use the Template

Prerequisites

Before using this template, make sure you have the following prerequisites installed on your system:

Getting Started

Step 1: Get the Template

Step 1

Step 2: Create Your Own Project Repository

Step 2

Step 3: Clone the Project to Your Computer

Step 3

Step 4: Open the Folder in VSCode

To interact with the container, you need to install the Docker extension in VSCode. Follow the steps below:

Step 4

Step 5: Build the Container

You can build the container for the first time by following the steps presented in the following picture.

Step 5

Please note that if you're on Windows, ensure that Docker Engine is running in the background. The initial build may take some time.

Test your container

To test your contrainer and also the Gazebo installation you can run the following commands in the terminal.

cd
cd PX4-Autopilot/
make px4_sitl gz_x500

This set of commands should open a Gazebo Tab display a drone as presented in the following figure. If the command is not displaying a tab, you should refer to the FAQ section of this readme to set up a X server.

Step 6

FAQ

WSL2

The gui doesn't show up

This is likely because the DISPLAY environment variable is not getting set properly.

  1. Find out what your DISPLAY variable should be

    In your WSL2 Ubuntu instance

    echo $DISPLAY
    
  2. Copy that value into the .devcontainer/devcontainer.json file

    	"containerEnv": {
            "DISPLAY": ":0",
       }

I want to use vGPU

If you want to access the vGPU through WSL2, you'll need to add additional components to the .devcontainer/devcontainer.json file in accordance to these directions

	"runArgs": [
		"--network=host",
		"--cap-add=SYS_PTRACE",
		"--security-opt=seccomp:unconfined",
		"--security-opt=apparmor:unconfined",
		"--volume=/tmp/.X11-unix:/tmp/.X11-unix",
		"--volume=/mnt/wslg:/mnt/wslg",
		"--volume=/usr/lib/wsl:/usr/lib/wsl",
		"--device=/dev/dxg",
      		"--gpus=all"
	],
	"containerEnv": {
		"DISPLAY": "${localEnv:DISPLAY}", // Needed for GUI try ":0" for windows
		"WAYLAND_DISPLAY": "${localEnv:WAYLAND_DISPLAY}",
		"XDG_RUNTIME_DIR": "${localEnv:XDG_RUNTIME_DIR}",
		"PULSE_SERVER": "${localEnv:PULSE_SERVER}",
		"LD_LIBRARY_PATH": "/usr/lib/wsl/lib",
		"LIBGL_ALWAYS_SOFTWARE": "1" // Needed for software rendering of opengl
	},

Repos are not showing up in VS Code source control

This is likely because vscode doesn't necessarily know about other repositories unless you've added them directly.

File->Add Folder To Workspace

Screenshot-26

Or you've added them as a git submodule.

Screenshot-27

To add all of the repos in your *.repos file, run the script

python3 .devcontainer/repos_to_submodules.py

or run the task titled add submodules from .repos

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.