1
0
mirror of https://github.com/undera/pylgbst.git synced 2020-11-18 19:37:26 -08:00

Experiments with vernie finished

This commit is contained in:
Andrey Pohilko 2017-09-21 16:25:46 +03:00
parent d9bf21bf9c
commit 8baaac57a0
3 changed files with 6 additions and 10 deletions

View File

@ -4,7 +4,6 @@ import os
import re
import subprocess
import sys
import traceback
from pylgbst import *
from pylgbst.comms import DebugServerConnection
@ -14,7 +13,6 @@ try:
def say(text):
return
if isinstance(text, str):
text = text.decode("utf-8")
md5 = hashlib.md5(text.encode('utf-8')).hexdigest()
@ -106,13 +104,13 @@ class Vernie(MoveHub):
self.motor_external.angled(direction * angle, speed)
def turn(self, direction, degrees=90, speed=0.3):
#self.head(STRAIGHT, speed=0.5)
#self.head(direction, 35, 1)
self.head(STRAIGHT, speed=0.5)
self.head(direction, 35, 1)
self.motor_AB.angled(int(VERNIE_TO_MOTOR_DEGREES * degrees), speed * direction, -speed * direction)
#self.head(STRAIGHT, speed=0.5)
self.head(STRAIGHT, speed=0.5)
def move(self, direction, distance=1, speed=0.2):
#self.head(STRAIGHT, speed=0.5)
self.head(STRAIGHT, speed=0.5)
self.motor_AB.angled(distance * VERNIE_SINGLE_MOVE, speed * direction, speed * direction)
def interpret_command(self, cmd, confirm):

View File

@ -30,7 +30,9 @@ def on_turn(angl):
robot.button.subscribe(on_btn)
robot.color_distance_sensor.subscribe(on_change_lum, ColorDistanceSensor.LUMINOSITY, granularity=1)
robot.motor_A.subscribe(on_turn, granularity=30)
# TODO: add bump detect to go back?
while running:
# turn around, measuring luminosity
lum_values = {}

View File

@ -1,9 +1,5 @@
import logging
from vernie import *
logging.basicConfig(level=logging.DEBUG)
robot = Vernie()
running = True