5.1.3 Source Code Installation
This section describes how to install TogetheROS.Bot from source code on both RDK and X86 platforms.
RDK Platform
Prerequisites:
- Your development machine can access the D-Robotics organization normally.
- Docker is already installed on your development machine.
Building tros.b
1 Using Docker Image
All operations in this section are performed on the development machine.
- Foxy
- Humble
## Create directory
cd /mnt/data/kairui.wang/test
mkdir -p cc_ws/tros_ws/src
## Download Docker image for cross-compilation
wget http://archive.d-robotics.cc/TogetheROS/cross_compile_docker/pc_tros_v1.0.5.tar.gz
## Load Docker image
sudo docker load --input pc_tros_v1.0.5.tar.gz
## Check the image ID corresponding to pc_tros
sudo docker images
## Start Docker container with mounted directories
sudo docker run -it --entrypoint="/bin/bash" -v LOCAL_PC_DIR:DOCKER_DIR IMAGE_ID
# Example: sudo docker run -it --entrypoint="/bin/bash" -v /mnt/data/kairui.wang/test:/mnt/test 9c2ca340973e
## Create directory
cd /mnt/data/kairui.wang/test
mkdir -p cc_ws/tros_ws/src
## Download Docker image for cross-compilation
wget http://archive.d-robotics.cc/TogetheROS/cross_compile_docker/pc_tros_ubuntu22.04_v1.0.0.tar.gz
## Load Docker image
sudo docker load --input pc_tros_ubuntu22.04_v1.0.0.tar.gz
## Check the image ID corresponding to pc_tros
sudo docker images
## Start Docker container with mounted directories
sudo docker run -it --entrypoint="/bin/bash" -v LOCAL_PC_DIR:DOCKER_DIR IMAGE_ID
# Example: sudo docker run -it --entrypoint="/bin/bash" -v /mnt/data/kairui.wang/test:/mnt/test 4cbdb9d61e19
2 Obtaining tros.b Source Code
All operations in this section are performed inside the Docker container on the development machine.
Here we use /mnt/test inside the Docker container as an example.
- Foxy
- Humble
cd /mnt/test/cc_ws/tros_ws
## Clone configuration files
git clone https://github.com/D-Robotics/robot_dev_config.git -b foxy
## Navigate into robot_dev_config and run 'git tag --list' to view available release versions
## Use 'git reset --hard [TAG]' to specify a particular release version. See the section "Building a Specific Version of tros.b" on this page for details.
## Pull source code
vcs-import src < ./robot_dev_config/ros2_release.repos
cd /mnt/test/cc_ws/tros_ws
## Clone configuration files
git clone https://github.com/D-Robotics/robot_dev_config.git -b develop
## Navigate into robot_dev_config and run 'git tag --list' to view available release versions
## Use 'git reset --hard [TAG]' to specify a particular release version. See the section "Building a Specific Version of tros.b" on this page for details.
## Pull source code
vcs-import src < ./robot_dev_config/ros2_release.repos
The overall project directory structure is as follows:
├── cc_ws
│ ├── sysroot_docker
│ │ ├── etc
│ │ ├── lib -> usr/lib
│ │ ├── opt
│ │ └── usr
│ └── tros_ws
│ ├── robot_dev_config
│ └── src
- The
tros_ws/robot_dev_configdirectory contains configuration files and scripts required for code fetching, building, and packaging. - The
tros_ws/srcdirectory stores the fetched source code. - The
sysroot_dockerdirectory contains headers and libraries required for cross-compilation, mirroring the root (/) directory of the RDK. For example, the media library resides atsysroot_docker/usr/lib/hbmedia/in the Docker environment, corresponding to/usr/lib/hbmedia/on the RDK.
During compilation, the build script robot_dev_config/aarch64_toolchainfile.cmake uses the CMAKE_SYSROOT macro to specify the path to sysroot_docker.
For the tag (version) of robot_dev_config, please refer to the Release Notes section.
3 Cross-compilation
All operations in this section are performed inside the Docker container on the development machine.
## Build tros.b for X3 using build.sh
bash ./robot_dev_config/build.sh -p X3
## Build tros.b for RDK Ultra using build.sh
bash ./robot_dev_config/build.sh -p Rdkultra
## Build tros.b for X5 using build.sh
bash ./robot_dev_config/build.sh -p X5
## Build tros.b for S100 using build.sh
bash ./robot_dev_config/build.sh -p S100
Upon successful compilation, you will see a message indicating that N packages have been built successfully.
If you perform a minimal build using minimal_build.sh, you can further reduce the deployment package size by running ./minimal_deploy.sh -d "install_path".
Installing tros.b
Copy the generated install directory to the RDK and rename it to tros. Here, we place the deployment package under /opt/tros to maintain consistency with the directory used in deb package installations.
Building a Specific Version of tros.b
By default, step 2 (Obtaining tros.b Source Code) in the Building tros.b section fetches the latest version of tros.b source code. If you need to obtain source code for a specific released version, modify this step as follows:
## Clone configuration files
git clone https://github.com/D-Robotics/robot_dev_config.git
cd robot_dev_config
## List available release versions
git tag --list
## Switch to a specific version; here we use tros.b 2.0.0 as an example
git reset --hard tros_2.0.0
cd ..
## Pull source code
vcs-import src < ./robot_dev_config/ros2_release.repos
For the tag (version) of robot_dev_config, please refer to the Release Notes section.
X86 Platform
System Requirements
You must use a 64-bit Ubuntu 20.04 system. Alternatively, you may use the RDK cross-compilation Docker image, but both compilation and execution must be performed entirely within the Docker container.