Detailed steps for installing ros2 in docker

Detailed steps for installing ros2 in docker

Main topic

Let's talk about today's topic docker and ros2. This article will solve three problems:

How to install docker on ubuntuHow to install ros2 in dockerHow to visualize the turtle in docker

1. Install Docker on Ubuntu

This is very simple, it can be done in one sentence

sudo apt install docker.io

Install Docker

2. Install ROS2-Foxy in Docker

Installation is not really a big deal. Here we directly pull the official image of ROS2

sudo docker pull osrf/ros:foxy-desktop

Pull the ROS2 image

After the pull is complete, use the following command to enter the installed image

sudo docker run -it osrf/ros:foxy-desktop

Then enter ros2 in the terminal

ROS2 in Docker
At this point, we have completed running the ros2 image in docker. Isn’t it very fast? It is also completely isolated from your computer. One line of instruction can generate multiple images, and even rosdep is init and updated.

3. ROS2 docker visual running turtle

Install and start the mobaxterm remote tool

mobaxterm interface

Make sure you are in the same LAN as the computer where you installed Docker.

DISPLAY

Note the display here. Then we set the value of the DISPLAY environment variable of the ros2 image in docker.

export DISPLAY=192.168.0.112:0.0

Then you can start the little turtle simulator and see

ros2 run turtlesim turtlesim_node

Then you will find a magical scene, a little turtle interface pops up on your Windows computer

Little turtle simulator

Then run the keyboard control node

ros2 run turtlesim turtle_teleop_key

Press the button and the little turtle will run.

insert image description here

at last

This is the end of this article about the detailed steps of installing ros2 with docker. For more information about installing ros2 with docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Docker installation of RocketMQ and solutions to problems encountered during installation
  • Docker-compose installation yml file configuration method
  • The most detailed method to install docker on CentOS 8
  • Detailed process of installing logstash in Docker
  • The process of installing Docker on Windows Server 2016 and the problems encountered
  • Quick installation of Docker step-by-step tutorial

<<:  【HTML element】Detailed explanation of tag text

>>:  Vue2 cube-ui time selector detailed explanation

Recommend

How to use the Marquee tag in XHTML code

In the forum, I saw netizen jeanjean20 mentioned h...

Build Tomcat9 cluster through Nginx and realize session sharing

Use Nginx to build Tomcat9 cluster and Redis to r...

Implementation steps for building a local web server on Centos8

1 Overview System centos8, use httpd to build a l...

JavaScript realizes the generation and verification of random codes

The generation and verification of random codes i...

JavaScript timer to achieve limited time flash sale function

This article shares the specific code of JavaScri...

How to use not in to optimize MySql

Recently, when using select query in a project, I...

How to limit the value range of object keys in TypeScript

When we use TypeScript, we want to use the type s...

Tutorial on installing MySQL 8.0.11 using RPM on Linux (CentOS7)

Table of contents 1. Installation preparation 1. ...

7 interview questions about JS this, how many can you answer correctly

Preface In JavaScript, this is the function calli...

JavaScript to achieve elastic navigation effect

This article shares the specific code for JavaScr...

DOM operation implementation in react

Table of contents Previous words Usage scenarios ...

Detailed explanation of Tomcat directory structure

Table of contents Directory Structure bin directo...

Use of Linux dynamic link library

Compared with ordinary programs, dynamic link lib...