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, default300),tunnel_length(int, default10).
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 (default20pixels).
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| robosim-1.0.tar.gz | 3.0 kB | Without provenance | Details for robosim-1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| robosim-1.0-py3-none-any.whl | Python 3 | none | any | Details for robosim-1.0-py3-none-any.whl |
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 |
Security for robosim 1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.