Skip to main content

Under construction PyPI license Beerpay

RoboSim

RoboSim is a Python 3.6 based simulator for Robotics. I wrote it to test out my PhD AI algorithms and produce paper-ready result images in random mapping environments. The simulator uses pygameto present realtime results for robot navigation.

This project is still under construction, so you might have missing features or bugs.
Please submit issues when that happens.

Features:
  • Create randomly generated map,
  • Create paths,
  • Create robots,
  • Run simulation,
  • Realistic PID controller movement,
  • Collisions,
  • Nice looking UI,
  • Statistics panel,
  • Sensor simulation,
  • And more... when I think of something else.

Installation

RoboSim is now available on pip, so you just need to run the following command in your command line:

pip install robosim
Requirements
  • pygame 1.9.3 (didn't test on other).

Using RoboSim

Map

Map generation is done using the Random Walk algorithm.To generate a new map, you need to create a new Map object by writing the following code:

from robosim import Map
map = Map()

You can pass the following parameters in the constructor:

  • dimensions (tuple, default (32,24)),
  • tunnels (int, default 300),
  • tunnel_length (int, default 10).

Once you create the object, the __generate_map() function is called, and you can access the 2D-array by using the generated_map parameter:

map = Map()
my_awesome_map_array = map.generated_map

Each map object, has its own map, so you can test out your algorithm on various maps at a time. Below you can see a sample output of the generated map, where 0 mean that the space is used for navigation and 1 that an obstacle is placed there.

[
    [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 
    [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 
    [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 
    [0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], 
    [0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], 
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1], 
    [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1], 
    [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1], 
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1], 
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1], 
    [1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1], 
    [1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1], 
    [1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1]
]

RoboSim

To run the application, you need to create a RoboSim object first:

from robosim import Map, RoboSim

# Create the map
map = Map()

# Initialize the simulation
sim = RoboSim(map)
sim.run()

The RoboSim requires the map object as a parameter, but there are also other optional parameters you can add:

  • debug (boolean) - let's the simulator know, if you want to "click out" the paths,
  • multipath (boolean) - allows creating multiple paths in debug mode.

To start the simulation you need to use the run() method. The optional parameters are:

  • title - sets the window title,
  • size_mult - drawing size for obstacles (default 20 pixels).

The run() method, runs the pygame code on a thread, so you can easily start multiple simulations at once.

Controls

For now the simulator doesn't have an UI that will allow you to manipulate what is happening. Here is the key list that are used with a description:

Key Mode Description
Left click Normal Adds start and goal
Left click Debug Adds path point
Right click Debug Creates robot
1 All Starts robot movement
2 All Pauses robot movement
3 All Takes screenthos NYI
4 All Start/Stop recording NYI

Metadata

Release files for robosim 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robosim 1.0
File Size Uploaded
robosim-1.0.tar.gz 3.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for robosim 1.0
File Interpreter ABI Platform
robosim-1.0-py3-none-any.whl Python 3 none any Details

Total release size: 5.8 kB

Release files / robosim-1.0.tar.gz

Download URL robosim-1.0.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
aaed8837e474a767f240fdd6eac0a17e0d0853cdd56067e823a8d6f9a2b23dd3
BLAKE2b-256 checksum
How to use checksums
eb7fad25f4cac7182c126dbffbe63a0258bc9e079d368a46dd77a8fb35b8a079
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / robosim-1.0-py3-none-any.whl

Download URL robosim-1.0-py3-none-any.whl
Size 2.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e95f9239975f4cac9257f2590aeafae9563e1be836af70623b647afb8f316f0
BLAKE2b-256 checksum
How to use checksums
83f327548e7409942fb5a30536f503c29999f93bc95903b8f0ce4294434bbabd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page