ROS 2 Application Deployment
This section provides instructions for deploying ROS 2 applications to the Renesas RZ/V2H RDK platform.
Prerequisites
Before starting deployment:
Complete the Cross compilation environment setup section.
Prepare the VS Code workspace configuration by following ROS 2 VS Code Workspace Configuration.
Make sure the required variables in
settings.jsonare configured correctly, especiallyTARGET_IP.Make sure all required packages are available in the current workspace on the host machine.
Install Dependencies into the Sysroot
Before building the application, make sure that all required dependencies are installed into the target sysroot.
Update the APT repository list in the target sysroot. This command ensures that the latest package information is available for installing dependencies.
rzv2h-chroot apt update
Prepare the necessary ROS 2 packages in the current workspace on the host machine, then run the following command to install the required dependencies into the sysroot:
sysroot-rosdep-install
Note
Note that target sysroot libraries must match the runtime environment of the target device. Otherwise, the application may fail to run on the target device due to missing or incompatible libraries.
For more information about how to avoid library version mismatches, see ABI mismatch issues in the FAQ.
Build the Application
Before deploying, ensure that your ROS 2 application is built using the cross-compilation environment.
There are three ways to build your application:
Use the command line:
cross-colcon-build
This command builds the ROS 2 workspace using the cross-compilation toolchain with the default build configuration (
Release).Use a VS Code task:
Press
Ctrl+Shift+Pto open the Command Palette.Run Tasks: Run Task.
Choose the appropriate build task:
ROS2: Build Release to build with the
ReleaseconfigurationROS2: Build Debug to build with the
Debugconfiguration
Use the default build task:
Press
Ctrl+Shift+B.This executes the default build task, which is configured to build with the
Releaseconfiguration.
Deploy to Target
There are two main methods to deploy your application to the RZ/V2H RDK platform:
Use a VS Code task:
Press
Ctrl+Shift+Pto open the Command Palette.Run Tasks: Run Task.
Choose ROS2: Deploy to Target to execute the deployment script.
Use the Task Buttons extension:
Click the Deploy button in the VS Code status bar to start the deployment process.
Install Dependencies on the Target
After deployment, install any additional dependencies on the target device.
Change to the workspace directory on the target device:
cd <path_to_your_ros2_ws>
Replace
<path_to_your_ros2_ws>with the actual path to your ROS 2 workspace on the RZ/V2H RDK.Set up the ROS 2 environment and install dependencies using
rosdep:source /opt/ros/jazzy/setup.bash rosdep install --from-paths ./install/*/share -y -r --ignore-src
Run the Application
You can start your application on the target device by using either ros2 run or ros2 launch through the VS Code tasks.
Note
Before running the application, make sure all required dependencies are installed on the target device. Otherwise, the application may fail to start.
Update the following variables in
settings.jsonto match the mode you want to use:For
ros2 run:NODE_PACKAGE_NAMENODE_EXECUTABLE_NAME
For
ros2 launch:LAUNCH_PACKAGE_NAMELAUNCH_FILE_NAME
Use one of the following methods to run the application:
Method 1: Use the Command Palette
Press
Ctrl+Shift+Pto open the Command Palette.Run Tasks: Run Task.
Choose the appropriate task:
ROS2: Run Package Executable to run using
ros2 runROS2: Launch Package LaunchFile to run using
ros2 launch
Method 2: Use the Task Buttons extension
Click Run ExecutableFile in the VS Code status bar to run using
ros2 run.Click Run LaunchFile in the VS Code status bar to run using
ros2 launch.
Enter any custom arguments if prompted.
For example, if your launch file requires a custom argument such as
video_device, enter it in the following format:video_device:=/dev/video0The application starts on the target device.