.bag files. These scripts extract 3D position data and automatically detect motion onset times.
Pipeline Stages
Gantry processing consists of two scripts:- prep_5_gantry_extract.py - Extract trajectories from ROS bags
- prep_6_gantry_find_offsets.py - Automatically detect motion onsets
Step 1: Trajectory Extraction (prep_5_gantry_extract.py)
Purpose
Extracts gantry crane position data from ROS bag files and exports as CSV. The gantry published odometry messages on the/odom topic during recordings.
ROS Message Structure
The script reads messages from the/odom topic:
Timestamp Conversion
ROS timestamps are converted to microseconds:Time Zone Adjustment
The gantry system used a different time zone than the ARIS. A configurable offset corrects this:config.yaml
Configuration
config.yaml
Usage
rosbag, rospy).
Output Structure
| Column | Description |
|---|---|
timestamp_us | Adjusted timestamp in microseconds |
x | X position in meters |
y | Y position in meters |
z | Z position in meters |
Example Output
Step 2: Motion Onset Detection (prep_6_gantry_find_offsets.py)
Purpose
Automatically detects when the gantry crane starts moving in each trajectory. This is critical for:- Synchronizing with ARIS recordings
- Trimming data to relevant portions
- Identifying the active trajectory segment
Detection Algorithm
Motion onset is found by detecting the first change in X or Y position:Z-axis is not used for onset detection as it may change due to calibration before XY motion begins.
Configuration
No additional configuration needed - uses the samegantry_extract path from config.yaml.
Usage
Output
Creates a metadata file summarizing all trajectories:| Column | Description |
|---|---|
file | Trajectory CSV filename |
start_us | First timestamp in recording |
end_us | Last timestamp in recording |
onset_us | Timestamp when motion begins |
Example Output
Coordinate System
The gantry crane provides positions in a right-handed coordinate system:- X-axis: Horizontal motion (meters)
- Y-axis: Horizontal motion perpendicular to X (meters)
- Z-axis: Vertical motion (depth, meters)
- Origin: Fixed reference point on gantry structure
Transform to Sonar Frame
The export script (release_1_export.py) transforms gantry positions to the ARIS (AR3) reference frame using calibration matrices:
ar3.csv file in the exported dataset contains ARIS positions, not raw gantry positions.
Synchronization with ARIS
Gantry data is synchronized to ARIS frames during export:- ARIS provides frame timestamps from its internal clock
- Gantry onset time is compared to ARIS motion onset
- Temporal offset is calculated (may be manually adjusted)
- For each ARIS frame, the closest gantry position is selected
Time Synchronization Details
Why Time Adjustment is Needed
The dataset has three independent time sources:- ARIS: Internal clock, microsecond timestamps
- Gantry (ROS): System time when ROS bag recorded
- GoPro: No reliable timestamps
gantry_time_adjust parameter corrects for:
- Different time zones during recording
- Clock drift between systems
- Recording setup delays
Determining the Correct Offset
The 2-hour offset was determined by:- Comparing ARIS and gantry motion onset times
- Adjusting until temporal alignment was achieved
- Verifying with known synchronization events
If you’re processing your own recordings, you’ll need to calculate the appropriate time adjustment for your setup.
ROS Environment Setup
Option 1: Ubuntu 20.04 Docker
Option 2: Robostack
Troubleshooting
ImportError: No module named 'rosbag'
ImportError: No module named 'rosbag'
You’re not in a ROS environment. Use Docker or robostack as described above.
No messages found on /odom topic
No messages found on /odom topic
Check your bag file:Look for
/odom topic. If missing, the bag may be from a different system or corrupted.Motion onset detection seems wrong
Motion onset detection seems wrong
Inspect the trajectory CSV manually:Verify that X and Y remain constant initially, then start changing. If the gantry was already moving when recording started, onset will be at index 0.
Time adjustment seems incorrect
Time adjustment seems incorrect
The 2-hour offset is specific to this dataset’s recording conditions. For your own data:
- Compare ARIS and gantry motion onset times
- Calculate the difference in hours
- Update
gantry_time_adjustin config.yaml
Data Quality Checks
After extraction, verify data quality:- Trajectory Continuity
- Position Bounds
- Motion Detection
Check for gaps in timestamps:
Integration with Export Pipeline
Gantry data is used during export to:- Provide gantry positions for each ARIS frame
- Calculate ARIS positions via transform chains
- Enable trajectory visualization in the dataset
- Support time synchronization across sensors
Next Steps
GoPro Processing
Complete sensor preprocessing with GoPro footage
Export
Assemble all data into the final dataset