Example #1
0
            img = cv2.resize(img, (684, 342))
            return img, distance


if __name__ == "__main__":
    import threading
    from control import Control
    from car_platform import CarPlatform
    from monitoring import Monitoring

    testDT = Data()
    """
    test code
    특정 미션 번호에서 시작하도록 함
    """
    testDT.current_mode = 1

    testDS = Source(testDT)
    car = CarPlatform('COM5', testDT)
    testMP = MotionPlanner(testDS, testDT)
    test_control = Control(testDT)
    monitor = Monitoring(testDS, testDT)

    lidar_source_thread = threading.Thread(target=testDS.lidar_stream_main)
    left_cam_source_thread = threading.Thread(
        target=testDS.left_cam_stream_main)
    right_cam_source_thread = threading.Thread(
        target=testDS.right_cam_stream_main)
    mid_cam_source_thread = threading.Thread(target=testDS.mid_cam_stream_main)
    planner_thread = threading.Thread(target=testMP.main)
    control_thread = threading.Thread(target=test_control.main)
Example #2
0
                                    brake=SerialPacket.BRAKE_NOBRAKE)

    def steer_right_test(test_data: Data):
        test_data.set_control_value(gear=SerialPacket.GEAR_NEUTRAL,
                                    speed=SerialPacket.SPEED_MIN,
                                    steer=SerialPacket.STEER_MAXRIGHT,
                                    brake=SerialPacket.BRAKE_NOBRAKE)

    test_data = Data()
    test_platform = CarPlatform('COM5', test_data)  # PLEASE CHECK YOUR COMPORT
    platform_thread = threading.Thread(target=test_platform.main)
    platform_thread.start()

    if test_data.read_packet.aorm == SerialPacket.AORM_AUTO:
        test_data.detected_mission_number = 1
        test_data.current_mode = 1
        print("mission num: ", test_data.detected_mission_number,
              test_data.current_mode)
        t = time.time()
        i = 1
        while True:
            print("read: ", test_data.car_platform_status())
            print("WRITE: ", test_data.write_packet.steer)
            if time.time() - t < 2:
                if i == 1:
                    steer_right_test(test_data)
                else:
                    steer_left_test(test_data)
            else:
                t = time.time()
                if i == 1: