コード例 #1
0
ファイル: imu.py プロジェクト: simondlevy/Hackflight
    def __init__(self, gcs, simulation=False, vehicleScale=0.1, updateMsec=10):

        Dialog.__init__(self, gcs)

        # Vehicle dimensions
        W = vehicleScale
        D = vehicleScale / 2
        L = vehicleScale * 2

        # Update period
        self.update_msec = updateMsec

        # Let these be in World-coordinates (worldview-matrix already applied)
        # In right-handed, counter-clockwise order
        (self.vehicle_points, self.vehicle_faces,
         self.vehicle_face_colors) = get_vehicle(W, D, L)

        # Assume no angles to start
        self.roll_pitch_yaw = None

        # Rotation matrices
        self.pitchrot = np.eye(3)
        self.yawrot = np.eye(3)
        self.rollrot = np.eye(3)

        self.simulation = simulation
        self.running = False
コード例 #2
0
ファイル: imu.py プロジェクト: sujanabasnet/Hackflight
    def __init__(self, gcs, simulation=False):

        Dialog.__init__(self, gcs)

        # Vehicle dimensions
        W = VEHICLE_SCALE
        D = VEHICLE_SCALE / 2
        L = VEHICLE_SCALE * 2

        # Let these be in World-coordinates (worldview-matrix already applied)
        # In right-handed, counter-clockwise order
        (self.vehicle_points,
         self.vehicle_faces,
         self.vehicle_face_colors) = get_vehicle(W, D, L)

        # Assume no angles to start
        self.roll_pitch_yaw = None

        # Rotation matrices
        self.pitchrot = _eye3()
        self.yawrot = _eye3()
        self.rollrot = _eye3()

        self.simulation = simulation
        self.running = False
コード例 #3
0
ファイル: setup.py プロジェクト: simondlevy/hackflight
    def __init__(self, driver, simulation=False):

        Dialog.__init__(self, driver)

        # Vehicle dimensions
        W = VEHICLE_SCALE
        D = VEHICLE_SCALE / 2
        L = VEHICLE_SCALE * 2

        #Let these be in World-coordinates (worldview-matrix already applied)
        ####In right-handed, counter-clockwise order
        self.vehicle_points, self.vehicle_faces, self.vehicle_face_colors = get_vehicle(W, D, L)

        # Assume no angles to start
        self.yaw_pitch_roll = None

        # Rotation matrices
        self.pitchrot = np.eye(3)
        self.yawrot = np.eye(3)
        self.rollrot = np.eye(3)

        self.simulation = simulation
        self.running = False
コード例 #4
0
            speed = 0
        if not isinstance(turn, int) or turn < -100 or turn > 100:
            turn = 0
        if not isinstance(lights, bool):
            lights = False
        
        vehicle.set_speed(speed / 100, turn / 100)
        vehicle.set_lights(lights)

        telem_dict = {
            'b': vehicle.get_battery()
        }
        
        return (webpage.OK_200, json.dumps(telem_dict).encode('utf-8'))

    server.register_post_handler(b'/control', control_vehicle)
    

    return server


if __name__ == "__main__":
    VEHICLE = vehicle.get_vehicle()
    host_network("tiny_trak")

    WEBPAGE = create_webpage(80, VEHICLE)

    while(True):
        WEBPAGE.update()