Beispiel #1
0
def Setup_Photo_mode(drone):
    drone(stop_recording(cam_id=0)).wait()
    drone(set_autorecord(cam_id=0, state="inactive")).wait()
    drone(set_camera_mode(cam_id=0, value="photo")).wait()
    # For the file_format: jpeg is the only available option
    # dng is not supported in burst mode
    drone(
        set_exposure_settings(
            cam_id=0,
            mode="automatic_prefer_iso_sensitivity",
            shutter_speed="shutter_1_over_10000",
            iso_sensitivity="iso_1200",
            max_iso_sensitivity="iso_1200",
        )
    ).wait()


    drone(
        set_photo_mode(
            cam_id=0,
            mode="single",
            format="rectilinear",
            file_format="jpeg",
            burst="burst_14_over_4s",
            bracketing="preset_1ev",
            capture_interval=0.0,
        )
    ).wait()
Beispiel #2
0
    def __init__(self, D_IP, nm, lr):

        self.name = nm
        loc = "/home/spacetrex/code/Logs/"
        tck = str(round(time.time()))
        lf_nm = loc + nm + tck
        self.D_IP = D_IP
        #self.drone = olympe.Drone(self.D_IP, loglevel=7, logfile=open(lf_nm, "a+"))
        self.drone = olympe.Drone(self.D_IP, loglevel=0)
        self.drone.connection()
        self.drone(stop_recording(cam_id=0)).wait()
        self.drone(set_camera_mode(cam_id=0, value="recording")).wait()

        self.loop_rate = lr  # Set loop rate (Hz)
        self.X_tol = 0.5  # Position tolerance (m)
        self.V_tol = 0.1  # Velocity tolerance(m/s)
        self.yw_tol = 2.0 * pi / 180.0  # Yaw rate tolerance (rads)
        self.Tt_MX = 10  # Max tilt setting for yaw and pitch (deg)
        self.Tl_Mx = 4  # Max vertical speed (m/s)
        self.YR_MX = 22  # Max yaw rate (deg/s)
        self.GB_MX = 50  # Max gimbal rate (deg/s)
        self.thr_vec = [self.Tt_MX, self.Tt_MX, self.Tl_Mx,
                        self.YR_MX]  # Drone settings
        self.gn_mat = [3.6, 18.0, 3.6, 18.0, 5.0, 9.0, 2.0]  # Controller Gains
        #self.gn_mat = [6, 18, 4, 5, 11, 2]
        self.ANAFI_IP = D_IP  # Real Drone

        # Drone web server URL
        self.ANAFI_URL = "http://{}/".format(self.ANAFI_IP)
        self.ANAFI_MEDIA_API_URL = self.ANAFI_URL + "api/v1/media/medias/"

        # Set Rotation Speed
        maxYawRate = self.drone(MaxRotationSpeed(self.YR_MX)).wait()
        if maxYawRate.success():
            print(colored(("Max Yaw rate set to: ", self.YR_MX), "green"))
        elif maxYawRate.timedout():
            print(colored(("Yaw rate action failed"), "green"))
        else:
            print(colored(("Yaw rate action in progress"), "green"))

        # Set Gimbal Speed
        max_GMB_Rate = self.drone(
            set_max_speed(gimbal_id=0,
                          yaw=self.GB_MX / 5,
                          pitch=self.GB_MX,
                          roll=self.GB_MX / 5)).wait()
        if max_GMB_Rate.success():
            print(
                colored(("Max gimbal pitch rate set to: ", self.GB_MX),
                        "green"))
        elif max_GMB_Rate.timedout():
            print(colored(("gimbal rate action failed"), "green"))
        else:
            print(colored(("gimbal rate action in progress"), "green"))
Beispiel #3
0
 def setup_photo_mode(self):
     self.drone(set_camera_mode(cam_id=0, value="photo")).wait()
     # For the file_format: jpeg is the only available option
     self.drone(
         set_photo_mode(
             cam_id=0,
             mode="single",
             format="rectilinear",
             file_format="jpeg",
             burst="burst_14_over_1s",
             bracketing="preset_1ev",
             capture_interval=0.0,
         )).wait()
Beispiel #4
0
def setup_photo_burst_mode(drone):
    drone(set_camera_mode(cam_id=0, value="photo")).wait()
    # For the file_format: jpeg is the only available option
    # dng is not supported in burst mode
    drone(
        set_photo_mode(
            cam_id=0,
            mode="burst",
            format="rectilinear",
            file_format="jpeg",
            burst="burst_14_over_1s",
            bracketing="preset_1ev",
            capture_interval=0.0,
        )).wait()
Beispiel #5
0
def Setup_Video_mode(drone):
    drone(stop_recording(cam_id=0)).wait()
    drone(set_camera_mode(cam_id=0, value="recording")).wait()
    drone(set_autorecord(cam_id=0, state="inactive")).wait()
    

    drone(
        set_recording_mode(
            cam_id=0,
            mode="standard",
            resolution="res_uhd_4k",
            framerate="fps_30",
            hyperlapse="ratio_15",
        )
    ).wait(_timeout=2.).success()
Beispiel #6
0
def setup_photo_burst_mode(drone):
    drone(set_camera_mode(cam_id=0, value="photo")).wait()
    # For the file_format: jpeg is the only available option
    # dng is not supported in burst mode
    drone(
        set_photo_mode(
            cam_id=0,
            mode="burst",
            format="rectilinear",
            file_format="jpeg",
            burst="burst_14_over_1s",
            # the following parameters are ignored in photo burst mode but we
            # must provide valid values for them anyway
            bracketing="preset_1ev",
            capture_interval=5.0,
        )).wait()
Beispiel #7
0
print("*******************************************************************************************************")
print("AIMING CAMERA")
print("*******************************************************************************************************") 
drone(set_target(
    gimbal_id=0,
    control_mode="position",
    yaw_frame_of_reference="absolute",   # None instead of absolute
    yaw=0.0,
    pitch_frame_of_reference="absolute",
    pitch=-90.0,
    roll_frame_of_reference="absolute",     # None instead of absolute
    roll=0.0,
)).wait()
#Set camera mode
drone(
    set_camera_mode(cam_id=0, value=1)
).wait()
#Set photo mode
drone(
    set_photo_mode(cam_id=0, mode=0, format=0, file_format=0, burst=0, bracketing=0, capture_interval=0)
).wait()
# #Take picture
# drone(
#     take_photo(cam_id=0)
# ).wait()
print("*******************************************************************************************************")
print("TAKING PICTURE")
print("*******************************************************************************************************") 
photo_saved = drone(photo_progress(result="photo_saved", _policy="wait"))
drone(take_photo(cam_id=0)).wait()
photo_saved.wait()