Skip to content

sebastienlindqvist/TC-XAR-Linux-ROS2-PyADS-Docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

Beckhoff RT Linux with ROS2 and PyADS in Docker Containers

This repo is not officially Beckhoff. If you do need further help with TwinCAT, please contact your local Beckhoff Subsidiary/Representatives.

This is a fork of the example docker container from Beckhoff's repo.
This version now implements a ROS2 node to control a Dobot CR3, while using a PyADS node to poll TwinCAT XAR running locally to send certain commands.

Using Sample

Before you start with the sample, ensure that you have fullfill the follwoing requirements: - Setup and Install the Beckhoff Real-Time Linux® Distribution on a supported ePC/IPC - Configure the package server - Install TwinCAT - Install Docker Engine on Debian - Install make via sudo apt install make With the requirements set, simply follow these steps:

  1. Add/Update StaticRoutes.xml of TwinCAT on the Host machine: /etc/TwinCAT/3.1/Target

  2. Build the container image via :

sudo make build-image
  1. Start up the container:
sudo docker run -it --rm --network host --entrypoint /bin/bash tc31-xar-base
  1. Open second terminal and search for the container's ID:
sudo docker container -ls
  1. The run the following:
docker exec -u root  -t -i <container_id> /bin/bash
source install/setup.bash
ros2 launch dobot_bringup_v3 dobot_bringup_ros2.launch.py
  1. Open a third terminal and run:
docker exec -u root  -t -i <container_id> /bin/bash
source install/setup.bash
ros2 run py_srvcli client

Contents of the sample repo

The repository is organized as follows:

  • Dockerfile: the dockerfile that is used to create the image used in this example project
  • docker-compose.yaml: Sample to define the run configuration for the containers.
  • Makefile: Used to simplify and automate common Docker tasks.
  • StaticRoutes.xml: A sample of what the StaticRoutes file should look like within TwinCAT directory as you have to manually add a route for PyADS node to communicate with the TwinCAT XAR.
  • tc31-xar-base/: Contains all required files to build a Docker image for a TwinCAT 3.1 XAR environment
    • apt-config/
      • bhf.conf: Template for authentication against beckhoff.com package server
      • bhf.list: apt source list sample for Beckhoff package repo
      • debian.sources.list: apt source list for Beckhoff Debian mirror
  • py_srvcli/: Contains all required files to build a Docker image for ROS2 and PyADS.
    • setup.py: python programmed that is used to create the py_srvcli package and which python programs to be included
    • setup.cfg:
    • package.xml:
    • CMake.txt:
    • py_srvcli/:
      • TwinCAT_Add_Route.py: a python program containing functions for connecting to the TwinCAT Runtime
      • client_member_function.py: a python programmed that was created from ROS2 Humble example for services and clients
    • resource/:
      • com_comfig.yaml: file containing Username, password, and IP/AmsNetID addresses that are used to make a connection to the TwinCAT Runtime. This needs to be altered per sample to meet your local IP range and AmsNetIDs
      • variables.yaml: file containing variables and the path to find the associate variables in the TwinCAT Runtime and associate service in the ROS2 node

- Makefile Summary

The Makefile in this repository is used to simplify and automate common Docker tasks in this sample. It includes the following targets:

  • build-image: Builds the Docker image using the Dockerfile located in the tc31-xar-base directory.
  • push-image: Pushes the built Docker image to a specified Docker registry.
  • run-containers: Starts the containers defined in the docker-compose.yaml file.
  • list-containers: Lists the running containers managed by Docker Compose.
  • stop-and-remove-containers: Stops and removes all containers defined in the docker-compose.yaml file.
  • container-logs: Displays the logs of the running containers.

The Makefile uses variables to define the image name, tag, and registry, allowing for easy customization.

You can install make on your host via:

sudo apt install make

- Building the Docker Image

Afterwards you can use the Makefile for building the image.

sudo make build-image

Alternatively, navigate to tc31-xar-base of the repository and run the following command:

sudo docker build --network host -t tc31-xar-base .

About

This is a fork of the Beckhoff example container for running a TwinCAT XAR runtime using ADSoverMQTT. This version now implements a ROS2 node to control a Dobot CR3, while using a PyADS node to poll TwinCAT XAR running locally to send certain commands

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors