diff --git a/soccer_bot.py b/soccer_bot.py index 626a907..dc64075 100644 --- a/soccer_bot.py +++ b/soccer_bot.py @@ -2,15 +2,34 @@ from pybricks.pupdevices import Motor, ColorSensor, UltrasonicSensor, ForceSenso from pybricks.parameters import Button, Color, Direction, Port, Side, Stop from pybricks.robotics import DriveBase from pybricks.tools import wait, StopWatch +from pybricks.hubs import PrimeHub -rc = Remote(timeout=5000) -print("Remote name: ", rc.name) -rc.light.on(Color.RED) +config = { + "PyBrick Hub" : { + "remote" : "blue", + "color" : Color.BLUE + }, + "Hub Rot" : { + "remote" : "red", + "color" : Color.RED + } +} + +hub = PrimeHub() +hub_name = hub.system.name() +hub_config = config[hub_name] +print("Hub config: ", hub_config) +rc = Remote(timeout=5000, name=hub_config["remote"]) +rc.light.on(hub_config["color"]) shoot = None try: shoot = Motor(Port.F) print("found shoot motor") + # erhöhe Beschleunigung des Shoot Motors von 2000 auf 8000 + shoot.control.limits(1000, 8000, 199) + print("Shoot limits (speed, accel, torque): " + str(shoot.control.limits())) + shoot.control.limits except: print("no shoot motor") @@ -52,11 +71,12 @@ while True: if Button.CENTER in pressed: if shoot: # move forward to shoot - angle=45 + angle=30 speed=1000 - shoot.run_angle(-speed, angle) - # move back shoot.run_angle(speed, angle) + # move back + shoot.run_angle(-speed, angle) + #shoot.run(speed) # run fast db.settings(s_speed*2, s_accel, t_rate, t_accel*2)