Welcome to the Naima Project! This is a powerful, modular framework for ROS 2, designed to integrate the ZED 2 stereo camera , UBLOX GPS , and advanced navigation tools . Itβs perfect for developers and researchers working on autonomous robotic systems, offering seamless sensor fusion, localization, and navigation with modern ROS 2 tools for high-performance, real-time applications.
- β¨ Features
- π οΈ Prerequisites
- π¦ Installation
- βοΈ Configuration
- π Localization
- π Usage
- π‘οΈ Troubleshooting
- π€ Contributing
- π· ZED 2 Camera Integration: Stereo vision, depth sensing, and point cloud generation.
- π°οΈ GNSS Fusion: Combines UBLOX GPS data with ZED camera pose for precise localization.
- πΊοΈ ROS 2 Navigation Stack: Includes Nav2 and SLAM Toolbox for robust mapping and navigation.
- β‘ Cyclone DDS Support: Optimized for low-latency, high-performance communication.
- π Kinematic Bicycle Model: Ensures precise robot motion control.
- π§© Modular Launch Files: Easily customizable for various camera models and setups.
- π» Operating System: Ubuntu 22.04 (Jammy) with ROS 2 Humble installed.
- π₯οΈ Hardware:
- NVIDIA GPU with CUDA support for ZED SDK.
- ZED 2 or ZED 2i stereo camera.
- UBLOX GPS module.
- π₯ Software:
- ZED SDK (v4.0 or later recommended).
- CUDA Toolkit (compatible with your GPU).
- ROS 2 Humble: Follow the official installation guide.
- Install the ZED SDK following the official guide. π₯
- Ensure CUDA is installed. The ZED SDK installer will automatically download and install CUDA if not detected.
- Verify CUDA installation:
nvcc --version
- Verify CUDA installation:
- Restart your system to update paths: π
sudo reboot
- Create a workspace and clone the UBLOX GPS driver:
mkdir -p ~/ublox_ws/src cd ~/ublox_ws/src git clone https://github.com/men3m-4/naima_ublox_gps.git cd .. colcon build source install/setup.bash
- Launch the driver: π
ros2 launch ublox_gps ublox_gps_node_1-launch.py
- Clone and build the ZED ROS 2 wrapper in your ROS 2 workspace:
mkdir -p ~/ros2_ws/src cd ~/ros2_ws/src git clone https://github.com/stereolabs/zed-ros2-wrapper.git cd .. sudo apt update rosdep update rosdep install --from-paths src --ignore-src -r -y colcon build --symlink-install --cmake-args=-DCMAKE_BUILD_TYPE=Release --parallel-workers $(nproc) echo "source $(pwd)/install/local_setup.bash" >> ~/.bashrc source ~/.bashrc
- Clone and build the ZED ROS 2 examples:
cd ~/ros2_ws/src git clone https://github.com/stereolabs/zed-ros2-examples.git cd .. sudo apt update rosdep update rosdep install --from-paths src --ignore-src -r -y colcon build --symlink-install --cmake-args=-CMAKE_BUILD_TYPE=Release source ~/.bashrc
- Install Cyclone DDS for optimized communication: β‘
sudo apt install ros-humble-rmw-cyclonedds-cpp
- Configure Cyclone DDS as the ROS 2 middleware: π§
echo "export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" >> ~/.bashrc source ~/.bashrc
- Install Nav2 and SLAM Toolbox:
sudo apt install ros-humble-navigation2 ros-humble-nav2-bringup ros-humble-slam-toolbox
To enable GNSS fusion with the ZED camera: π°οΈπ·
- Edit the
common.yamlfile located at:~/ros2_ws/src/zed-ros2-wrapper/zed_wrapper/config/common.yaml - Update the GNSS fusion section:
gnss_fusion: gnss_fusion_enabled: true gnss_fix_topic: '/fix'
The Transform (TF) tree defines the spatial relationships between your robot's frames. Follow these steps to configure and verify the TF setup: π
-
Disable ZED Default TF Publication:
- Open the ZED camera launch file:
~/ros2_ws/src/zed-ros2-wrapper/zed_wrapper/launch/zed_camera.launch.py - Locate the
publish_tfparameter (typically around lines 345β350, depending on the file version). - Set
publish_tftofalseto disable the ZED node's default TF publication:'publish_tf': 'false'
- Save the file and rebuild the workspace:
cd ~/ros2_ws colcon build
- Open the ZED camera launch file:
-
Static Transform Publisher:
- The main launch file includes a static transform publisher to define the transform between
zed2_camera_linkandzed_camera_link:Node( package='tf2_ros', executable='static_transform_publisher', name='base_to_zed_broadcaster', arguments=['0', '0', '0', '0', '0', '0', 'zed2_camera_link', 'zed_camera_link'], output='screen' )
- This publishes a static transform with zero offset, aligning the frames as shown in the TF tree.
- The main launch file includes a static transform publisher to define the transform between
-
TF Tree Overview:
- The TF hierarchy starts with
mapandodomat the top level, withbase_footprintandbase_linkforming the robot's base structure. - The ZED camera frames (
zed2_camera_link,zed_camera_link,zed_camera_center, etc.) are attached tobase_link. - Additional sensor frames (e.g.,
gps_link,imu_link,3D_lidar) and wheel/steering frames (e.g.,front_left_wheel_link,steering_link) are also linked tobase_link. - Use the following command to visualize the TF tree:
ros2 run tf2_tools view_frames
- This generates a
frames.pdffile detailing the tree structure, including parent-child relationships, broadcasters, and transform rates.
- The TF hierarchy starts with
-
Key Frames and Relationships:
mapβodom(rate: 30.201 Hz)odomβbase_footprint(rate: 10.204 Hz)base_footprintβbase_link(static)base_linkβzed2_camera_link(static),3D_lidar,gps_link,imu_link, etc.zed2_camera_linkβzed_camera_linkβzed_camera_centerβzed_left_camera_frame,zed_right_camera_frame, etc.
Ensure Cyclone DDS is set as the default middleware: β‘
export RMW_IMPLEMENTATION=rmw_cyclonedds_cppAdd this to ~/.bashrc for persistence:
echo "export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" >> ~/.bashrc
source ~/.bashrcLocalization in this project uses the robot_localization package to fuse sensor data and estimate the robot's pose. Two configurations are provided: a dual EKF setup for global and local localization, and a single EKF setup for local-only localization.
The dual_ekf_and_navsat.launch.py file sets up a dual Extended Kalman Filter (EKF) configuration, which is ideal for outdoor navigation requiring both global accuracy and local continuity. π
-
Global EKF (
ekf_filter_node_map):- Produces
/odometry/globalin themapframe. - Fuses data from:
- Wheel odometry (e.g.,
/wheel/odometry) - IMU (
/zed/zed_node/imu/data) - Transformed GPS data (
/odometry/gpsfromnavsat_transform)
- Wheel odometry (e.g.,
- Publishes the
maptoodomtransform (rate: ~30 Hz, as per TF tree).
- Produces
-
NavSat Transform (
navsat_transform):- Converts GPS data (
/fix) into the local frame, producing/odometry/gps. - Uses IMU data (
/zed/zed_node/imu/data) for orientation and/odometry/globalfor alignment. - Essential for integrating GPS into the global EKF.
- Converts GPS data (
-
Local EKF (Optional, Commented Out):
- An
ekf_filter_node_odomnode can be enabled to produce/odometry/localin theodomframe, focusing on local continuity using odometry and IMU data without GPS.
- An
To launch:
ros2 launch naima_localization dual_ekf_and_navsat.launch.pyThe local.launch.py file provides a simpler setup for local localization, focusing on the odom to base_footprint transform. π
- EKF Node (
ekf_filter_node):- Produces a pose estimate in the
odomframe. - Fuses data from local sensors (e.g., wheel odometry, IMU).
- Does not integrate GPS, making it suitable for indoor or GPS-denied environments.
- Produces a pose estimate in the
To launch:
ros2 launch naima_localization local.launch.pyGPS, provided by the UBLOX GPS node (/fix), plays a critical role in global localization: π°οΈ
- Global Reference: Provides absolute position (latitude, longitude, altitude) to correct odometry drift.
- Integration:
- The
navsat_transform_nodeconverts GPS data into the local frame (/odometry/gps). - The global EKF fuses this with odometry and IMU data to produce a globally consistent pose (
/odometry/global).
- The
- Challenges:
- Low update rate (~5 Hz) compared to odometry/IMU (~100 Hz).
- Susceptible to noise or outages (e.g., in urban canyons); the EKF compensates by relying on other sensors.
- Verification:
- Check GPS data:
ros2 topic echo /fix - Verify transformed GPS:
ros2 topic echo /odometry/gps
- Check GPS data:
To launch the entire system, including the ZED camera, UBLOX GPS, localization, and navigation: π
-
Build the Workspace:
colcon build
-
Source the Setup File:
source install/setup.bash -
Launch the Main System:
ros2 launch naima_bringup bringup.launch.py
This launch file initializes:
- π· ZED 2 camera with depth and point cloud data.
- π°οΈ UBLOX GPS for GNSS data.
- π€ Robot State Publisher for URDF.
- π Localization with dual EKF and NavSat transform.
- π Pointcloud to LaserScan conversion.
- π Kinematic bicycle model for motion control.
-
Launch Nav2 Navigation:
ros2 launch nav2_bringup navigation_launch.py use_sim_time:=false map:=/home/men3m/Naima/src/naima_mapping/maps/map1/map.yaml autostart:=true
Note: Update the
mappath to match your systemβs directory structure if needed. This command starts the Nav2 stack with the specified map, enabling autonomous navigation.
-
UBLOX GPS Driver: To run the UBLOX GPS driver independently: π°οΈ
ros2 launch ublox_gps ublox_gps_node_1-launch.py
-
ZED Camera: To launch the ZED camera and visualize it in RViz2: π·
ros2 launch zed_wrapper zed_camera.launch.py camera_model:=zed2 ros2 launch zed_display_rviz2 display_zed_cam.launch.py camera_model:=zed2
The system publishes a wide range of topics, including: π‘
- Camera Topics:
/zed/zed_node/rgb/image_rect_color,/zed/zed_node/depth/depth_registered,/zed/zed_node/point_cloud/cloud_registered. - GNSS Topics:
/fix,/gps/filtered,/odometry/gps. - Navigation Topics:
/cmd_vel,/global_costmap/costmap,/local_costmap/costmap,/plan. - TF Topics:
/tf,/tf_static.
For a full list, run:
ros2 topic listKey nodes include: π₯οΈ
/zed/zed_node: ZED camera node./ublox_gps_node: GPS driver./kinematic_bicycle_model: Motion model./ekf_filter_node: Localization filter.
To list all active nodes:
ros2 node list- π· ZED Camera Not Detected: Ensure the ZED SDK is installed and the camera is connected. Run
zed-sdk-testto verify. - π°οΈ GPS Data Not Published: Check the
/fixtopic and ensure the UBLOX GPS driver is running. - β‘ High Latency: Verify Cyclone DDS is set as the middleware (
RMW_IMPLEMENTATION=rmw_cyclonedds_cpp). - π TF Errors: Confirm
publish_tfis set tofalsein the ZED launch file and thebase_to_zed_broadcasternode is publishing to/tf_static. Useview_framesto debug transform issues. - π Localization Drift: Verify GPS data (
/fix) and IMU (/zed/zed_node/imu/data) are being published. Check thedual_ekf_and_navsat.yamlconfiguration for proper sensor fusion settings. β οΈ Build Errors: Runrosdep install --from-paths src --ignore-src -r -yto resolve missing dependencies.
Contributions are welcome! To contribute: π
- Fork the repository: https://github.com/men3m-4/Naima.
- Create a feature branch:
git checkout -b feature/your-feature. - Commit changes:
git commit -m "Add your feature". - Push to the branch:
git push origin feature/your-feature. - Open a pull request.