
FRUC Timesync Board
Forestry-Robotics-UC/rosbag_timesync_utils
This repository contains all content necessary regarding the data collection time synchronization solutions used by the FRUC team on the collection and processing of their datasets.

This repository contains all content necessary regarding the data collection time synchronization solutions used by the FRUC team on the collection and processing of their datasets.
Xsens USB Converter Replica is an open-source printed circuit board by Forestry-Robotics-UC, from the Forestry-Robotics-UC/rosbag_timesync_utils repository on GitHub. It is a 2-layer board of 38.2 × 16.5 mm with 36 parts on 33 nets, routed with 198 tracks and 79 vias.
It is built around the FT234XD-R. Its parts include 12 capacitors, 7 diodes, 2 ICs, 2 connectors and 2 inductors.
This repository contains all content necessary regarding the data collection time synchronization solutions used by the FRUC team on the collection and processing of their datasets. It includes both the PCB boards used during data collection, as well as the post processing script used for each bag captured to fix each message timestamp accordingly
The Designs/ folder contains production-ready files for the two auxiliary boards used during data collection. These files are compatible with majority of manufacturers, but were particularly designed to use with JLCPCB
Inside the root of each board's design folder is a .pdf schematic, a 3D .step file and the images present in this README. Furthermore, there are also two folders:
ProductionFiles/, which contains:
.zip archive.xlsx format (for PCB assembly only).csv format (for PCB assembly only)DesignFiles/ which contains the full KiCAD EDA software project files ready to open and edit. KiCAD is a free open-source PCB design software, which can be downloaded here. To open a design, simply open the .pro file. The KiCAD project should automatically detect the Libraries/ folder and use the respective design componentsSimple PCB board using a soldered Raspberry Pico in the center, used to generate a total of three individually customizable PWM signals, using a custom firmware also found in this repository. These signals are routed via GPIO pins 2, 6 and 10, to standard JST-SH 3-pin connectors, using pins 1 (left) and 3 for signal and GND respectively
The pre-compiled custom firmware present in this repository outputs the following PWM signals in each connector:

pico_pwm_generator.uf2 file from Scripts/PWM_Generator/ to the deviceFor ease of use, the .uf2 binary file is already provided in this repository ready to flash the board, but in case a compile from source is needed, please follow the Raspberry Pi C/C++ SDK repository README and documentation, using the provided CMake files also found in the same folder as the compiled binary
Replica of a UART to USB converter board with exposed copper pads at the end where an Xsens MTi 600-series compatible cable can be soldered (CA-MP-12-OPEN). Contains a standard JST-SH 4-pin connector for full control over the SYNC lines

Only 10 out of the 12 exposed wires from the aforementioned cable are soldered to the custom board. The original cable pinout can be found here. The pad layout marked in the figure (pads 1 to 5 are in the front of the board, 6 to 10 are in the back) is as follows, using the same naming scheme from the cable pinout:
VIN (wire 5)SYNC_IN1 (wire 3)SYNC_IN2 (wire 4)SYNC_OUT (wire 11)GND (wires 10 and 12)RS232_CTS (wire 6)RS232_RxD (wire 7)RS232_RTS (wire 9)RS232_TxD (wire 8)GND (wires 10 and 12)The pinout order for the SYNC lines JST-SH connector can be seen in the image below

For accurate bag processing, the messages in the recorded bags needs to have both the header and record timestamp as close to the actual physical capture time as possible. This does not happen by default during capture, so all recorded bags need to be subject to a post processing to fix this
To do so, a Python/ROS2 script is used, located in Scripts/Bag_Processing/. As the script uses ROS2 packages and libraries, it needs to be run inside a ROS2 environment. A ready to use Dockerized version of both ROS2 Humble and Jazzy distros are present in Docker/ROS2, containing both a .Dockerfile to build each image, and a Compose .yml file to create and launch a container for each distro, create the folder bindings, etc.
If you do not have the Docker Engine installed, following the install guide here
Firstly, the image needs to be built using the provided Dockerfile. Change directory to inside the Dockerfile folder, and run the following command, replacing distro with either humble or jazzy:
docker build -f ros2_{distro}.Dockerfile -t ros2_{distro}_docker:latest .Once finished, create and launch the container using Docker Compose. Change directory back to the root ROS2 folder, and run the following command:
docker compose upOnce the container is up, to enter it, run the following command:
docker exec -it ros2_{distro}_docker bashROS2 does not natively come with some of the sensor packages used by the FRUC team. Luckily, all of these packages are already cloned and present in the src/ folder, which is mounted as a volume inside the container via the Compose file
As such, upon the first time inside the container, change directory into ros2_ws/, and run the following commands:
colcon build
source install/setup.bashOnce finished, all packages are installed and ready to be used by the post processing script
The script supports input arguments, which are used to receive the bag folder path to process. As such, to run the script, use the following command:
python3 bag_processor.py <relative_bag_path_file>The script will then read the bag folder, and process every single bagfile inside by numerical order, with support for bags split into multiple files. This file order is retained on the post-processed bag. The corrected bag will be found in a folder next to the original bag path, with the same name as the original and _Corrected appended at the end
Not all topics are subject to post processing, but for all the ones that are, the messages are published in a new topic with the same name as the original one but with /corrected at the end
Once a bag is processed, it needs to be manually re-indexed. To do so, run the following command inside the container:
ros2 bag reindex <relative_bag_path_file>This will generate a new metadata.yaml file, however, the relative file paths at the end of this file are out of order, so it is recommended for the user to manually re-order the entries in numerical order
NOTE: Depending on the distro used, the script may or not require topic ID to be used when creating the topic metadata. As such, when running the script in ROS2 Humble, make sure line 67 is commented, and uncommented in ROS2 Jazzy
Since each sensor uses a different ROS2 SDK/wrapper, these handle timestamps and headers differently. As such, the script requires a handling routine per each sensor, explained below:
Messages from this LiDAR sensor are simply the UDP packets received, which come at such a high frequency that the header epoch nanosecond timestamp is accurate enough to simply be re-used as the recording timestamp
Unlike the previous LiDAR, messages here are in point cloud format, converted by the sensor's own SDK. Since there is a small fluctuation between the actual physical difference between frame capture times and the header times available, timestamp correction here is performed based on an initial reference time
To do so, on the very first message, the internal counter timestamp (time since boot) and the header timestamp are linked in the script. For each subsequent message from this sensor, the delta between the internal counter timestamps is calculated, as this is the most accurate time source present. This delta is added to the reference header timestamp (in epoch format), and this resulting timestamp replaces both the message header, and the recording timestamp
The RealSense camera provides detailed metadata regarding each frame in a separate topic, useful to estimate the physical capture begin timestamp as close as close as possible
As such, metadata and frame messages are decoded in pairs, and a parameter from the metadata is used, called frame_timestamp, which is the moment where the first USB chunk was sent from the camera to the USB host. It is not the exact capture moment, but it is the closest timestamp available to such instance
The metadata from the depth camera provides even more detail that allows for an even more accurate capture instant calculation. Besides the frame_timestamp metadata parameter, there is also a parameter named actual_exposure, which is the total time in microseconds that the frame capture took
By subtracting this value to the frame_timestamp, and further subtracting 1ms (by visual inspection it was determined that this 1ms was around the delay between end of exposure and first USB chunk sent), we get a timestamp within half a milisecond from the actual physical exposure begin instance
This calculated value then replaces both the header and record timestamps
For this sensor, a reference time based timestamp correction is also performed, but it is done during bag recording, meaning that post processing consists only of replacing the record timestamp with the already accurate header timestamp
| Qty | Value | Footprint | References |
|---|---|---|---|
| 8 | 100nF | Capacitor_SMD:C_0402_1005Metric | C2, C3, C5, C6, C8, C9, C10, C11 |
| 7 | 82307050029 | Capacitor_SMD:C_0402_1005Metric | D1, D2, D3, D4, D5, D6, D7 |
| 2 | 1uF | Capacitor_SMD:C_0603_1608Metric | C7, C12 |
| 2 | GND | Proj_FP:SquarePad_1.5x2.0mm | TP5, TP10 |
| 1 | 100k | Resistor_SMD:R_0402_1005Metric | R1 |
| 1 | 10nF | Capacitor_SMD:C_0402_1005Metric | C1 |
| 1 | 4.7uF | Capacitor_SMD:C_0402_1005Metric | C4 |
| 1 | 742792651 | Capacitor_SMD:C_0603_1608Metric | L1 |
| 1 | 744231091 | Proj_FP:FILTER-SMD_4P-L2.0-W1.2-TL | L2 |
| 1 | FT234XD | Package_DFN_QFN:WDFN-12-1EP_3x3mm_P0.45mm_EP1.7x2.5mm | U1 |
| 1 | FT_CTS_MT_RTS | Proj_FP:SquarePad_1.5x2.0mm | TP8 |
| 1 | FT_RTS_MT_CTS | Proj_FP:SquarePad_1.5x2.0mm | TP9 |
| 1 | FT_RX_MT_TX | Proj_FP:SquarePad_1.5x2.0mm | TP6 |
| 1 | FT_TX_MT_RX | Proj_FP:SquarePad_1.5x2.0mm | TP7 |
| 1 | SYNC_CON | Connector_JST:JST_SH_BM04B-SRSS-TB_1x04-1MP_P1.00mm_Vertical | J2 |
| 1 | SYNC_IN1 | Proj_FP:SquarePad_1.5x2.0mm | TP2 |
| 1 | SYNC_IN2 | Proj_FP:SquarePad_1.5x2.0mm | TP3 |
| 1 | SYNC_OUT | Proj_FP:SquarePad_1.5x2.0mm | TP4 |
| 1 | TRS3122ERGER | Proj_FP:VQFN-24_L4.0-W4.0-P0.50-TL-EP2.4 | U3 |
| 1 | USB_A | Connector_USB:USB_A_Molex_48037-2200_Horizontal | J1 |
| 1 | VUSB | Proj_FP:SquarePad_1.5x2.0mm | TP1 |

Forestry-Robotics-UC/rosbag_timesync_utils
This repository contains all content necessary regarding the data collection time synchronization solutions used by the FRUC team on the collection and processing of their datasets.

antmicro/scalenode-cm4-baseboard
Baseboard for Raspberry Pi 4 Compute Module optimized for clustering






znuh/usb2serial-autovtg
USB to serial converter with automatic target voltage detection, buffered IOs, 1.8V to 5V support and backflow current protection

alvarop/ostur
This is a work in progress for a cheese cave controller system. The goal is to be able to control a mini fridge to get the right conditions for cheesemaking.
It measures 38.2 × 16.5 mm and has 2 copper layers, 1.6 mm thick.
36 parts, built around the FT234XD-R. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
From the Forestry-Robotics-UC/rosbag_timesync_utils repository on GitHub, at the commit this page was made from: the board is Designs/Xsens_USB_Converter_Replica/DesignFiles/Xsens_USB_Converter_Replica.kicad_pcb and its schematic Designs/FRUC_Timesync_Board/DesignFiles/FRUC_Timesync_Board.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Its repository states no licence, so its author keeps all rights: ask Forestry-Robotics-UC before reusing the design.