Example codes as a complement to rclc/examples
ROS2 Distro: Humble
docker image: tonghezhang/ros2_x86:humble_lint_0.1
To use subscription_with_loaned_msg, we need to add msg_loan in rclc/executor.c
This change is already on branch humble_add_msg_loan_in_sub_callback of my fork of ros2/rclc,
currently, you can use my repo rclc to test this feature
build rclc from source
git clone https://github.com/Zard-C/rclc.git
git checkout humble
colcon build --packages-select rclcbuild rclc_example from source
colcon build --packages-select rclc_exampleuse ros2's default middleware (fastrtps) zero copy feature
export FASTRTPS_DEFAULT_PROFILES_FILE=${PATH_TO_CONFIG}/fast_dds_profiles.xml
export RMW_FASTRTPS_USE_QOS_FROM_XML=1replace ${PATH_TO_CONFIG} with your own path (we have a demo in demo_config_file)
colcon build --packages-select rclc_examplesource /opt/ros2/humble/setup.bash
source ${rclc}/install/setup.bash
source ${rclc_example}/install/setup.bash
# for using fastrtps's zero copy, in your rclc_example workspace
export FASTRTPS_DEFAULT_PROFILES_FILE=${PATH_TO_CONFIG}/fast_dds_profiles.xml
export RMW_FASTRTPS_USE_QOS_FROM_XML=1
# run in one terminal
./build/rclc_example/pub_loaned_msg
# run in another terminal
./build/rclc_example/sub_loaned_msg
- timer_with_context
- publish_with_loaned_msg
- subscription_with_loaned_msg
- subscription_with_context