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.
This project requires Docker Desktop, XQuartz, and Python 3.10.9.
- Clone the repository from GitHub.
git clone https://github.com/msroque/RealTimeAasx.gitAfter downloading Docker Desktop, create the following images and volume. Make sure XQuartz is open and running in the background if on MacOS.
- Create the shared volume in the Terminal.
docker volume create shared_aasx- You can put your .aasx files in /aasx_files. Make a copy of your .aasx file and rename it
Updated_Your_Robot.aasxMake sure to change the file names inOpcUaServer.pyif you do this.
# Path inside container
aasx_path = "/aasx_files/original/Your_Robot.aasx"
updated_aasx_path = "/aasx_files/Updated_Your_Robot.aasx"- 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'- 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- 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 .- 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- 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- run the OPC UA Client.
python3 OpcUaClient.py- Open
http://localhost:5001on your browser to view the .aasx file. You will have to refresh the page when the server is reloaded. - 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.
- Follow the prompts on the client terminal, and watch the changes happen on the servers.
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"If you run into problems, the following docker commands can help.
To see the list of all docker containers:
docker ps -aTo check the mounts of a docker container:
docker inspect container_name | grep -A5 MountsTo remove a docker container:
docker stop container_name
docker rm container_nameTo see the list of all docker volumes:
docker volume lsTo see the details of a docker volume:
docker volume inspect volume_nameTo remove a docker volume:
docker volume rm volume_name
