Difference between revisions of "Advantech Robotic Suite/Container"

From ESS-WIKI
Jump to: navigation, search
(Created page with " = Introduction = <span style="font-size:larger;">  ROS applications may rely on specific ROS distribution, software versions, libraries, and configurations. Using conta...")
 
Line 2: Line 2:
 
= Introduction =
 
= Introduction =
  
<span style="font-size:larger;">&nbsp; ROS applications may rely on specific ROS distribution, software versions, libraries, and configurations. Using containers ensures consistent application behavior across different environments, as the container encapsulates the required dependencies and environment settings, independent of the host system.<br/> <br/> Here are several benefits of using containers to package&nbsp; ROS application.</span>
+
<span style="font-size:larger;">&nbsp; ROS applications may rely on specific ROS distribution, software versions, libraries, and configurations. Using containers ensures consistent application behavior across different environments, as the container encapsulates the required dependencies and environment settings, independent of the host system.<br/> Advantech ROS 2 Suite offers Docker container framework for simplifies the development, deployment, and management of ROS systems.</span>
 +
 
 +
<span style="font-size:larger;">The ROS2 Suite container framework provides the following benefits:</span><br/> &nbsp;
  
 
*<span style="font-size:larger;">Portability: Containers are portable units that can run on different systems and platforms, be it in development, testing, or production environments. This makes it easier to deploy and share ROS applications across different machines and environments.</span>  
 
*<span style="font-size:larger;">Portability: Containers are portable units that can run on different systems and platforms, be it in development, testing, or production environments. This makes it easier to deploy and share ROS applications across different machines and environments.</span>  
Line 13: Line 15:
  
 
&nbsp;
 
&nbsp;
 
<span style="font-size:larger;">Advantech ROS 2 Suite offers Docker container framework for simplifies the development, deployment, and management of ROS systems.</span>
 
  
 
<span style="font-size:1.3em;">'''List of ROS2 Suite Container:'''</span>
 
<span style="font-size:1.3em;">'''List of ROS2 Suite Container:'''</span>
Line 37: Line 37:
 
The ROS2 Suite offers a ROS container development framework that assists developers in building ROS containerized applications
 
The ROS2 Suite offers a ROS container development framework that assists developers in building ROS containerized applications
  
 +
&nbsp;
  
 
== How To ==
 
== How To ==
Line 55: Line 56:
 
=== Examples ===
 
=== Examples ===
  
Here are some example demonstrations on how to subscribe to and control services of other ROS2 nodes.  
+
Here are some example demonstrations on how to subscribe to and control services of other ROS2 nodes.
  
*'''[[ROS2_Suite/Sample_Node#c.2B.2B_sample|C++ sample]]'''
+
*'''[[ROS2_Suite/Sample_Node#c.2B.2B_sample|C++ sample]]'''  
 
*'''[[ROS2_Suite/Sample_Node#rclnodejs_sample|rclnodejs sample]]'''  
 
*'''[[ROS2_Suite/Sample_Node#rclnodejs_sample|rclnodejs sample]]'''  
 
*'''[[ROS2_Suite/Sample_Node#rclpy_sample|rclpy sample]]'''  
 
*'''[[ROS2_Suite/Sample_Node#rclpy_sample|rclpy sample]]'''  
Line 66: Line 67:
 
=== Stop docker container ===
 
=== Stop docker container ===
  
 +
&nbsp;
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
$ cd /usr/local/Advantech/ros/container/docker
 
$ cd /usr/local/Advantech/ros/container/docker

Revision as of 04:14, 2 June 2023

Introduction

  ROS applications may rely on specific ROS distribution, software versions, libraries, and configurations. Using containers ensures consistent application behavior across different environments, as the container encapsulates the required dependencies and environment settings, independent of the host system.
Advantech ROS 2 Suite offers Docker container framework for simplifies the development, deployment, and management of ROS systems.

The ROS2 Suite container framework provides the following benefits:
 

  • Portability: Containers are portable units that can run on different systems and platforms, be it in development, testing, or production environments. This makes it easier to deploy and share ROS applications across different machines and environments.
  • Isolation: Containers provide an isolated environment, separating ROS applications from the host system and other containers. This helps prevent conflicts and interference between different applications, enhancing system stability and reliability.
  • Reproducibility: Containers ensure that the runtime environment of an application remains consistent across different deployments and executions, ensuring reproducibility. This is valuable for developers, testers, and operators, as they can reproduce and debug issues in different environments.
  • Scalability: Container technology offers scalability, allowing for quick replication and scaling of container instances based on demand. This makes it easier to add new nodes, services, or topics to the ROS system and dynamically adjust the number of containers based on the workload.

 

List of ROS2 Suite Container:

Docker Container Content Note
edge-ros2-foxy Advantech add-ons services includes SUSI Node, Modbus-Master Node, OPCUAClient Node and
ROS2 bag database based on ROS2 Foxy. 
 
dev-ros2-foxy This container provides a pre-configured ROS2 Foxy environment along with examples
for subscribing to and controlling ros2 nodes in edge-ros2-foxy.
Only supported in ROS2 Suite v 1.3.0 on x86.

Develop Container

The ROS2 Suite offers a ROS container development framework that assists developers in building ROS containerized applications

 

How To

Start docker container

Step1: Launch the docker container of dev-ros2-foxy

$ cd /usr/local/Advantech/ros/container/docker
$ ./launch.sh dev-ros2-foxy

Step2: Accessing the container for development and debugging

$ docker exec -it dev-ros2-foxy bash

Examples

Here are some example demonstrations on how to subscribe to and control services of other ROS2 nodes.

Stop docker container

 

$ cd /usr/local/Advantech/ros/container/docker
$ ./stop.sh dev-ros2-foxy

 

Build Your Docker Container

To build a Docker container for your ROS2 application and integrate Advantech's add-ons services, you can following the steps.

Step1: Define a Dockerfile

Create a file called "Dockerfile" that specifies the instructions for building the container based on dev-ros2-foxy. This file includes details such as the base image, dependencies, environment variables, and commands to run inside the container.

FROM advigw/dev-ros2-foxy:1.0.0

# 1. Copy prerequisites of your application into the container
# WORKDIR /root
# COPY prerequisite/<your_application> /root/prerequisite

# 2. Install dependencies or libraries
# RUN apt-get update
# RUN apt-get install <some_dependency>

# 3. Execute your application automatically upon container startup.
# CMD [<application_command>]

Step2: Build the Docker image

Use the Docker command-line to build the Docker image based on the Dockerfile. This process involves pulling the necessary base image, executing the instructions in the Dockerfile, and creating a layered image with all the specified components.

$ docker build -t ros-example -f Dockerfile .

Step3: Define the Docker Compose services

Create a file called "docker-compose.yml", in the Docker Compose file, define the services, their image references, and any necessary configurations such as environment variables, port mappings, volume bindings, etc. Use the syntax provided by Docker Compose to define each service.

version: '2.0'

services:
  ros-example:
    image: ros-example
    container_name: ros-example
    restart: always
    networks:
     - adv-ros-network
    logging:
      options:
       max-size: 10M
    environment:
     - ROS_DOMAIN_ID=${ROS_DOMAIN_ID}

networks:
  adv-ros-network:
    name: adv-ros-network

Step4: Start the containers using Docker Compose

Execute the docker-compose up command in the directory where the Docker Compose file is located. This command will start the containers as defined in the Compose file.
Note: When using the docker-compose command, please avoid using 'sudo' if you need to use the ROS_DOMAIN_ID environment variable. Otherwise, the variable may not be found during execution.

$ docker-compose -f docker-compose.yml up -d

Step5: Test and validate

Open a new interactive bash shell within the container.

$ docker exec -it ros-example bash

Then test ROS2 Example and your applications in container.