Update discovery-phase/missions/mission_15_14_ant

This commit is contained in:
2026-10-30 20:03:21 +00:00
parent 51b7b36cf7
commit 34c153105b
2 changed files with 52 additions and 53 deletions

View File

@@ -0,0 +1,52 @@
#####################################
# Solution for BioGlow Mission 14,15
#####################################
import bioglow_helpers as helper
from bioglow_robot_settings import * # drive_base, left_arm, right_arm, ... all come from settings
async def solve_missions(): # Seed of Renewal and Keystone Species - Parthiv
# BLUE COLOR CODE
drive_base.stop()
drive_base.reset(0,0)
helper.set_speed(400,200,200,100)
await left_arm.run_angle(1000,-25)
await drive_base.arc(-315,angle=90, then=Stop.HOLD)
await drive_base.straight(150,then=Stop.HOLD)
await drive_base.turn(90,then=Stop.HOLD)
await drive_base.straight(235,then=Stop.NONE)
helper.set_speed(100,200,300,200)
await drive_base.turn(-85,then=Stop.HOLD)
helper.set_default_speed
await drive_base.straight(90,then=Stop.COAST)
await drive_base.straight(-95)
await drive_base.turn(-85)
await drive_base.straight(-250)
await drive_base.turn(60)
helper.set_speed(50,200,250,200)
await drive_base.straight(-175)
helper.set_default_speed
await drive_base.straight(100)
await drive_base.turn(-125)
await left_arm.run_angle(200,21)
await drive_base.turn(-21)
await drive_base.straight(25)
await left_arm.run_angle(1000,-25)
helper.set_speed(500,200,200,100)
await drive_base.straight(250)
await drive_base.turn(-42)
await drive_base.straight(150)
await right_arm.run_angle(300,-40)
await drive_base.straight(-150,then=Stop.NONE)
await drive_base.turn(93,then=Stop.HOLD)
await drive_base.straight(550,then=Stop.NONE)
await drive_base.stop
if __name__ == "__main__": # This run this mission stand-alone when not called from bioglow_main.py
run_task(solve_missions())

View File

@@ -1,53 +0,0 @@
#Solution for biosentric center
import umath
from pybricks.pupdevices import Motor, ColorSensor, UltrasonicSensor, ForceSensor
from pybricks.parameters import Button, Color, Direction, Port, Side, Stop
from pybricks.tools import run_task, multitask
from pybricks.tools import wait, StopWatch
from pybricks.robotics import DriveBase
from pybricks.hubs import PrimeHub
# Initialize hub and devices
hub = PrimeHub()
left_motor = Motor(Port.A, Direction.COUNTERCLOCKWISE)
right_motor = Motor(Port.B,Direction.CLOCKWISE) # Specify default direction
left_arm = Motor(Port.C, Direction.CLOCKWISE, [[12,36]],[[12,20,24]] ) # Specify default direction
right_arm = Motor(Port.D, Direction.CLOCKWISE,[[12,36],[12,20,24]]) #Added gear train list for gear ration
lazer_ranger = UltrasonicSensor(Port.E)
color_sensor = ColorSensor(Port.F)
# DriveBase configuration
WHEEL_DIAMETER = 68.8 # mm (adjust for your wheels)
AXLE_TRACK = 180 # mm (distance between wheels)
drive_base = DriveBase(left_motor, right_motor, WHEEL_DIAMETER, AXLE_TRACK)
drive_base.settings(700, 500, 300, 200)
drive_base.use_gyro(True)
def set_speed(straight_speed, st_acc, turn_speed, turn_acc):
drive_base.settings(straight_speed, st_acc, turn_speed, turn_acc)
async def run_both_arms():
await multitask(
left_arm.run_angle(200,80),
right_arm.run_angle(200,-100)
)
async def main ():
await left_arm.run_angle(200,-80)
await right_arm.run_angle(200,-70)
await drive_base.arc(-400,angle=90)
await drive_base.turn(55)
await drive_base.straight(240)
await drive_base.turn(-40)
await drive_base.straight(85)
await drive_base.straight(-32)
await run_both_arms()
await drive_base.straight(-53)
await right_arm.run_angle(200,100)
await drive_base.turn(30)
await drive_base.straight(-775)
await drive_base.stop
run_task(main())