ros_pospac_bridge is a ROS2 package designed to bridge GPS and IMU data streams into a variety of ROS topics for navigation, localization, and mapping applications. The package reads data from a GPS file, transforms coordinates, and publishes the information in various formats suitable for different ROS-based applications.
- Overview
- Installation
- Usage
- Nodes
- Coordinate Systems
- Configuration in Detail
- Dependencies
- Building and Running Tests
- Troubleshooting
- Contributing
- License
The ros_pospac_bridge package provides a seamless way to ingest GPS and IMU data and publish it in formats compatible with common ROS messages, such as sensor_msgs/NavSatFix, sensor_msgs/Imu, and various pose messages for localization tasks. It includes built-in calibration parameters for integrating LIDAR, GNSS, and other sensor data.
Key features:
- Reading GPS data from custom files.
- Publishing GPS, IMU, and pose data in ROS topics.
- Managing transformations between various frames, including base_link, map, and sensor frames.
- Simple integration into any ROS2 environment.
To install and build the package, follow the steps below:
-
Clone the repository:
git clone https://github.com/cavadibrahimli1/gps_publisher_ros2humble
-
Install dependencies: Ensure that all required dependencies are installed by running the following command:
rosdep install --from-paths src --ignore-src -r -y
-
Build the workspace: Once the repository is cloned, navigate to your ROS workspace and build the package:
cd ~/ros2_ws colcon build
-
Source the environment: After building, you need to source the environment to use the package:
source install/setup.bash
To simplify the usage, the package comes with a pre-configured launch file that handles node startup and parameter loading. To launch the node:
ros2 launch ros_pospac_bridge ros_pospac_bridge.launch.xmlsource autoware/install/setup.bash
ros2 launch autoware_launch logging_simulator.launch.xml map_path:=/home/javadibrahimli/autoware_map/test_route2 vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kitThis will start the node using the parameters defined in the ros_pospac_bridge.config.yaml file, located in the config folder.
The configuration file, ros_pospac_bridge.config.yaml, defines all the important parameters for the node, including the input file paths, calibration parameters, and enabled publishers.
To customize the configuration, open the file and adjust the parameters as needed:
nano config/ros_pospac_bridge.config.yamlFor example, if you need to change the GPS data file path, modify the gps_data_file entry:
gps_data_file: "/path/to/your/gps_data.txt"After configuring the node and parameters, you can run the node using the command above, or manually as follows:
ros2 run ros_pospac_bridge ros_pospac_bridgeThis will execute the node with the settings provided in the configuration file.
The core of this package is the ros_pospac_bridge node, which handles reading GPS data from the specified file, applying transformations, and publishing the processed data to the relevant ROS topics.
/ros_pospac_bridge/gps_fix(sensor_msgs/NavSatFix): Publishes GPS data in theNavSatFixformat, including latitude, longitude, and altitude./ros_pospac_bridge/imu_data(sensor_msgs/Imu): IMU data including orientation, angular velocity, and linear acceleration./ros_pospac_bridge/pose_with_covariance(geometry_msgs/PoseWithCovarianceStamped): Estimated pose with covariance data for better localization accuracy./ros_pospac_bridge/pose_array(geometry_msgs/PoseArray): A set of poses used for multi-pose tracking./ros_pospac_bridge/pose_stamped(geometry_msgs/PoseStamped): A single pose with timestamp./ros_pospac_bridge/twist_with_covariance(geometry_msgs/TwistWithCovarianceStamped): Velocity estimation with covariance.tf(TF2 Transform): Publishes static and dynamic transformations between frames likemaptobase_link.
The node uses the MGRS coordinate system to define the origin. You can specify the MGRS origin and altitude in the configuration file:
mgrs_origin: "35TPF6645943620" # Replace with your MGRS origin
origin_altitude: 42.743 # Origin altitude in metersThis ensures accurate transformation between GPS coordinates and ROS frame data.
The ros_pospac_bridge node allows you to enable or disable specific publishers for various topics. This can be configured in the YAML file under the publishers section:
publishers:
nav_sat_fix:
enable: true
topic: "/ros_pospac_bridge/gps_fix"
imu:
enable: true
topic: "/ros_pospac_bridge/imu_data"
pose_with_covariance_stamped:
enable: true
topic: "/ros_pospac_bridge/pose_with_covariance"
pose_array:
enable: true
topic: "/ros_pospac_bridge/pose_array"
tf:
enable: trueBy setting enable: false for any publisher, you can disable that specific topic.
The ros_pospac_bridge supports calibration between different sensors (e.g., LIDAR and GNSS). Calibration parameters are specified in the calibration section:
calibration:
lidar_to_gnss:
x: 0.0
y: 0.0
z: -0.08
roll: 0.007237
pitch: -0.0072323
yaw: 3.1334945
base_link_to_lidar:
x: 0.96
y: -0.01
z: 1.1
roll: 0.0
pitch: 0.0
yaw: -3.0965926Adjust these parameters to reflect your sensor setup for accurate data integration.
For more advanced users, additional parameters like update frequency, filtering options, and dynamic transformations can be added to the configuration file.
The following ROS2 and third-party packages are required for ros_pospac_bridge:
rclcpp: Core ROS2 client library.sensor_msgs: For IMU and GPS message types.geometry_msgs: For pose and twist message types.tf2andtf2_geometry_msgs: For transformations between coordinate frames.GeographicLib: Used for geographic calculations like transformations between GPS and MGRS.
Ensure all dependencies are installed:
rosdep install --from-paths src --ignore-src -r -yThis package includes unit tests for validating GPS and IMU data parsing, transformations, and message publishing. To build and run the tests:
-
Build with testing enabled:
colcon build --cmake-args -DBUILD_TESTING=ON
-
Run the tests:
colcon test
Test results will be reported in the terminal.
- Node not publishing topics: Ensure that the publishers are enabled in the configuration file and that the correct topics are being subscribed to in your ROS environment.
- Coordinate transformations inaccurate: Check the calibration parameters and MGRS origin. Improper calibration values can lead to erroneous transformations.
- Dependency errors: If any dependencies are missing, use
rosdep installto automatically resolve and install them.
We welcome contributions from the community! To contribute:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Submit a pull request with a detailed description of the changes.
Please ensure your code passes the tests before submitting.

