コード例 #1
0
def align():
    # shared_all.move_straight(distance_mm=50, speed_mm_s=200)
    # shared_all.turn(angle=90, speed_deg_s=200)
    # shared_all.move_reverse(max_distance=65, speed_mm_s=75)
    # shared_all.move_straight(distance_mm=450, speed_mm_s=175)
    # shared_all.turn(angle=15, speed_deg_s=200)
    # shared_all.turn_arc(distance=15,angle=15,speed_mm_s=50)
    # shared_all.move_straight(distance_mm=138, speed_mm_s=200)
    shared_all.start_moving_crane_to_angle(crane_motor, 45)
    shared_all.move_rack_to_top()
    shared_all.move_straight(distance_mm=110, speed_mm_s=120)
    shared_all.turn(35)
コード例 #2
0
def run(adjust_for_mission=0):
#     shared_all.turn_to_direction( gyro=gyro, target_angle=10)
    shared_all.move_rack_to_floor()
    shake()

    #pull bsck
    shared_all.drive_raising_crane(duration_ms=1900, robot_distance_mm=-120, robot_turn_angle=-10, 
            motor=rack_motor, crane_angle=-40)
    #release
    shared_all.drive_raising_crane(duration_ms=1900, robot_distance_mm=5, robot_turn_angle=0, 
            motor=rack_motor, crane_angle=15)
    shared_all.move_crane_up(rack_motor, 180)
    shared_all.move_rack_to_top()
コード例 #3
0
ファイル: basket.py プロジェクト: menlosparks/fll
def level1():
    shared_all.move_crane_to_top(motor=crane_motor)
    shared_all.move_rack_to_floor()
    shared_all.turn(angle=-10, speed_deg_s=90)
    shared_all.move_straight(distance_mm=90, speed_mm_s=90)
    shared_all.turn(angle=20, speed_deg_s=90)

    # rack_motor.stop(Stop.BRAKE)

    # cntr=0
    # while cntr < 4 and shared_all.did_motor_stall(motor =rack_motor , max_degrees =80 , speed = 320):
    #    shared_all.log_string('Mtr stalled')
    #    shared_all.move_crane_down(rack_motor, 5)
    #    shared_all.log_string('mved crane down')
    #    shared_all.move_rack_to_floor()
    #    shared_all.move_straight(distance_mm=6, speed_mm_s=20)
    #    cntr +=1

    # shared_all.move_rack_to_floor()
    # shared_all.move_crane_down(rack_motor, 5)
    # rack_motor.run_time(720, 900)

    shared_all.drive_raising_crane(duration_ms=1300,
                                   robot_distance_mm=-40,
                                   robot_turn_angle=0,
                                   motor=rack_motor,
                                   crane_angle=80)
    shared_all.drive_raising_crane(duration_ms=1300,
                                   robot_distance_mm=0,
                                   robot_turn_angle=0,
                                   motor=rack_motor,
                                   crane_angle=50)

    shared_all.drive_raising_crane(duration_ms=900,
                                   robot_distance_mm=20,
                                   robot_turn_angle=0,
                                   motor=rack_motor,
                                   crane_angle=15)

    # back up while lowering slightly
    shared_all.drive_raising_crane(duration_ms=800,
                                   robot_distance_mm=-70,
                                   robot_turn_angle=0,
                                   motor=rack_motor,
                                   crane_angle=-20)

    shared_all.move_rack_to_floor()
    shared_all.move_straight(distance_mm=60, speed_mm_s=-90)
    shared_all.move_rack_to_top()
コード例 #4
0
def runpushdown():
    shared_all.move_rack_to_top()
    shared_all.move_straight(distance_mm=110, speed_mm_s=120)
    shared_all.turn(35)
    shared_all.move_crane_down(rack_motor, 210)
    shared_all.turn(-35)
    shared_all.move_straight(distance_mm=50, speed_mm_s=-120)
    shared_all.start_moving_crane_to_top(rack_motor)
    shared_all.move_to_color_reverse(
        color_sensor=color_sensor_center,
        stop_on_color=Color.BLACK,
        alternative_color=Color.BLACK,
        max_intensity=robot_setup.BLACK_MAX_INTENSITY[color_sensor_center],
        max_distance_mm=70)
    shared_all.move_rack_to_top()
コード例 #5
0
ファイル: slide.py プロジェクト: menlosparks/fll
def runfacing():
    shared_all.move_crane_down(rack_motor, 70)
    shared_all.move_hook_to_floor()
    shared_all.move_straight(distance_mm=20, speed_mm_s=-50)

    shared_all.drive_raising_crane (duration_ms=800, robot_distance_mm=-30, robot_turn_angle=0, 
                        motor=rack_motor, crane_angle=20)
    shared_all.drive_raising_crane (duration_ms=1900, robot_distance_mm=-90, robot_turn_angle=0, 
                        motor=rack_motor, crane_angle=20)
    # shared_all.move_straight(distance_mm=40, speed_mm_s=130)
    shared_all.move_crane_up(rack_motor, 70)
    shared_all.move_straight(distance_mm=500, speed_mm_s=-200)
    shared_all.move_rack_to_top()

   
# shared_all.calibrate_gyro(new_gyro_angle=-45)
# alignfacing()
# runfacing()
コード例 #6
0
def tread_to_weight():
    # shared_all.move_straight_target_direction(gyro=gyro, distance_mm=600, speed_mm_s=180,
    #  target_angle= -90)

    shared_all.move_rack_to_top()
    #  shared_all.move_crane_to_floor(motor=crane_motor, release_angle=25)
    shared_all.move_straight_target_direction(gyro=gyro,
                                              distance_mm=460,
                                              speed_mm_s=210,
                                              target_angle=-90)

    shared_all.move_to_color(
        color_sensor=color_sensor_center,
        stop_on_color=Color.WHITE,
        alternative_color=Color.BLACK,
        speed_mm_s=30,
        max_intensity=robot_setup.BLACK_MAX_INTENSITY[color_sensor_center],
        max_distance_mm=50)
コード例 #7
0
ファイル: cranes.py プロジェクト: menlosparks/fll
def all_cranes():
    shared_all.log_string('crane ang start ' + str(crane_motor.angle()))

    shared_all.move_crane_to_floor(crane_motor)
    shared_all.log_string('crane ang flr ' + str(crane_motor.angle()))

    shared_all.start_moving_crane_to_top(motor=crane_motor)
    shared_all.move_straight(distance_mm=70, speed_mm_s=-50)
    shared_all.log_string('crane ang top ' + str(crane_motor.angle()))

    shared_all.start_moving_crane_to_angle(motor=crane_motor, target_angle=50)
    shared_all.move_straight(distance_mm=70, speed_mm_s=150)
    shared_all.log_string('crane ang at 50 ' + str(crane_motor.angle()))

    shared_all.log_string('arm ang strt ' + str(rack_motor.angle()))

    shared_all.move_rack_to_top()
    shared_all.log_string('arm ang top ' + str(rack_motor.angle()))

    shared_all.move_rack_to_floor()
    shared_all.log_string('arm ang flr ' + str(rack_motor.angle()))
    shared_all.move_crane_up(rack_motor, 90)
    shared_all.log_string('arm ang flr+90 ' + str(rack_motor.angle()))
    shared_all.move_crane_down(rack_motor, 90)
    shared_all.log_string('arm ang -90 ' + str(rack_motor.angle()))
    shared_all.move_rack_to_top()
    shared_all.log_string('arm ang top ' + str(rack_motor.angle()))
    shared_all.log_string('crane motor ' + str(crane_motor))
    shared_all.log_string('rack motor ' + str(rack_motor))
    shared_all.log_string('left motor ' + str(left_motor))
    shared_all.log_string('right motor ' + str(right_motor))

    shared_all.move_crane_to_floor(crane_motor)
    crane_motor.reset_angle(0)
    shared_all.log_string('crane ang flr ' + str(crane_motor.angle()))

    shared_all.move_crane_to_top(motor=crane_motor)
    shared_all.log_string('crane ang top ' + str(crane_motor.angle()))

    shared_all.move_rack_to_floor()
    rack_motor.reset_angle(0)
    shared_all.log_string('rack ang flr ' + str(rack_motor.angle()))

    shared_all.move_rack_to_top()
    shared_all.log_string('rack ang top ' + str(rack_motor.angle()))
    shared_all.log_string('rack  top ' + str(rack_motor.angle()) +
                          'crane top ' + str(crane_motor.angle()))
コード例 #8
0
ファイル: basketball.py プロジェクト: menlosparks/fll
def run():
    shared_all.move_straight(distance_mm=100, speed_mm_s=300)
    shared_all.move_crane_to_top(crane_motor)
    wait(10)
    shared_all.turn(270)
    shared_all.move_rack_to_top()