Python client for Minirobots Turtle Robot (includes Jupyter tutorial)
Project description
Python client for Minirobots Turtle Robot
Install
$ pip install minirobots-turtle
Run the Minirobots Shell
$ minirobots-shell [vi]
Te damos la bienvenida a la interfaz interactiva de Minirobots!
Desde aquí podrás programar tu tortuga en tiempo real
Para ver la ayuda completa escribí
help(Turtle)
Si querés ver sólo la ayuda de alguna función específica,
como por ejemplo 'forward', escribí
help(Turtle.forward)
>>>
Run the Jupyter Notebook Tutorial
$ minirobots-tutorial
Run the Serial Monitor (robot connected to USB port required)
$ minirobots-serial-monitor /dev/ttyUSB0
Connected to: /dev/ttyUSB0
Press Ctrl+C to exit
/'\_/`\ __ __ /\ \ /\ \__
/\ \/\_\ ___ /\_\ _ __ ___\ \ \____ ___\ \ ,_\ ____
\ \ \__\ \/\ \ /' _ `\/\ \/\`'__\/ __`\ \ '__`\ / __`\ \ \/ /',__\
\ \ \_/\ \ \ \/\ \/\ \ \ \ \ \//\ \L\ \ \ \L\ \/\ \L\ \ \ \_/\__, `\
\ \_\\ \_\ \_\ \_\ \_\ \_\ \_\\ \____/\ \_,__/\ \____/\ \__\/\____/
\/_/ \/_/\/_/\/_/\/_/\/_/\/_/ \/___/ \/___/ \/___/ \/__/\/___/
[ init ] Minirobots starting...
[ init ] MAC Address: 2c:3a:e8:15:34:20
[ init ] Connecting to WiFi using Casa-E...Connected!
[ init ] IP Address: 192.168.1.112
[ turtle ] Connecting to minirobots.local...Error:
[ turtle ] Connecting to api.minirobots.com.ar...Connected!
[ turtle ] Current firmware version: 0.3.5
[ turtle ] No firmware update found at api.minirobots.com.ar
[ server ] Multicast DNS responder started for minirobots-153420.local
[ server ] Minirobots Turtle API started on port 80
Use Examples
Making a square (Interactive Shell)
>>> turtle = Turtle('01234f')
>>> for _ in range(4):
... turtle.forward(10)
... turtle.right(90)
...
Making a star function (Standalone program)
from minirobots import Turtle
turtle = Turtle('01234f')
turtle.auto_send(False)
def star(turtle, n, side):
for _ in range(n):
turtle.forward(side)
turtle.right(360 / n)
turtle.forward(side)
turtle.left(720 / n)
turtle.send()
star(turtle, 5, 100)
Primitives
Class Turtle
class Turtle(code, ip=None)
debug(on=None)
auto_send(on=None)
info()
status()
forward(distance)
backward(distance)
right(angle)
left(angle)
pen_up()
pen_down()
leds(red, green, blue, led=None)
leds_color(color, led=None)
random_leds(led=None)
random_led_right()
random_led_left()
turn_off_leds(led=None)
play_tone(frequency, duration=1000)
play_note(note, duration=1000)
play_random_note(duration=1000)
sleep(duration=1000)
queue_lock()
queue_unlock()
queue_clear()
send(commands=None)
stop()
# Static methods
get_random_color()
get_random_note()
get_frequency(note)
# Properties
ip
ip_age
# Constants
LED_LEFT
LED_RIGHT
LED_BOTH
COLORS
NOTES
# Aliases
silence == sleep
Class Tortuga
class Tortuga(code=None, ip=None)
adelante(distancia)
atras(distancia)
derecha(angulo)
izquierda(angulo)
lapiz_arriba()
lapiz_abajo()
leds(rojo, verde, azul, led=None)
leds_color(color, led=None)
leds_al_azar(led=None)
led_izquierdo_al_azar()
led_derecho_al_azar()
apagar_leds(led=None)
tono(frecuencia, duracion=1000)
nota(nota, duracion=1000)
nota_al_azar(duracion=1000)
esperar(duracion=1000)
auto_enviar(activado=None)
enviar()
parar()
# Aliases
avanzar = adelante
retroceder = atras
subir_lapiz = lapiz_arriba
bajar_lapiz = lapiz_abajo
encender_leds = leds
encender_leds_color = leds_color
encender_leds_al_azar = leds_al_azar
encender_led_derecho_al_azar = led_derecho_al_azar
encender_led_izquierdo_al_azar = led_izquierdo_al_azar
reproducir_tono = tono
tocar_nota = nota
tocar_nota_al_azar = nota_al_azar
silencio = esperar
obtener_color_al_azar = Turtle.get_random_color
obtener_nota_al_azar = Turtle.get_random_note
Development
Create environment
Use the bash script
$ bin/create_env.sh
Or create it manually
python3 -m venv env
source env/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
minirobots-turtle-0.2.9.tar.gz
(99.0 kB
view details)
Built Distribution
File details
Details for the file minirobots-turtle-0.2.9.tar.gz
.
File metadata
- Download URL: minirobots-turtle-0.2.9.tar.gz
- Upload date:
- Size: 99.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbc704e820b564c3bfca539113e9da4d4744c808393d0a13bddcc778d972edb3 |
|
MD5 | e86cb2f055a2b1899e2600cef7befe0d |
|
BLAKE2b-256 | ad8d66ee420f2351420f9fb0a8f8fe10c8f99499b6ae8ee0eb617a964a5aa4c5 |
File details
Details for the file minirobots_turtle-0.2.9-py3-none-any.whl
.
File metadata
- Download URL: minirobots_turtle-0.2.9-py3-none-any.whl
- Upload date:
- Size: 119.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9d9ce79f178b4743a124e60530f31244bec75fd26d755b3a2c71cbe3d33fabb |
|
MD5 | 156ce334cb59532cb232687e02737ac8 |
|
BLAKE2b-256 | e361a24ca9fa55544c31c0172bd0c9d63dfc7d5d9c4de718270ad21af59c8f00 |