Skip to content

hanmmmmm/Navigation_package_for_DifferentialDrive

Repository files navigation

Navigation package for Differential Drive robots

This is my implementation of a complete 2D navigation package, including global planner, local planner, and motion controller (path follower).

I developed the above 3 modules, corresponding to the folders:

  • /global_planner
  • /local_planner
  • /stage_robot_controller

This folder contains the launch file for RVIZ, Gmapping, Stage_ros, Gazebo_ros:

  • /launch_stage_gmapping_rviz

Required input messages:

  • nav_msgs/OccupancyGrid
  • nav_msgs/Odometry
  • sensor_msgs/LaserScan

Output message:

  • /cmd_vel, geometry_msgs/Twist

Two simulators are used for demonstration purpose:

  1. stage_ros .

    • It uses a bmp image to build the world. I draw my map using this bitmap tool pixilart .
    • It creates a differential-drive robot with 2D lidar.
  2. Gazebo with turtlebot .

    • The map is turtlebot_house.
    • The turtlebot robot is a differential-drive robot with 2D lidar. It also has RGBD cameras though not used in this project.

Robot exploring the map to reach the goal:

gazebo turtle

For slam, I am using the standard Gmapping for demonstration.

rqt_grpah

This is the workflow within the system (using stage_ros simulator).

local gif

ROS messages used:

  • geometry_msgs: Twist, PoseStamped
  • sensor_msgs: LaserScan
  • nav_msgs: OccupancyGrid, MapMetaData, Odometry, Path

C++ libraries used:

  • ros/ros.h
  • vector, array, queue, string
  • atomic, thread
  • iostream, chrono, stdexcept, iomanip
  • set, map, unordered_map
  • limits, algorithm, math.h

Build

Place the needed folders in a ros workspace, e.g. catkin_ws/src/, and run catkin_make at catkin_ws

To-Do

  • Add algos from random-tree family, and compare with the A* family here.
  • Add MPC Model-predictive-controller.
  • Add Reed-shepp curve feature.

Global goal and Global path

The line of green arrows is the path, from current location to the goal location.

This example is using A* algorithm to find the path.

Each path-finding takes <1~20 ms. The more obstacles between robot and goal, the longer time it takes to find the valid path.

But this node is set to update the global path about 2~3 Hz even though it could do much faster, since global path doesn't need to be updated too frequently.

Here I am dragging the robot in Stage simulator by hand.

goal gif

Local goal and Local path

The green arrows are global path, and the red ones are local path.

This example is using Hybrid-A* to find the local path. The local goal is the last glocal path-point covered inside the local search area (The white square area around the robot base_link).

This is also a full working demo actually, since the robot is moving following the cmd_vel message generated by my controller module.

local gif

Working demo

Several new goals are added while the robot is moving. The paths are updated to guide the robot.

The controller module use odometry and local_path to generate the disired linear & angular velocity for the robot to follow the local_path.

In the planning module, the unkown region (dark green) is treated the same as clear region (bright white). Becasue the global planning is consantly updating the global path, a new path will be found if the existing path pass through a new-found obstacle.

The current path follower is Pure pursuit.

1. Stage sim

local gif



2. Gazebo

local gif

About

This is my implementation of a complete 2D navigation package, including global planner, local planner, and motion controller.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published