Configure drone parameters
There are settings on the drone that are remotely configurable from the Blueye mobile app. These can also be set directly from the SDK.
Configure time and date
The drone does not keep track of time internally. The SDK sets the time on the drone automatically when you connect initially. But you can also configure time and date manually like this
import time
from blueye.sdk import Drone
myDrone = Drone()
time_to_set_on_drone = int(time.time()) # Unix Timestamp
myDrone.config.set_drone_time(time_to_set_on_drone)
or if we for example want to offset the drone time 5 hours relative to our current system time we can do something like this:
from blueye.sdk import Drone
from datetime import timezone, timedelta, datetime
myDrone = Drone()
offset_in_hours = timedelta(hours=5)
equivalent_timezone = timezone(offset_in_hours)
unix_timestamp = datetime.now(tz=equivalent_timezone).timestamp()
myDrone.config.set_drone_time(int(unix_timestamp))
Calibrate pressure sensor for water density
The water density on the drone default to a reasonable density for salt water: 1025 grams per liter. For more accurate depth readings, the water density can be configured manually to suit your local conditions
from blueye.sdk import Drone, WaterDensities
myDrone = Drone()
# Salt water
myDrone.config.water_density = WaterDensities.salty # 1025 g/L
# Brackish water
myDrone.config.water_density = WaterDensities.brackish # 1011 g/L
# Fresh water
myDrone.config.water_density = WaterDensities.fresh # 997 g/L
# Can also be set to arbitrary values
myDrone.config.water_density = 1234
Configure camera parameters
There are several camera parameters that can be set. For a full list of camera parameters and their possible values see the camera reference section.
To change a single parameter you can set it directly:
from blueye.sdk import Drone
myDrone = Drone()
myDrone.camera.bitrate = 8_000_000 # 8 Mbit bitrate
To change multiple parameters at once, use the configure() context manager. This batches all changes into a single request, avoiding multiple pipeline restarts:
import blueye.protocol as bp
from blueye.sdk import Drone
myDrone = Drone()
with myDrone.camera.configure(timeout=5.0) as params:
params.stream_resolution = bp.Resolution.RESOLUTION_FULLHD_1080P
params.framerate = bp.Framerate.FRAMERATE_FPS_30
params.h264_bitrate = 4_000_000
# All changes are sent in one request when the block exits.
# If an exception occurs inside the block, changes are discarded.
The timeout parameter (default: 0.5s) controls how long to wait for the drone to respond. Increase it when changing parameters that trigger pipeline restarts (e.g. codec, resolution).
Due to a bug in the camera streaming on the drone a camera stream has to have been opened at least once before camera parameters can be set on the drone, see issue #67. For instructions on how to start a video stream see, the Quick Start Guide.