Skip to content

Use ROS and Gazebo to demonstrate SLAM and Path Planning in a simulated robotic environment.

License

Notifications You must be signed in to change notification settings

apresland/autonomous-mobile-robots

Repository files navigation

Autonomous Mobile Robots

This repository contains a walkthrough of Autonomous Mobile Robot engineering using a system-focused programming approach. Examples cover robot simulation with Gazebo, designing modular architectures with ROS, Visual SLAM with RTAB-Map and path planning with Probabilistic Graphical Methods.

The focus here is not on implementing everything from scratch but rather to demonstrate how open-source frameworks can be employed to build commercial grade robotic solutions. In context this following tech will be leaned on heavily:

  • Gazebo Robot Simulator accurately and efficiently simulates robots in complex indoor and outdoor environments.
  • Unified Robot Description Format (URDF) is an XML format used to describe robot elements in a code-independent way.
  • Robot Operating System (ROS) is a framework for building robot applications. It provides inter-process communications, a distributed parameter system and state-of-the-art algorithms (e.g. pose estimation, localization, navigation) in losely coupled packages.
  • RTAB-Map (Real-Time Appearance-Based Mapping) is a RGB-D Graph-Based SLAM technique based on an incremental appearance-based loop closure detector.
  • RViz is a 3D robot visualzer that provides a view of your robot model and captured sensor information. It can display data from camera, lasers, from 3D and 2D devices including pictures and point clouds.

The remaining content is split into a ordered set of self contained examples. Each example demonstrates a core concern of robotics software engineering and the ordering is defined so that each example builds on the outcomes of the previous.

Example 1: Simulation

alt text

Goal: Simulate a robot and it's environment with Gazebo and interact with the robots world via a ROS plugin.

Skills: Gazebo Simulation, ROS Plugins, ROS-Gazebo interaction

Gazebo is a 3D dynamic simulator that can efficiently simulate robots in complex indoor and outdoor environments. Gazebo offers physics simulation similar to game engines but at a higher degree of fidelity. It also offers convenient programmatic and graphical interfaces.

Gazebo offers the following features:

  • Dynamics Simulation with multiple high-performance physics engines (ODE, Bullet, Simbody, DART)
  • Realistic rendering of environments using OGRE
  • Generate sensor data from sensors including laser range finders, 2D/3D cameras, Kinect sensors, force-torque
  • Robot models including PR2, Pioneer2 DX, iRobot Create, and TurtleBot or custom built using SDF/URDF
  • Direct access to Gazebo's API from ROS with custom plugins for robot, sensor, and environmental control

Typical uses of Gazebo simulation include:

  • Testing robotics algorithms
  • Designing new robots
  • Performing regression testing
  • Training AI systems using realistic scenarios

Example 2: Perception & Locomotion

alt text

Goal: Design a mobile robot with differential drive using ROS, place it in the robotic environment and enable the robot to chase a ball through the world. Achieve this by percieving objects by processing the pixels in RGB camera (e.g. color detection) and then locomote towards the object by sending command velocities to the motion controller.

Skills: Sensors, ROS Workspaces, ROS Packages, ROS Nodes, ROS Launchers, RViz integration.

ROS offers the following features:

  • A computation graph comprising nodes, Master, Parameter Server, messages, services, topics
  • Synchronous RPC-style communication over services
  • Asynchronous streaming of data over topics
  • Storage of data on a Parameter Server
  • Low-level device control

Typically ROS is used to create plugins that implement the see-think-act cycle:

  • See: Perceive the environment by subscribing to raw low-level sensor data and extracting information.
  • Think: Localize within the environmental model (map) and calculate a planned path.
  • Act: Execute the planned path with motion control via actuator commands.

In this module we implement a basic version of the cycle using ROS plugins that:

  • Subscribe to raw RGB camera data sensor_msgs/Image messages and locate target objects using color detection
  • Update linear and angular velocity as geometry_msgs/Twist messages to approach the target object
  • Control motion by publishing to the /mobile_base_controller/cmd_vel topic.

Example 3: Localization

alt text

Goal: Use the Adaptive Monte Carlo Localization (AMCL) algorithm in ROS, in conjunction with sensor data and a map of the world, to estimate a mobile robot’s position and orientation.

Skills: Probabilistic Localization, Monte Carlo Localization, ROS Parameter Server, ROS Packages.

AMCL is a specific implementation of the Particle Filter algorithm. At the conceptual level it maintains a probability distribution over the set of all possible robot poses, and updates this distribution using data from odometry and range sensors. The probability densities are represented by sets of randomly generated samples taken in proportion to likelihood allowing particle filters to focus the computational resources on regions with high likelihood.

The steps of the Particle Filter are:

  • Re-sampling: Draw a random sample with replacement from the sample set according to a distribution defined through importance weights. This sample can be seen as an instance of prior belief.
  • Sampling: Use the prior belief and the control inputs to sample from the distribution describing the robots dynamic system. The product of the obtained distribution the prior belief provides the proposal used in the next step.
  • Importance sampling: Weight each sample by the importance weight calculated as the likelihood of the sample given the measurements.

AMCL provides a measure of goodness of fit of the distribution represented by weighted particles. It can then dynamically adapt the number of particles in the filter: when the robot’s pose is highly uncertain, the number of particles is increased; when the robot’s pose is well determined, the number of particles is decreased. This enables the robot to make a trade-off between processing speed and localization accuracy.

Example 4: Visual SLAM

alt text

Goal: Simulate an automonous mobile robot that uses the Simultaneous Localisation and Mapping (SLAM) to map its environment and localize within it.

Skills: Mapping and SLAM algorithms, Occupancy Grid Mapping, GraphSLAM, Feature Detection, Loop Closure.

RTAB-Map (Real-Time Appearance-Based Mapping) is a graph based SLAM method using RGB-D/Stereo camera or LIDAR data for incremental appearance based loop closure detection. Loop closure occurs inside working memory based on features detected with SURF (Speeded Up Robust Features) esimating how likely a new image comes from a previous location or a new location. When a loop closure hypothesis is accepted, a new constraint is added to the map’s graph and an optimizer minimizes the mapping errors. A memory management is used to limit the number of locations used for loop closure detection and graph optimization, so that real-time constraints on large-scale environnements are respected.

In this example rtabmap-ros (a ROS wrapper around the RTAB-Map) will be used with a RGB-D camera to generate 3D point clouds of the environment and create a 2D occupancy grid map for navigation.

Example 5: Path Planning

alt text

Goal: Simulate an autonomous mobile robot that can autonomously navigate its environment in order to achieve correct pose at dynamically defined pick and place goals. The robot first map its environment using SLAM.

Skills: ROS Navigation Stack, ROS Actions, Cost Maps, Path Search Algorithms, .

ROS path planning is an example of a ROS Action. Actions execute long-running goals that can be preempted to get periodic feedback on the task progress. The default path planning action is provided by move_base which links together a global and a local planner to accomplish its navigation task. It maintains two costmaps, one each for the global and local planning.

Planners must adhere to the specifications of nave_core. The default planners are:

  • navfn/NavfnROS provides global planning with a fast, interpolated navigation function assuming a circular robot. It is computed with Dijkstra's algorithm or A* if a heuristic is supplied.
  • base_local_planner/TrajectoryPlannerROS provides local planning using Trajectory Rollout and Dynamic Window approaches. Given a plan to follow and a costmap, the controller produces velocity commands that are sent to a mobile base to control motion.

This example follows these navigation steps:

  • Define pick-and-place goal markers
  • Create a MoveBaseClient instance to interact with the move_base.
  • Use a move_base_msgs::MoveBaseGoal instance to define the pick/place goal
  • Send the goal to move_base server using the client
  • Poll the client instance to get task progress updates.

About

Use ROS and Gazebo to demonstrate SLAM and Path Planning in a simulated robotic environment.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published