Repository navigation
Achieve Time Synchronization between different computers
sudo apt update && sudo apt install chrony -y
Edit the configuration file on the NUC:
sudo nano /etc/chrony/chrony.conf
Ensure the following line is present (adjust the subnet to yours):
allow 192.168.1.0/24
It should also sync with public NTP servers (usually already present):
pool 2.ubuntu.pool.ntp.org iburst
Restart chrony on the NUC:
sudo systemctl restart chrony
Edit the configuration file on the Raspberry Pi:
sudo nano /etc/chrony/chrony.conf
Comment out or remove any existing pool lines, and add:
server <NUC_IP_ADDRESS> iburst
Restart chrony on the Pi:
sudo systemctl restart chrony
On the Pi, run:
chronyc tracking
Look for the Last offset value – the closer to zero (e.g., within microseconds), the better your clocks are aligned.
This guide walks you through the necessary steps to record ROS 2 topics from your Raspberry Pi on your Intel NUC, with time‑synchronized timestamps.
- Both machines must be on the same local subnet (e.g., both connected to the same router via Ethernet or Wi‑Fi).
- Find the IP address of each machine:
ip addr# or ifconfig
Verify connectivity from the NUC to the Pi:
ping <Raspberry_Pi_IP>
If you get replies, the network layer is working.
Both machines must use the same number (0–101).
On both the Pi and the NUC, run in every terminal before launching any ROS node:
echo "export ROS_DOMAIN_ID=42" >> ~/.bashrc
source ~/.bashrc
Verify the setting on both:
echo $ROS_DOMAIN_ID The output must be identical.
Important: Ensure ROS_LOCALHOST_ONLY is not set to 1. If it is, clear it with:
unset ROS_LOCALHOST_ONLY
ROS 2 uses UDP multicast for discovery. Temporarily disable the firewall for testing, or (preferred) allow UDP traffic from your local subnet:
sudo ufw allow in proto udp from 192.168.1.0/24 (Replace 192.168.1.0/24 with your actual subnet.)
Use the built‑in demo nodes to confirm that the two machines can talk.
On the Raspberry Pi (publisher):
source /opt/ros/<your-ros2-distro>/setup.bash
export ROS_DOMAIN_ID=42
ros2 run demo_nodes_cpp talker
On the NUC (subscriber):
source /opt/ros/<your-ros2-distro>/setup.bash
export ROS_DOMAIN_ID=42
ros2 run demo_nodes_cpp listener
If the NUC receives Hello World messages, the communication is successful.
Now you can record the topics published by the Pi directly on the NUC.
- List available topics (from the Pi):
ros2 topic list
- Record specific topics, e.g. /scan and /camera/image:
ros2 bag record /scan /camera/image
- Record all topics:
ros2 bag record -a