Пример #1
0
def disable_autonomy(packet_contents):
    if state_switcher.state != rs.Shutdown():
        state_switcher.handle_event(rs.AutonomyEvents.ABORT,
                                    rs.Shutdown(),
                                    then=logging.info("Disabling Autonomy"))
        print("Throwing ABORT")
    drive.disable()
Пример #2
0
def disable_autonomy(packet_contents):
    if state_switcher.state != rs.Shutdown():
        state_switcher.handle_event(rs.AutonomyEvents.ABORT,
                                    rs.Shutdown(),
                                    then=logging.info("Disabling Autonomy"))
        print("Throwing ABORT")
        with open(outString, 'a') as f:
            f.write(time.strftime("%H%M%S") + " Shutdown event\n")
    drive.disable()
Пример #3
0
def enable_autonomy(packet_contents):
    print(state_switcher.state)
    if state_switcher.state == rs.Idle():
        Logger.write_line(
            time.strftime("%H%M%S") + " Enable: switching from Idle to Start")
        print("Yo yo de o itsd a hard-no")
        state_switcher.handle_event(rs.AutonomyEvents.START, rs.Idle())
        set_gps_waypoint()
        print("Throwing START")
    elif state_switcher.state == rs.Shutdown():
        Logger.write_line(
            time.strftime("%H%M%S") +
            " Enable: switching from Shutdown to Restart")
        state_switcher.handle_event(rs.AutonomyEvents.RESTART, rs.Shutdown())
        print("Throwing RESTART")

    drive.enable()
Пример #4
0
def enable_autonomy(packet_contents):
    print(state_switcher.state)
    if state_switcher.state == rs.Idle():
        # with open(logging, 'a') as f:
        #    f.write("Enable switching from Idle to Start\n")
        print("Yo yo de o itsd a hard-no")
        state_switcher.handle_event(rs.AutonomyEvents.START, rs.Idle())
        set_gps_waypoint()
        print("Throwing START")
    elif state_switcher.state == rs.Shutdown():
        #        with open(logging, 'a') as f:
        #           f.write("Enable switching from Shutdown to Restart\n")
        state_switcher.handle_event(rs.AutonomyEvents.RESTART,
                                    rs.Shutdown(),
                                    then=logging.info("Restarting Autonomy"))
        print("Throwing RESTART")

    drive.enable()
Пример #5
0
def enable_autonomy(packet_contents):
    print(state_switcher.state)
    if state_switcher.state == rs.Idle():
        state_switcher.handle_event(rs.AutonomyEvents.START, then=logging.info("Enabling Autonomy"))
        set_gps_waypoint()
        print("Throwing START")
    elif state_switcher.state == rs.Shutdown():
        state_switcher.handle_event(rs.AutonomyEvents.RESTART, then=logging.info("Restarting Autonomy"))
        print("Throwing RESTART")

    drive.enable()
Пример #6
0
                state_switcher.handle_event(
                    rs.AutonomyEvents.REACHED_MARKER,
                    rs.ApproachingMarker(),
                    then=logging.info("Reached Marker"))
                continue
            else:
                print("Driving To: " + str(left) + ", " + str(right))
                rovecomm_node.write(drive.send_drive(left, right))
                # rovecomm_node.write(RoveCommPacket(1000, 'h', (0,0), ip_octet_4=140))

        else:
            state_switcher.handle_event(rs.AutonomyEvents.MARKER_UNSEEN,
                                        rs.ApproachingMarker())
            print("Throwing MARKER_UNSEEN")

    elif state_switcher.state == rs.Shutdown():
        pass

    elif state_switcher.state == rs.Idle():
        #state_switcher.handle_event(rs.AutonomyEvents.START, rs.Idle())

        pass

    elif state_switcher.state == rs.ObstacleAvoidance():
        rovecomm_node.write(drive.send_drive(0, 0))
        # print(drive.send_drive(0,0))
        # rovecomm_node.write(RoveCommPacket(1000, 'h', (0,0), ip_octet_4=140))
        start = nav_board._location
        rovecomm_node.write(drive.send_drive(-100,
                                             -100))  # tune this drive number
        # rovecomm_node.write(RoveCommPacket(1000, 'h', (-100,-100), ip_octet_4=140))
Пример #7
0
def disable_autonomy(packet_contents):
    if state_switcher.state != rs.Shutdown():
        state_switcher.handle_event(rs.AutonomyEvents.ABORT, rs.Shutdown())
        print("Throwing ABORT")
        Logger.write_line(time.strftime("%H%M%S") + " Shutdown event")
    drive.disable()