1. Make sure you have install Cyclone DDS in the system, if not, use the following command to install:
sudo apt install ros-humble-rmw-cyclonedds-cpp
  1. Export environment variables in the ~/.bashrcfile:
export ROS_LOCALHOST_ONLY=1
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

Then source the file by source ~/.bashrcor close the terminal and open a new terminal again

  1. Enable multicast for local network interface lo, put the following script into the ~/.bashrcfile:
if [ ! -e /tmp/multicast_is_set ]; then
  sudo ip link set lo multicast on
  touch /tmp/multicast_is_set
fi

Then source the file by source ~/.bashrcor close the terminal and open a new terminal again. And check if it’s working by run command: ifconfig -a. If you see the following information, you are good to go:

Untitled

  1. To make ROS2 use Cyclone DDS as the middleware, you need to restart the system or run the following commands:
ros2 daemon stop 
ros2 daemon start