This section provides intermediate examples such as GUI display access, security enclaves and hardware acceleration.
Please Use WeaveNet CNI Plugin
see Why we need to use WeaveNet
ROS provides many useful tools via GUI such as rqt, rviz and GUI application like turtlesim.
This example deploys ROS 2 turtlesim application container bound to the node which has display, and access the xserver from the container, application container can display the turtlesim on the display.
At the same time, it will bring up rqt to monitor the topic on the same node which has display.
To control the capability such as which node has display, it will use node labels to describe the capability and at the deployment we can select this label as application container requirements.
To run this example, at least one physical node must have display xserver running.
see deployment description ROS 2 turtlesim and rqt
- Disable xhost access control
tomoyafujita@~/DVT >xhost +local:root
non-network local connections being added to access control list-
Labeling the display capability.
In this example,
edgeserveris the server runs GUI capability, butedgedevice.
root@tomoyafujita-HP-Compaq-Elite-8300-SFF:~# kubectl label nodes tomoyafujita-hp-compaq-elite-8300-sff nodetype=edgeserver
root@tomoyafujita-HP-Compaq-Elite-8300-SFF:~# kubectl label nodes ubuntu nodetype=edgedevice
root@tomoyafujita-HP-Compaq-Elite-8300-SFF:~# kubectl get nodes --show-labels
NAME STATUS ROLES AGE VERSION LABELS
tomoyafujita-hp-compaq-elite-8300-sff Ready control-plane 63m v1.25.5 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=tomoyafujita-hp-compaq-elite-8300-sff,kubernetes.io/os=linux,node-role.kubernetes.io/control-plane=,node.kubernetes.io/exclude-from-external-load-balancers=,nodetype=edgeserver
ubuntu Ready <none> 45m v1.25.5 beta.kubernetes.io/arch=arm64,beta.kubernetes.io/os=linux,kubernetes.io/arch=arm64,kubernetes.io/hostname=ubuntu,kubernetes.io/os=linux,nodetype=edgedevice- Start turtlesim and rqt on
edgeserver, and start bash process node inedgedevice.
root@tomoyafujita-HP-Compaq-Elite-8300-SFF:/ros_k8s/yaml# kubectl apply -f ros2-turtlesim.yaml
deployment.apps/ros2-turtlesim-gui created
deployment.apps/rqt created
deployment.apps/ros2-teleop-key created-
Use
turtle_teleop_keyto control the turtlesim.process is already running in the cluster system on the host
edgedevicelabeled, so we can jump in the containerturtle_teleop_keyvia kubernetes command as below.
root@tomoyafujita-HP-Compaq-Elite-8300-SFF:/ros_k8s/yaml# kubectl get pods
NAME READY STATUS RESTARTS AGE
ros2-teleop-key-75f7c5475c-s6hwj 1/1 Running 0 33s
ros2-turtlesim-gui-849df7c66b-gzmt9 1/1 Running 0 33s
rqt-5886589dfc-v8q92 1/1 Running 0 33s
root@tomoyafujita-HP-Compaq-Elite-8300-SFF:/ros_k8s/yaml# kubectl exec --stdin --tty ros2-teleop-key-75f7c5475c-s6hwj -- /bin/bash
root@ros2-teleop-key-75f7c5475c-s6hwj:/# source /opt/ros/rolling/setup.bash
root@ros2-teleop-key-75f7c5475c-s6hwj:/# ros2 run turtlesim turtle_teleop_key
Reading from keyboard
---------------------------
Use arrow keys to move the turtle.
Use G|B|V|C|D|E|R|T keys to rotate to absolute orientations. 'F' to cancel a rotation.
'Q' to quit.
...
