Creating Trigger Signal with RPi and publishing precise Timestsamp

asked 2022-10-21 12:11:49 -0500

I need to create a square wave (frequency about 80 Hz) in order to tigger a sensor and publish the corresponding timestamp precisely. I want to use an RPi 4 for this which I will synchronize using a GPS receiver.

I am unsure how to go about creating the pulses and saving the precise timestamp though. How precise would it be if I controlled a GPIO pin using a ros node and save the ROS timestamp direcrtly after? Since ROS is not runing on a real time system I am afraid there could be some delays between pulse generation and the time of the retrieved timestamp. I also thought about using rosserial with an Arduino and outsource the pulse generation to the Arduino with an interrupt service routine. However, then the time synchronisation between the Pi and the Arduino via rosserial could be problematic.

Do you have any suggestions?

Also: when I use the RPi within a network of ros machines (roscore not running on the Pi), will ROS mess with the GPS time synchronisation of the PI in order to sync the different ros machines?

Thank you in advance!

edit retag flag offensive close merge delete