5. Secondary Development Program Deployment
5. Secondary Development Program Deployment
There are generally two recommended deployment methods for secondary development programs: deployment on the onboard HDU and deployment on a third-party controller. Onboard HDU deployment is simpler in terms of hardware and is suitable when the secondary development program does not consume many resources. If more resources are needed, some existing programs on the HDU should be stopped to free up CPU/GPU resources. Third-party controller deployment requires additional data transmission methods, such as HTTP protocol. The advantage is that all original onboard software functions can be retained, while also having relatively sufficient computing resources.
5.1 Onboard HDU Deployment
The recommended program deployment directory is /agibot/data/home/agi/Desktop. The onboard disk cleanup module will periodically clean up space, but this folder is whitelisted and will not be cleaned.
mkdir -p /agibot/data/home/agi/Desktop
If you encounter permission issues, you can use the following commands to create the folder:
sudo mkdir -p /agibot/data/home/agi/Desktop
sudo chown -R agi:agi /agibot/data/home/agi
5.1.1 Python Virtual Environment
For secondary development in Python, simply create a virtual environment. You can use tools such as conda or venv (venv is built-in). For conda installation, refer to the miniconda official installation documentation.
5.1.2 Docker Deployment
If you use C++ or other compiled languages, or need to install or modify certain system dependencies, consider using Docker for deployment.
For Docker installation, refer to https://docs.docker.com/engine/install/ubuntu/#install-from-a-package. Do not use apt for program installation.
5.1.2.1 Change Docker Default Data Path
The default partition for Docker data (/var/lib/docker) is relatively small, so you need to change the default data storage path to a whitelisted path.
- Move the default storage pathbash
# Stop Docker service sudo systemctl stop docker # Move the default storage path (please create the target path /agibot/data/home/agi/Desktop first) sudo mv /var/lib/docker /agibot/data/home/agi/Desktop - Modify the configuration filebash
# Edit Docker configuration sudo vim /etc/docker/daemon.json
Add the following to the configuration file:json{ "data-root": "/agibot/data/home/agi/Desktop/docker" } - Restart Docker:bash
sudo systemctl start docker
Docker configuration is complete.
5.1.2.2 ROS2 Communication Setup Between Container and Host
By default, containers cannot communicate with the onboard system via ROS2. Some configuration is required.
- When creating the container, share IPC and network with the host by adding the following options:bash
--ipc=host --net=host - In the container, use the same agi user as on HDU, with both uid and gid set to 1001:bash
groupadd -g 1001 agi && useradd -u 1001 -g 1001 -m -s /bin/bash agi - Use the same DDS configuration file inside and outside the container. Copy /agibot/software/v0/entry/cfg/ros_dds_configuration.xml from HDU to the container. Before running ROS2 programs or using ros2 commands in the container, execute the following commands (replace /path/to with the actual path):bash
export ROS_DOMAIN_ID=232 export FASTRTPS_DEFAULT_PROFILES_FILE=/path/to/ros_dds_configuration.xml - At this point, you should be able to receive ROS2 topics published on HDU from within the container:bash
ros2 topic list