import motor import runloop from hub import port import motor_pair #arne dont hate on the code plz #if you do then rather come with improvements. #binds both the wheels so they are an motor pair motor_pair.pair(motor_pair.PAIR_1, port.E, port.F) async def octopus_harvesting(): await motor.run_to_absolute_position(port.C, 0, 200) # Resets the arm await motor_pair.move_for_degrees(motor_pair.PAIR_1, 550, 0) # Moves forward towards the squid tower await motor_pair.move_for_degrees(motor_pair.PAIR_1, -120, 100) # Rotates left to align with tower await motor_pair.move_for_degrees(motor_pair.PAIR_1, 500, 0) # Collects squid async def octopus_cage(): await motor_pair.move_for_degrees(motor_pair.PAIR_1, -300, 0) # Moves back await motor_pair.move_for_degrees(motor_pair.PAIR_1, -95, 100) # Rotates left await motor_pair.move_for_degrees(motor_pair.PAIR_1, 900, 0) # Moves forward towards the field await motor_pair.move_for_degrees(motor_pair.PAIR_1, 175, 100) # Rotates to align with field await motor_pair.move_for_degrees(motor_pair.PAIR_1, 400, 0) # Moves forward await motor.run_for_degrees(port.C, 100, 100) # Releases squid async def power_lifting_submarine(): await motor_pair.move_for_degrees(motor_pair.PAIR_1, -50, 0) # Back await motor_pair.move_for_degrees(motor_pair.PAIR_1, 80, 100) # Right await motor_pair.move_for_degrees(motor_pair.PAIR_1, 600, 0) # Forward await motor_pair.move_for_degrees(motor_pair.PAIR_1, -150, 100) # Left await motor.run_to_absolute_position(port.C, 0, 200) # Resets the arm await motor.run_for_degrees(port.C, 40, 100) # Arm lifting await motor_pair.move_for_degrees(motor_pair.PAIR_1, 115, 0) # Forward await motor.run_for_degrees(port.C, 250, 250) # Power lifting await motor.run_to_absolute_position(port.C, 0, 200) await motor.run_for_degrees(port.C, 250, 250) async def nightmare_fish(): await motor.run_to_absolute_position(port.C, 0, 200) # Resets the arm await motor.run_for_degrees(port.C, 40, 100) # Arm lifting await motor_pair.move_for_degrees(motor_pair.PAIR_1, -100, 100) # Left await motor_pair.move_for_degrees(motor_pair.PAIR_1, 400, 0) # Forward await motor_pair.move_for_degrees(motor_pair.PAIR_1, -180, 100) # Left await motor.run_to_absolute_position(port.C, 0, 200) # Resets the arm await motor_pair.move_for_degrees(motor_pair.PAIR_1, 80, 0) # Forward await motor_pair.move_for_degrees(motor_pair.PAIR_1, 80, 100) # Right await motor_pair.move_for_degrees(motor_pair.PAIR_1, 90, 0) # Forward async def baby_shark(): await motor_pair.move_for_degrees(motor_pair.PAIR_1, -90, 0) # backwards await motor_pair.move_for_degrees(motor_pair.PAIR_1, 80, 100) # Right await motor_pair.move_for_degrees(motor_pair.PAIR_1, 800, 0) # Forward await motor_pair.move_for_degrees(motor_pair.PAIR_1, -100, 100) # Left await motor_pair.move_for_degrees(motor_pair.PAIR_1, 100, 100) # Right await motor_pair.move_for_degrees(motor_pair.PAIR_1, 500, 0) # Forward await motor_pair.move_for_degrees(motor_pair.PAIR_1, 80, 100) # Right await motor.run_for_degrees(port.C, 100, 100) # Arm lifting await motor.run_to_absolute_position(port.C, 0, 200) # Resets the arm await motor.run_for_degrees(port.C, 40, 100) # Arm lifting await motor.run_for_degrees(port.C, 20, 100) # Arm lifting await motor_pair.move_for_degrees(motor_pair.PAIR_1, 130, 0) # Forward await motor.run_to_absolute_position(port.C, 0, 200) # Resets the arm async def return_home(): await motor_pair.move_for_degrees(motor_pair.PAIR_1, -150, 0) # Backwards await motor_pair.move_for_degrees(motor_pair.PAIR_1, -220, 100) # Left await motor_pair.move_for_degrees(motor_pair.PAIR_1, 1200, 0) # Forward # referencing all the other tasks async def main(): await octopus_harvesting() # removes the squid from the antenna await octopus_cage() # relocate the squid await power_lifting_submarine() # sending over the submersible await nightmare_fish() # makes the angler fish go to sleep await baby_shark() # on the way to get the shark water sample is done await return_home() # finished # now this runs the def main which again takes and references all the other def XXX and runs their code in sequence. runloop.run(main())