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

JavaScript implementation of classic snake game

This article shares the specific code of JavaScri...

Textarea tag in HTML

<textarea></textarea> is used to crea...

WeChat applet implements form verification

WeChat applet form validation, for your reference...

How to Customize Bash Command Prompt in Linux

Preface As we all know, bash (the B ourne-A gain ...

Implementation of Nginx configuration of local image server

Table of contents 1. Introduction to Nginx 2. Ima...

Which loop is the fastest in JavaScript?

Knowing which for loop or iterator is right for o...

5 commonly used objects in JavaScript

Table of contents 1. JavaScript Objects 1).Array ...

How to install docker on centos

Here we only introduce the relatively simple inst...

Solution to the problem of session failure caused by nginx reverse proxy

A colleague asked for help: the login to the back...

Docker large-scale project containerization transformation

Virtualization and containerization are two inevi...

Gearman + MySQL to achieve persistence operation example

This article uses the gearman+mysql method to imp...

Vue event's $event parameter = event value case

template <el-table :data="dataList"&...

MySQL replication detailed explanation and simple example

MySQL replication detailed explanation and simple...