aggiunta la funzione del gioroscopio ma senza cureve
This commit is contained in:
parent
a6aa951e40
commit
748ed8785f
1 changed files with 11 additions and 5 deletions
16
leo/ruote.py
16
leo/ruote.py
|
|
@ -1,9 +1,11 @@
|
|||
from pybricks.parameters import Port, Stop
|
||||
from pybricks.hubs import InventorHub
|
||||
from pybricks.parameters import Axis, Port, Stop
|
||||
from pybricks.pupdevices import Motor
|
||||
from pybricks.tools import wait
|
||||
from pybricks.tools import vector, wait
|
||||
|
||||
# from pybricks.hub import PrimHub
|
||||
|
||||
hub = InventorHub(top_side=vector(1, 1, 0), front_side=vector(-1, 1, 0))
|
||||
mDestra = Motor(Port.F)
|
||||
mSinistra = Motor(Port.B)
|
||||
|
||||
|
|
@ -15,7 +17,7 @@ def vai_avanti(speed, gradi):
|
|||
|
||||
|
||||
def turn(speed_L, speed_R, gradi):
|
||||
print("girano le palle")
|
||||
print("girogiro")
|
||||
mSinistra.run_angle(speed_L, gradi, then=Stop.NONE, wait=False)
|
||||
mDestra.run_angle(speed_R, gradi, then=Stop.NONE, wait=True)
|
||||
|
||||
|
|
@ -31,8 +33,12 @@ turn(1000, 1000, 120)
|
|||
# vai_avanti(1000, 360)
|
||||
# turn(1000, 1000, 360)
|
||||
|
||||
# giro = hub.imu.heading()
|
||||
# print(giro)
|
||||
giroX = hub.imu.rotation(Axis.X)
|
||||
giroY = hub.imu.rotation(Axis.Y)
|
||||
giroZ = hub.imu.rotation(Axis.Z)
|
||||
print(giroX)
|
||||
print(giroY)
|
||||
print(giroZ)
|
||||
|
||||
while not (mSinistra.done() and mDestra.done()):
|
||||
wait(10)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue