项目介绍

alitekes1/ackermann-vehicle-gzsim-ros2 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,目前获得 195 个 Star、26 次 Fork。

仓库全名
alitekes1/ackermann-vehicle-gzsim-ros2
Star 数
195
Fork 数
26
未关闭 Issue
2

README 摘要

Ackermann Steering Vehicle Simulation in ROS2 with Gazebo Sim Harmonic This project features the simulation of a custom vehicle with Ackermann steering capabilities, developed using ROS2 and the Gazebo Sim Harmonic environment. The model integrates a variety of sensors and navigation tools for autonomous operation, making it one of the first implementations of an Ackermann steering vehicle in this simulation…

完整内容见 GitHub 原始 README 或本页 。

常见问题

ackermann-vehicle-gzsim-ros2 用什么语言开发?

主要使用 Python 编写,目前有 195 个 Star。

如何获取 ackermann-vehicle-gzsim-ros2 的源码?

可以直接克隆仓库:git clone https://github.com/alitekes1/ackermann-vehicle-gzsim-ros2.git,默认分支为 main;安装与运行步骤见仓库 README。

ackermann-vehicle-gzsim-ros2 最近还在维护吗?

仓库最近一次更新为 3 周前,当前有 2 个未关闭 Issue;Star 数为 195,可作为社区活跃度的参考。

关于

This repository includes the simulation of a vehicle with an Ackermann drive system in ROS2 Humble & Jazzy and Gazebo Sim Harmonic, utilizing the Nav2 package for autonomous navigation.

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
247
价值分
124
活跃状态
活跃

语言占比

C++
CMake
Dockerfile
Python
Shell

README

Ackermann Steering Vehicle Simulation in ROS2 with Gazebo Sim Harmonic

This project features the simulation of a custom vehicle with Ackermann steering capabilities, developed using ROS2 and the Gazebo Sim Harmonic environment. The model integrates a variety of sensors and navigation tools for autonomous operation, making it one of the first implementations of an Ackermann steering vehicle in this simulation framework.

3D LiDAR Point Cloud Visualization Warehouse Environment Model
3D Point Cloud Warehouse Model

If you like this project, consider giving it a ⭐ to show your support!

Table of Contents

Features

1. Ackermann Steering

  • A custom vehicle model built with realistic Ackermann steering dynamics for accurate maneuverability.

2. ROS2 Communication

  • All sensor data and control signals are fully integrated into the ROS2 ecosystem for seamless interoperability.

3. Sensors

  • IMU: Provides orientation and angular velocity.
  • Odometry: Ensures accurate vehicle state feedback.
  • LiDAR: Mounted for obstacle detection and environmental scanning. Supports 3D point cloud generation for advanced perception tasks.
  • Cameras:
    • Front-facing
    • Rear-facing
    • Left-side
    • Right-side

    Note: By default, only the front camera is bridged to ROS 2.If you want to use all cameras (left, right, rear) in ROS 2,remove the # at the beginning of the relevant camera sections in saye_bringup/config/ros_gz_bridge.yaml to activate them (e.g., /camera/left_raw, /camera/right_raw, /camera/rear_raw).

4. Navigation

  • Integrated with the Nav2 stack for autonomous navigation.
  • AMCL (Adaptive Monte Carlo Localization) for improved positional accuracy.
  • SLAM techniques implemented for real-time mapping and understanding of the environment.
  • Fine-tuned parameters for optimized navigation performance.

5. Manual Control (with external joystick)

  • Added support for joystick-based manual control in the simulation environment, enabling users to test vehicle movement interactively.

6. Visualization

  • Full model and sensor data visualization in RViz2, providing insights into robot states and environmental feedback.

Requirements

  • ROS2 (Humble or Jazzy) — the Docker image is built on Jazzy
  • Gazebo Sim Harmonic
  • RViz2
  • Nav2

Local Installation

  1. Your need to sure that installation of Gazebo Harmonic and ROS (ros_gz):
    sudo apt-get install ros-${ROS_DISTRO}-ros-gz
    sudo apt-get install ros-humble-ros-gzharmonic (Humble only)
    sudo apt-get install ros-${ROS_DISTRO}-teleop-twist-keyboard ros-${ROS_DISTRO}-joy (manual control)
    More details about installation Gazebo and ROS: Link
  2. Clone the repository:
    mkdir -p ackermann_sim/src && cd ackermann_sim/src
    git clone https://github.com/alitekes1/ackermann-vehicle-gzsim-ros2
    cd ..
  3. Build the project: colcon build && source install/setup.bash
  4. GZ_SIM_RESOURCE_PATH is set automatically when you source the workspace (source install/setup.bash); no manual environment variables are needed. If you open a new terminal, just source the workspace again.

Docker Installation

You can also run the simulation using Docker, which ensures a consistent environment across different systems.

Prerequisites

  • Docker
  • NVIDIA Container Toolkit (for GPU support)

Steps to Run with Docker

  1. Clone the repository:

    mkdir -p ackermann_sim/src && cd ackermann_sim/src
    git clone https://github.com/alitekes1/ackermann-vehicle-gzsim-ros2
    cd ackermann-vehicle-gzsim-ros2
    
  2. Allow the container to access your X server (needed once per session, for the GUI):

    xhost +local:docker
    
  3. Build and run the Docker container (with GPU acceleration):

       docker run -it \
       --name ackermann_sim \
       --hostname ackermann_sim \
       --gpus all \
       --runtime=nvidia \
       --env="DISPLAY=$DISPLAY" \
       --env="QT_X11_NO_MITSHM=1" \
       --env="NVIDIA_VISIBLE_DEVICES=all" \
       --env="NVIDIA_DRIVER_CAPABILITIES=all" \
       --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
       --privileged alitekes1/ackermann_sim:latest
    

    Note: The --gpus all --runtime=nvidia flags require the NVIDIA Container Toolkit. Without a GPU, Gazebo falls back to software rendering and runs very slowly. If you don’t have an NVIDIA GPU, drop the --gpus, --runtime and NVIDIA_* lines to run on CPU rendering.

    Alternatively, use Docker Compose (GPU is already configured in docker-compose.yaml):

    docker compose up --build
    
  4. If you want to additional terminal for same container

       docker exec -it ackermann_sim bash
    

Note: Inside the container, you can run the simulation commands as normal.

Usage

1. Basic Simulation and Manual Control

  1. Launch the simulation:
    ros2 launch saye_bringup saye_spawn.launch.py
    
  2. Control car:
    ros2 run teleop_twist_keyboard teleop_twist_keyboard
    
    or with a gamepad (left stick -> /cmd_vel; the car stops if /joy is silent for 0.5 s, see the joy_timeout parameter):
    ros2 run joy joy_node
    ros2 run saye_control joystick_controller
    

2. SLAM (Simultaneous Localization and Mapping)

  • To run SLAM Toolbox for mapping, launch the following after starting the simulation:
    ros2 launch saye_bringup slam.launch.py
    
    SLAM- Youtube

3. Navigation with Nav2

  • To run the simulation with the Nav2 stack for autonomous navigation, launch the following after starting the simulation:
    ros2 launch saye_bringup navigation_bringup.launch.py
    
    Autonomus Navigation - Youtube

Note: The YouTube videos above are played at 4x speed. You can reach the videos by click on the images.

Future Work

  1. 3D SLAM Support
  2. Reinforcement Learning:
    • Train the vehicle to handle complex scenarios autonomously using advanced DRL algorithms.
  3. Enhanced Features:
    • Explore additional sensor configurations and navigation strategies.
  4. Nav2 integration with 3D Localization
    • Instead of AMCL(2D), more accurate and robust algorithms implementation.

Screenshot from 2024-09-23 00-09-48.png

3D LiDAR Point Cloud & Environment

3D LiDAR Point Cloud Visualization Warehouse Environment Model
3D Point Cloud Warehouse Model

Vehicle & Navigation

Gazebo Sim Harmonic RViz2
Screenshot from 2024-09-23 00-13-03.png Screenshot from 2024-09-23 00-09-04.png
Screenshot from 2024-09-23 00-12-13.png Screenshot from 2024-09-23 00-15-04.png
alt text alt text

TF Tree

TF Tree


Star History

Star History Chart

评论

暂无评论