SkillAgentSearch skills...

PythonRobotics

Python sample codes and textbook for robotics algorithms.

Install / Use

/learn @AtsushiSakai/PythonRobotics

README

<img src="https://github.com/AtsushiSakai/PythonRobotics/raw/master/icon.png?raw=true" align="right" width="300" alt="header pic"/>

PythonRobotics

GitHub_Action_Linux_CI GitHub_Action_MacOS_CI GitHub_Action_Windows_CI Build status

Python codes and textbook for robotics algorithm.

Table of Contents

What is PythonRobotics?

PythonRobotics is a Python code collection and a textbook of robotics algorithms.

Features:

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

  2. Widely used and practical algorithms are selected.

  3. Minimum dependency.

See this documentation

or this Youtube video:

or this paper for more details:

Requirements to run the code

For running each sample code:

For development:

Documentation (Textbook)

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 (textbook) online: Welcome to PythonRobotics’s documentation! — PythonRobotics documentation

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

How to use

  1. Clone this repo.

    git clone https://github.com/AtsushiSakai/PythonRobotics.git
    
  2. Install the required libraries.

  • using conda :

    conda env create -f requirements/environment.yml
    
  • using pip :

    pip install -r requirements/requirements.txt
    
  1. Execute python script in each directory.

  2. Add star to this repo if you like it :smiley:.

Localization

Extended Kalman Filter localization

<img src="https://github.com/AtsushiSakai/PythonRoboticsGifs/raw/master/Localization/extended_kalman_filter/animation.gif" width="640" alt="EKF pic">

Reference

Particle filter localization

2

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.

Reference

Histogram filter localization

3

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.

Reference

Mapping

Gaussian grid map

This is a 2D Gaussian grid mapping example.

2

Ray casting grid map

This is a 2D ray casting grid mapping example.

2

Lidar to grid map

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

2

k-means object clustering

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

2

Rectangle fitting

This is a 2D rectangle fitting for vehicle detection.

2

SLAM

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.

3

Reference

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.

3

Refer

View on GitHub
GitHub Stars29.0k
CategoryDevelopment
Updated1h ago
Forks7.2k

Languages

Python

Security Score

85/100

Audited on Mar 29, 2026

No findings