A lightweight Python Robot simulator
Project description
jyrobot
A lightweight Python robot simulator for Jupyter Lab, Notebooks, and other environments.
Goals
- A lightweight mobile robotics simulator
- Usable in the classroom, research, or exploration
- Explore wheeled robots with range, cameras, and light sensors
- Operate quickly without a huge amount of resources
- Create reproducible experiments
- Designed for exposition, experimentation, and analysis
- Sensors designed for somewhat realistic problems (such as image recognition)
- Especially designed to work easily with Machine Learning and Artificial Intelligence systems
Examples
There are pre-designed simulations ready to run, like this:
import jyrobot
import random
world = jyrobot.load("two-scribblers")
for robot in world.robots:
# Give each robot a desired speed:
robot.forward(1)
def control(world):
for robot in world.robots:
if robot.stalled:
# If stuck, just reverse:
robot.reverse()
# Turn randomly:
robot.turn(1 - random.random() * 2)
# Watch the robots move in real time, or faster:
world.watch()
world.run(control, show=True, real_time=False)
# Press Control+C or interrupt the kernel to stop
You can also easily assemble your own simulations, robots, and sensors.
import jyrobot
world = jyrobot.World(width=100, height=100)
world.watch()
robot = jyrobot.Scribbler()
world.add_robot(robot)
robot.add_device(jyrobot.RangeSensor())
robot.add_device(jyrobot.Camera())
world.save_as("world-1")
Installation
For the core operations, you will need to install just jyrobot:
pip install jyrobot
For just image processing on top of of the core, you will need:
- Pillow - Python Image Library (PIL)
For the full set of options, you will need:
- Pillow - Python Image Library (PIL)
- ipywidgets
- IPython
- bqplot
There are three different backends:
- "pil" - requires
Pillow
(Python Image Library, PIL), the default; best tested - "canvas" - requires
ipycanvas
andnumpy
; some issues - "svg" - requires
svgwrite
andcairosvg
(for backend.take_picture()); some issues
You can install all of the above with conda or pip.
To use the Jupyter enhancements, you'll also need the browser-based extensions. You can install those with:
jupyter labextension install @jupyter-widgets/jupyterlab-manager ipycanvas bqplot
If not in a conda environment, then you will also need to:
jupyter nbextension enable --py widgetsnbextension
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for aitk.robots-0.7.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9a6d2513a89f80f8c74de56f779f3ad67fb747879519d64618b9d9eba9fb4bf |
|
MD5 | 324cbb9b48a9603c66acec57ba16fd36 |
|
BLAKE2b-256 | 1e293ef69947a383966f13165090b2e39d231f5d21933c52c3a128851b6bf715 |