Skip to content

msroque/RealTimeAasx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Real Time AASX

About the Project

This project was made for the ICT Trends class to research the robot Ned 2. This project includes a Web UI Server, an OPC UA Server, and an OPC UA Client.

The Web UI server displays an AAS file, the OPC UA Client modifies the AAS file from an CSV file, and the OPC UA Server updates the AAS file.

The project was developed on Linux systems.

Getting Started

Prerequites

This project requires Docker Desktop, XQuartz, and Python 3.10.9.

  • Docker
  • XQuartz
  • Python

Docker Setup

  1. Clone the repository from GitHub.
git clone https://github.com/msroque/RealTimeAasx.git

After downloading Docker Desktop, create the following images and volume. Make sure XQuartz is open and running in the background if on MacOS.

  1. Create the shared volume in the Terminal.
docker volume create shared_aasx
  1. You can put your .aasx files in /aasx_files. Make a copy of your .aasx file and rename it Updated_Your_Robot.aasx Make sure to change the file names in OpcUaServer.py if you do this.
# Path inside container
aasx_path = "/aasx_files/original/Your_Robot.aasx"
updated_aasx_path = "/aasx_files/Updated_Your_Robot.aasx"
  1. Add the local files to the shared volume.
docker run --rm \
  -v shared_aasx:/tmp_data \
  -v /Users/your_username/file_path_to/RealTimeAasx/aasx_files:/tmp_local \
  busybox \
  sh -c 'mkdir -p /tmp_data/original && \
         cp /tmp_local/Niryo-RobotAsset.aasx /tmp_data/original/ && \
         cp /tmp_local/Updated-Niryo-RobotAsset.aasx /tmp_data/'

Note: You can check the contents of the volume with the following command

docker run --rm -it -v shared_aasx:/data busybox sh -c 'ls -la /data'
  1. Create and run the Web UI Server. This command will create the image and container, and run the server. You can view the Web UI at http://localhost:5001.
docker run --rm -it \
  --name web_ui_server \
  -p 5001:5001 \
  -v shared_aasx:/AasxServerBlazor/aasxs \
  adminshellio/aasx-server-blazor-for-demo:main \
  --external-blazor http://localhost:5001 \
  --load /AasxServerBlazor/aasxs/Updated_Your_Robot.aasx

OPC UA Server and Client Setup

  1. In a separate Terminal, navigate to where you saved the project. Build the OPC UA Server. If you are asked to allow access to other apps, allow so that the terminal can access Docker Desktop.
cd server
docker build -t opcua-server .
  1. Run the OPC UA Server.
docker run --rm -p 4840:4840 \
  --name opc_ua_server \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v shared_aasx:/aasx_files \
  opcua-server
  1. In a separate Terminal, if not already installed in your system, install the libraries for the client. Enter each line one at a time.
cd client
sudo apt install python3-pip -y
sudo apt install -y python3-venv
python3 -m venv .venv
source .venv/bin/activate
pip install opcua
pip install cryptography
pip install pandas
  1. run the OPC UA Client.
python3 OpcUaClient.py

Usage

  1. Open http://localhost:5001 on your browser to view the .aasx file. You will have to refresh the page when the server is reloaded.
  2. Have the Terminals for the server and client next to each other so that you can see the changes on both at the same time.
  3. Follow the prompts on the client terminal, and watch the changes happen on the servers.

Server and Client - Terminals at Start Up

Terminals at Startup

Server and Client - Terminals at Update

Terminals at Startup

Retrieving Updated AASX File

To end the Terminal intructions, press Ctrl + C. If you want to download the new updated .aasx file, you can download it from the shared volume on Docker Desktop, or you can run the following command to download to a local directory.

docker run --rm \
  -v shared_aasx:/tmp_data \
  -v /Users/your_username/file_path_to/aasx_files:/tmp_local \
  busybox \
  sh -c "cp /tmp_data/Updated_Your_Robot.aasx /tmp_local/Updated_Your_Robot.aasx"

Useful Docker Commands

If you run into problems, the following docker commands can help.

Docker Containers

To see the list of all docker containers:

docker ps -a

To check the mounts of a docker container:

docker inspect container_name | grep -A5 Mounts

To remove a docker container:

docker stop container_name
docker rm container_name

Docker Volumes

To see the list of all docker volumes:

docker volume ls

To see the details of a docker volume:

docker volume inspect volume_name

To remove a docker volume:

docker volume rm volume_name

About

A Real Time AASX server and client for researching the robot Ned 2.

Topics

Resources

Stars

Watchers

Forks