Awesome Open Source
Awesome Open Source
header pic


GitHub_Action_Linux_CI GitHub_Action_MacOS_CI Build Status Documentation Status Build status codecov Language grade: Python CodeFactor tokei

Python codes for robotics algorithm.

Table of Contents

What is this?

This is a Python code collection of robotics algorithms.


  1. Easy to read for understanding each algorithm's basic idea.

  2. Widely used and practical algorithms are selected.

  3. Minimum dependency.

See this paper for more details:


For running each sample code:

  • Python 3.9.x

  • numpy

  • scipy

  • matplotlib

  • pandas

  • cvxpy

For development:

  • pytest (for unit tests)

  • pytest-xdist (for parallel unit tests)

  • mypy (for type check)

  • Sphinx (for document generation)

  • pycodestyle (for code style check)


This README only shows some examples of this project.

If you are interested in other examples or mathematical backgrounds of each algorithm,

You can check the full documentation online:

All animation gifs are stored here: AtsushiSakai/PythonRoboticsGifs: Animation gifs of PythonRobotics

How to use

  1. Clone this repo.

git clone

  1. Install the required libraries.

using conda :

conda env create -f environment.yml

using pip :

pip install -r requirements.txt

  1. Execute python script in each directory.

  2. Add star to this repo if you like it 馃槂.


Extended Kalman Filter localization

EKF pic

Documentation: Notebook

Particle filter localization


This is a sensor fusion localization with Particle Filter(PF).

The blue line is true trajectory, the black line is dead reckoning trajectory,

and the red line is an estimated trajectory with PF.

It is assumed that the robot can measure a distance from landmarks (RFID).

These measurements are used for PF localization.


Histogram filter localization


This is a 2D localization example with Histogram filter.

The red cross is true position, black points are RFID positions.

The blue grid shows a position probability of histogram filter.

In this simulation, x,y are unknown, yaw is known.

The filter integrates speed input and range observations from RFID for localization.

Initial position is not needed.



Gaussian grid map

This is a 2D Gaussian grid mapping example.


Ray casting grid map

This is a 2D ray casting grid mapping example.


Lidar to grid map

This example shows how to convert a 2D range measurement to a grid map.


k-means object clustering

This is a 2D object clustering with k-means algorithm.


Rectangle fitting

This is a 2D rectangle fitting for vehicle detection.



Simultaneous Localization and Mapping(SLAM) examples

Iterative Closest Point (ICP) Matching

This is a 2D ICP matching example with singular value decomposition.

It can calculate a rotation matrix, and a translation vector between points and points.



FastSLAM 1.0

This is a feature based SLAM example using FastSLAM 1.0.

The blue line is ground truth, the black line is dead reckoning, the red line is the estimated trajectory with FastSLAM.

The red points are particles of FastSLAM.

Black points are landmarks, blue crosses are estimated landmark positions by FastSLAM.



Path Planning

Dynamic Window Approach

This is a 2D navigation sample code with Dynamic Window Approach.


Grid based search

Dijkstra algorithm

This is a 2D grid based the shortest path planning with Dijkstra's algorithm.

PythonRobotics/figure_1.png at master 路 AtsushiSakai/PythonRobotics

In the animation, cyan points are searched nodes.

A* algorithm

This is a 2D grid based the shortest path planning with A star algorithm.

PythonRobotics/figure_1.png at master 路 AtsushiSakai/PythonRobotics

In the animation, cyan points are searched nodes.

Its heuristic is 2D Euclid distance.

Potential Field algorithm

This is a 2D grid based path planning with Potential Field algorithm.


In the animation, the blue heat map shows potential value on each grid.


Grid based coverage path planning

This is a 2D grid based coverage path planning simulation.


State Lattice Planning

This script is a path planning code with state lattice planning.

This code uses the model predictive trajectory generator to solve boundary problem.


Biased polar sampling

PythonRobotics/figure_1.png at master 路 AtsushiSakai/PythonRobotics

Lane sampling

PythonRobotics/figure_1.png at master 路 AtsushiSakai/PythonRobotics

Probabilistic Road-Map (PRM) planning


This PRM planner uses Dijkstra method for graph search.

In the animation, blue points are sampled points,

Cyan crosses means searched points with Dijkstra method,

The red line is the final path of PRM.



Rapidly-Exploring Random Trees (RRT)


PythonRobotics/figure_1.png at master 路 AtsushiSakai/PythonRobotics

This is a path planning code with RRT*

Black circles are obstacles, green line is a searched tree, red crosses are start and goal positions.


RRT* with reeds-shepp path

Robotics/animation.gif at master 路 AtsushiSakai/PythonRobotics)

Path planning for a car robot with RRT* and reeds shepp path planner.


This is a path planning simulation with LQR-RRT*.

A double integrator motion model is used for LQR local planner.



Quintic polynomials planning

Motion planning with quintic polynomials.


It can calculate a 2D path, velocity, and acceleration profile based on quintic polynomials.


Reeds Shepp planning

A sample code with Reeds Shepp path planning.



LQR based path planning

A sample code using LQR based path planning for double integrator model.


Optimal Trajectory in a Frenet Frame


This is optimal trajectory generation in a Frenet Frame.

The cyan line is the target course and black crosses are obstacles.

The red line is the predicted path.


Path Tracking

move to a pose control

This is a simulation of moving to a pose control



Stanley control

Path tracking simulation with Stanley steering control and PID speed control.



Rear wheel feedback control

Path tracking simulation with rear wheel feedback steering control and PID speed control.

PythonRobotics/figure_1.png at master 路 AtsushiSakai/PythonRobotics


Linear鈥搎uadratic regulator (LQR) speed and steering control

Path tracking simulation with LQR speed and steering control.



Model predictive speed and steering control

Path tracking simulation with iterative linear model predictive speed and steering control.

MPC pic


Nonlinear Model predictive control with C-GMRES

A motion planning and path tracking simulation with NMPC of C-GMRES



Arm Navigation

N joint arm to point control

N joint arm to a point control simulation.

This is an interactive simulation.

You can set the goal position of the end effector with left-click on the plotting area.


In this simulation N = 10, however, you can change it.

Arm navigation with obstacle avoidance

Arm navigation with obstacle avoidance simulation.


Aerial Navigation

drone 3d trajectory following

This is a 3d trajectory following simulation for a quadrotor.


rocket powered landing

This is a 3d trajectory generation simulation for a rocket powered landing.




bipedal planner with inverted pendulum

This is a bipedal planner for modifying footsteps for an inverted pendulum.

You can set the footsteps, and the planner will modify those automatically.





If this project helps your robotics project, please let me know with creating an issue.

Your robot's video, which is using PythonRobotics, is very welcome!!

This is a list of other user's comment and references:users_comments


Any contribution is welcome!!


If you use this project's code for your academic work, we encourage you to cite our papers

If you use this project's code in industry, we'd love to hear from you as well; feel free to reach out to the developers directly.


If you or your company would like to support this project, please consider:

If you would like to support us in some other way, please contact with creating an issue.



They are providing a free license of their IDEs for this OSS development.


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
python (51,962)聽
jupyter-notebook (6,027)聽
animation (1,042)聽
algorithm (494)聽
robotics (323)聽
localization (169)聽
robot (143)聽
slam (136)聽
mapping (132)聽
control (77)聽
autonomous-driving (76)聽
autonomous-vehicles (59)聽
path-planning (21)聽

Find Open Source By Browsing 7,000 Topics Across 59 Categories

Advertising 馃摝聽10
All Projects
Application Programming Interfaces 馃摝聽124
Applications 馃摝聽192
Artificial Intelligence 馃摝聽78
Blockchain 馃摝聽73
Build Tools 馃摝聽113
Cloud Computing 馃摝聽80
Code Quality 馃摝聽28
Collaboration 馃摝聽32
Command Line Interface 馃摝聽49
Community 馃摝聽83
Companies 馃摝聽60
Compilers 馃摝聽63
Computer Science 馃摝聽80
Configuration Management 馃摝聽42
Content Management 馃摝聽175
Control Flow 馃摝聽213
Data Formats 馃摝聽78
Data Processing 馃摝聽276
Data Storage 馃摝聽135
Economics 馃摝聽64
Frameworks 馃摝聽215
Games 馃摝聽129
Graphics 馃摝聽110
Hardware 馃摝聽152
Integrated Development Environments 馃摝聽49
Learning Resources 馃摝聽166
Legal 馃摝聽29
Libraries 馃摝聽129
Lists Of Projects 馃摝聽22
Machine Learning 馃摝聽347
Mapping 馃摝聽64
Marketing 馃摝聽15
Mathematics 馃摝聽55
Media 馃摝聽239
Messaging 馃摝聽98
Networking 馃摝聽315
Operating Systems 馃摝聽89
Operations 馃摝聽121
Package Managers 馃摝聽55
Programming Languages 馃摝聽245
Runtime Environments 馃摝聽100
Science 馃摝聽42
Security 馃摝聽396
Social Media 馃摝聽27
Software Architecture 馃摝聽72
Software Development 馃摝聽72
Software Performance 馃摝聽58
Software Quality 馃摝聽133
Text Editors 馃摝聽49
Text Processing 馃摝聽136
User Interface 馃摝聽330
User Interface Components 馃摝聽514
Version Control 馃摝聽30
Virtualization 馃摝聽71
Web Browsers 馃摝聽42
Web Servers 馃摝聽26
Web User Interface 馃摝聽210