blueye.sdk.drone
drone
Classes:
-
Config–Handles the configuration settings for the Blueye drone.
-
Drone–A class providing an interface to a Blueye drone's functions.
-
Telemetry–Handles the telemetry messages for the Blueye drone.
Config
Config(parent_drone: 'Drone')
Handles the configuration settings for the Blueye drone.
Parameters:
-
parent_drone(Drone) –The parent drone instance.
Methods:
-
get_water_density–Get the water density this SDK instance last sent to the drone.
-
set_drone_time–Set the system time for the drone.
-
set_water_density–Set the water density the drone uses to convert pressure to depth.
Source code in blueye/sdk/drone.py
55 56 57 58 59 60 61 62 | |
get_water_density
get_water_density() -> Optional[float]
Get the water density this SDK instance last sent to the drone.
The drone does not report the density it uses, and the Blueye app sends its own value
whenever it takes control, so the drone's value cannot be read here. This method returns
what set_water_density sent, or None if nothing has been sent in this session.
The drone starts with salt water, 1025 grams per liter, until a client sets another value.
Returns:
-
Optional[float]–The water density in grams per liter last set through this object, or
None.
Source code in blueye/sdk/drone.py
64 65 66 67 68 69 70 71 72 73 74 75 76 | |
set_drone_time
set_drone_time(time: int)
Set the system time for the drone.
This method is used to set the system time for the drone. The argument time is expected to
be a Unix timestamp (i.e., the number of seconds since the epoch).
Parameters:
-
time(int) –The Unix timestamp to set.
Source code in blueye/sdk/drone.py
97 98 99 100 101 102 103 104 105 106 | |
set_water_density
set_water_density(density: float)
Set the water density the drone uses to convert pressure to depth.
The drone starts with salt water, 1025 grams per liter. The Blueye app sends the salinity chosen by the pilot each time it takes control, so a value set here lasts until the app or another client sends a new one. The drone rescales its current depth reading when the density changes.
The WaterDensities class contains typical densities for salty-, brackish-, and fresh water (these are the same values that the Blueye app uses).
Parameters:
-
density(float) –The water density in grams per liter.
Source code in blueye/sdk/drone.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
Drone
Drone(
ip="192.168.1.101",
auto_connect=True,
timeout=10,
disconnect_other_clients=False,
connect_as_observer=False,
**connect_args: Dict[str, Any]
)
A class providing an interface to a Blueye drone's functions.
Automatically connects to the drone using the default IP when instantiated. This behavior can
be disabled by setting auto_connect=False.
Parameters:
-
ip(str, default:'192.168.1.101') –The IP address of the drone.
-
auto_connect(bool, default:True) –Whether to automatically connect to the drone.
-
timeout(int, default:10) –The timeout for the connection attempt.
-
disconnect_other_clients(bool, default:False) –Whether to disconnect other clients.
-
connect_as_observer(bool, default:False) –Whether to connect as an observer.
-
**connect_args(Dict[str, Any], default:{}) –Additional keyword arguments to pass to the
connectmethod.
Methods:
-
__enter__–Use the drone in a
withblock, see__exit__. -
__exit__–Disconnect when the
withblock ends, however it ends. -
connect–Establish a connection to the drone.
-
disconnect–Disconnects the connection, allowing another client to take control of the drone.
-
get_active_video_streams–Get the number of currently active connections to the video stream.
-
get_altitude–Get the current altitude in meters.
-
get_attitude–Get the current orientation of the drone as signed angles.
-
get_client_in_control–Get the client ID of the client in control of the drone.
-
get_connected_clients–Get a list of connected clients.
-
get_depth–Get the current depth in meters.
-
get_depth_sensor_type–Get the type of depth sensor connected to the drone.
-
get_dive_time–Get the amount of time the drone has been submerged.
-
get_drone_info–Get the identity and hardware information the drone publishes about itself.
-
get_error_flags–Get the error flags.
-
get_guest_ports–Get the state of every guest port on the drone.
-
get_lights–Get the intensity of the drone lights.
-
get_model–Get the model of the connected drone.
-
get_pose–Get the current orientation of the drone.
-
get_power_source–Get how the drone is powered.
-
get_water_temperature–Get the water temperature in degrees Celsius.
-
has_attitude–Check whether the drone can estimate its attitude.
-
is_jetson_platform–Check if the connected drone is built on the NVIDIA Jetson platform.
-
ping–Ping the drone.
-
set_lights–Set the intensity of the drone lights.
-
take_control–Take control of the drone, disconnecting other clients.
Attributes:
-
battery–Battery state, see
Battery. -
camera–The main camera: recording, pictures and camera parameters.
-
client_id(int) –The id the drone assigned to this client when connecting,
Nonebefore that. -
config–Drone time and water density, see
Config. -
connected–Whether the drone is connected.
-
cv_models–Computer vision models installed on the drone.
-
external_camera(Optional[GuestPortCamera]) –Camera on a guest port, or
Noneif none has been discovered. -
external_light(Optional[GuestPortLight]) –Light on a guest port, or
Noneif none has been discovered. -
features(List[str]) –Optional hardware the drone reported when connecting, as a list of names.
-
gripper(Optional[Gripper]) –Gripper on a guest port, or
Noneif none has been discovered. -
in_control(bool) –Whether this client held control when it connected or last took control.
-
laser(Optional[Laser]) –Scaling laser on a guest port, or
Noneif none has been discovered. -
legacy_logs–Logs in the CSV format of Blunux versions before 3.0.
-
logs–The dive logs stored on the drone, see
Logs. -
mission–Loading and running missions, see
Mission. -
motion–Thruster input and the auto modes, see
Motion. -
peripherals(Optional[List[Peripheral]]) –The peripherals connected to the drone's guest ports.
-
serial_number(str) –The drone's serial number. Set when connecting.
-
servo(Optional[GenericServo]) –Generic servo on a guest port, or
Noneif none has been discovered. -
skid_servo(Optional[SkidServo]) –Multibeam (skid) servo on a guest port, or
Noneif none has been discovered. -
software_version(str) –The full Blunux version string, such as
"5.2.212-wrynose-jetson-dev". -
software_version_short(str) –The Blunux version number without the build suffix, such as
"5.2.212". -
telemetry–Telemetry messages, callbacks and publish rates.
-
uuid(str) –The drone's hardware id. Set when connecting.
Source code in blueye/sdk/drone.py
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | |
camera
instance-attribute
camera = Camera(self, is_guestport_camera=False)
client_id
instance-attribute
client_id: int = None
The id the drone assigned to this client when connecting, None before that.
connected
instance-attribute
connected = False
Whether the drone is connected.
True between a successful connect and
disconnect.
cv_models
instance-attribute
cv_models = CvModels(self)
Computer vision models installed on the drone.
See CvModels.
external_camera
instance-attribute
external_camera: Optional[GuestPortCamera] = None
Camera on a guest port, or None if none has been discovered.
See peripherals.
external_light
instance-attribute
external_light: Optional[GuestPortLight] = None
Light on a guest port, or None if none has been discovered.
See peripherals.
features
instance-attribute
features: List[str]
Optional hardware the drone reported when connecting, as a list of names.
"tilt" on every model except the original Pioneer, "gpdrone" on drones with guest
ports, and "gplight", "gpcam" and "gripper" when such a device is attached. The
Tilt methods raise RuntimeError without "tilt". Not
updated while connected. Empty when the drone could not read its hardware within its own
5 s limit and answered with default information instead. Use
peripherals for the attached devices.
gripper
instance-attribute
gripper: Optional[Gripper] = None
Gripper on a guest port, or None if none has been discovered.
See peripherals.
in_control
instance-attribute
in_control: bool = False
Whether this client held control when it connected or last took control.
Set by connect and
take_control. Not updated when the drone hands
control to another client; compare
get_client_in_control with
client_id for the current state.
laser
instance-attribute
laser: Optional[Laser] = None
Scaling laser on a guest port, or None if none has been discovered.
See peripherals.
legacy_logs
instance-attribute
legacy_logs = LegacyLogs(self)
Logs in the CSV format of Blunux versions before 3.0.
See LegacyLogs.
peripherals
instance-attribute
peripherals: Optional[List[Peripheral]] = None
The peripherals connected to the drone's guest ports.
None until the drone has reported its guest ports (through DroneInfoTel), and an
empty list when the drone reports no peripherals.
The drone can report its guest ports after connect() returns, so the shortcuts below
can still be None right after connecting. While peripherals is None, a None
shortcut means "not reported yet" rather than "not attached". Every shortcut is None
again after disconnect().
serial_number
instance-attribute
serial_number: str
The drone's serial number. Set when connecting.
servo
instance-attribute
servo: Optional[GenericServo] = None
Generic servo on a guest port, or None if none has been discovered.
See peripherals.
skid_servo
instance-attribute
skid_servo: Optional[SkidServo] = None
Multibeam (skid) servo on a guest port, or None if none has been discovered.
See peripherals.
software_version
instance-attribute
software_version: str
The full Blunux version string, such as "5.2.212-wrynose-jetson-dev".
Set when connecting.
software_version_short
instance-attribute
software_version_short: str
The Blunux version number without the build suffix, such as "5.2.212".
Set when connecting.
telemetry
instance-attribute
telemetry = Telemetry(self)
Telemetry messages, callbacks and publish rates.
See Telemetry.
uuid
instance-attribute
uuid: str
The drone's hardware id. Set when connecting.
__enter__
__enter__() -> Drone
Use the drone in a with block, see __exit__.
Source code in blueye/sdk/drone.py
909 910 911 | |
__exit__
__exit__(exc_type, exc_value, traceback)
Disconnect when the with block ends, however it ends.
Usage::
with Drone() as drone:
drone.motion.set_surge(0.5)
...
# Thrusters zeroed and the drone told that we left, even after an exception
Source code in blueye/sdk/drone.py
913 914 915 916 917 918 919 920 921 922 923 924 | |
connect
connect(
client_info: ClientInfo = None,
timeout: float = 4,
disconnect_other_clients: bool = False,
connect_as_observer: bool = False,
log_notifications: bool = False,
)
Establish a connection to the drone.
Spawns several threads for receiving telemetry, sending control messages, and publishing watchdog messages.
A watchdog message from the client in control arms the thrusters. When this connection receives control during setup, the SDK zeroes the thruster setpoints and synchronizes the drone's clock. An observer connection does neither and is excluded from control handover. Observer mode does not prevent setters from sending commands.
Parameters:
-
client_info(ClientInfo, default:None) –Information about the client connecting. If None, the SDK supplies its version and uses Python's
platformmodule for the OS and hostname shown in the app. -
timeout(float, default:4) –Seconds to wait for connection.
-
disconnect_other_clients(bool, default:False) –If True, disconnect clients until the drone reports that we are in control.
-
connect_as_observer(bool, default:False) –If True, the client will not be promoted to in control of the drone.
-
log_notifications(bool, default:False) –If True, the notifications will be logged using the logging module.
Raises:
-
ConnectionError–If the connection attempt fails.
-
RuntimeError–If the Blunux version of the connected drone is too old.
Source code in blueye/sdk/drone.py
676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | |
disconnect
disconnect(timeout: float = 1.0)
Disconnects the connection, allowing another client to take control of the drone.
The drone keeps the last motion input it received until a new one arrives or its watchdog times out, and on a handover to another client the watchdog never times out. So when this client is in control, every setpoint is zeroed and sent before the drone is told that the client is leaving.
Does nothing when there is no connection, such as after a failed connect(), so it is
safe in a finally block.
Parameters:
-
timeout(float, default:1.0) –Seconds to wait for the zero setpoint and any other queued control message to go out before the disconnect request is sent.
Source code in blueye/sdk/drone.py
839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 | |
get_active_video_streams
get_active_video_streams() -> Dict[str, int]
Get the number of currently active connections to the video stream.
Every RTSP session counts, whether it comes from the Blueye app, GStreamer, VLC or OpenCV. A session counts from the moment the player sets it up. It stops counting when the player closes the main camera stream, or when the session times out, about 5 seconds after the player stops keeping it alive; the guest port camera stream only drops sessions on the timeout. The drone publishes the count once a second. Each stream accepts 4 sessions; a player that asks for a fifth is refused, see Live video streams.
Returns:
-
Dict[str, int]–A dictionary with the number of active connections to the main and guestport video streams.
Source code in blueye/sdk/drone.py
1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 | |
get_altitude
get_altitude() -> Optional[float]
Get the current altitude in meters.
If the drone has a DVL or a positioning system with a valid reading, this method will return the current altitude.
Returns:
-
Optional[float]–The altitude in meters above the bottom.
Source code in blueye/sdk/drone.py
1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 | |
get_attitude
get_attitude() -> Optional[Dict[str, float]]
Get the current orientation of the drone as signed angles.
Unlike get_pose, the angles are returned as the drone reports them: 0 when the drone is
level and pointing north, with small deviations keeping their sign. A roll to the right and
a pitch with the nose up are positive. This is the natural form when working with the roll
and pitch input on the Blueye X7.
Returns:
-
Optional[Dict[str, float]]–A dictionary with roll, pitch, and yaw in degrees, from -180 to 180. None if no attitude telemetry has been received.
Source code in blueye/sdk/drone.py
1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 | |
get_client_in_control
get_client_in_control() -> Optional[int]
Get the client ID of the client in control of the drone.
Returns:
-
Optional[int]–The client ID in control, 0 if nobody holds control, or None if client-list telemetry has not arrived.
Source code in blueye/sdk/drone.py
940 941 942 943 944 945 946 947 948 949 950 951 | |
get_connected_clients
get_connected_clients() -> Optional[List[ConnectedClient]]
Get a list of connected clients.
Returns:
-
Optional[List[ConnectedClient]]–A list of connected clients, or None if client-list telemetry has not arrived.
Source code in blueye/sdk/drone.py
926 927 928 929 930 931 932 933 934 935 936 | |
get_depth
get_depth() -> Optional[float]
Get the current depth in meters.
Returns:
-
Optional[float]–The depth in meters of water column.
Source code in blueye/sdk/drone.py
1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 | |
get_depth_sensor_type
get_depth_sensor_type() -> Optional[PressureSensorType]
Get the type of depth sensor connected to the drone.
Returns:
-
Optional[PressureSensorType]–The depth sensor type, or None if no
DroneInfomessage has been received yet.
Source code in blueye/sdk/drone.py
1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 | |
get_dive_time
get_dive_time() -> Optional[int]
Get the amount of time the drone has been submerged.
The drone starts incrementing this value when the depth is above 250 mm.
Returns:
-
Optional[int]–The time in seconds the drone has been submerged.
Source code in blueye/sdk/drone.py
1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 | |
get_drone_info
get_drone_info() -> Optional[DroneInfo]
Get the identity and hardware information the drone publishes about itself.
This is the DroneInfo message from the DroneInfoTel telemetry message. It carries the
drone model, serial numbers, the depth sensor type, the power source, the installed
computer vision models, the guest port configuration and, on the X3 Ultra and X7, the
main camera calibration.
Returns:
-
Optional[DroneInfo]–The latest
DroneInfomessage, or None if it has not been received yet.
Source code in blueye/sdk/drone.py
955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 | |
get_error_flags
get_error_flags() -> Optional[Dict[str, bool]]
Get the error flags.
The flags are the fields of the
ErrorFlags message, true while the
error is present. The IMU flags in
IMU_ERROR_FLAGS are left out on drones running
Blunux older than 5.2, which do not report them.
Returns:
-
Optional[Dict[str, bool]]–The error flags as bools in a dictionary, or None if no
ErrorFlagsTelmessage has been received.
Source code in blueye/sdk/drone.py
1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 | |
get_guest_ports
get_guest_ports() -> Optional[List[GuestPort]]
Get the state of every guest port on the drone.
Each entry carries the port number, the interfaces the port provides, the connector error
the drone reports for it (if any), and the peripherals discovered on it. A port with
nothing plugged in reports GUEST_PORT_ERROR_NOT_CONNECTED and no devices.
Returns:
-
Optional[List[GuestPort]]–One GuestPort per port the drone reports, or
Noneif no guest port information has been received from the drone yet.
Source code in blueye/sdk/drone.py
1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 | |
get_lights
get_lights() -> Optional[float]
Get the intensity of the drone lights.
Returns:
-
Optional[float]–The intensity of the drone light (0..1).
Noneif no telemetry message has been received.
Source code in blueye/sdk/drone.py
1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 | |
get_model
get_model() -> Optional[Model]
Get the model of the connected drone.
The model is read from the DroneInfoTel telemetry message. The HTTP drone_info
endpoint also reports a model_name string, but its formatting varies between drones, so
it is not used.
Returns:
-
Optional[Model]–The drone model, or None if no
DroneInfomessage has been received yet.
Source code in blueye/sdk/drone.py
971 972 973 974 975 976 977 978 979 980 981 982 983 984 | |
get_pose
get_pose() -> Optional[Dict[str, float]]
Get the current orientation of the drone.
The angles are wrapped to 0..359, so a drone rolled slightly to the left reports a roll
just below 360. Use get_attitude for signed angles.
Returns:
-
Optional[Dict[str, float]]–A dictionary with roll, pitch, and yaw in degrees, from 0 to 359. None if no attitude telemetry has been received.
Source code in blueye/sdk/drone.py
1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 | |
get_power_source
get_power_source() -> Optional[PowerSource]
Get how the drone is powered.
The X7 runs two batteries in parallel, the other models a single battery. Drones running
a Blunux version that predates this field report POWER_SOURCE_UNSPECIFIED.
Returns:
-
Optional[PowerSource]–The power source, or None if no
DroneInfomessage has been received yet.
Source code in blueye/sdk/drone.py
986 987 988 989 990 991 992 993 994 995 996 997 998 | |
get_water_temperature
get_water_temperature() -> Optional[float]
Get the water temperature in degrees Celsius.
Returns:
-
Optional[float]–The water temperature in degrees Celsius.
Source code in blueye/sdk/drone.py
1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 | |
has_attitude
has_attitude() -> Optional[bool]
Check whether the drone can estimate its attitude.
The drone estimates roll, pitch and yaw from any of its IMUs that works. Without one it
sets the imu_attitude error flag and can only be driven by hand: it switches every auto
mode off and refuses to turn one on, aborts a running mission, reports its attitude as
NaN and turns camera tilt stabilization off. When an IMU recovers the flag is cleared,
but the drone does not turn the auto modes or tilt stabilization back on by itself.
Returns:
-
Optional[bool]–True if the drone has an attitude estimate, False if it has none, or None if no
ErrorFlagsTelmessage has been received.
Raises:
-
RuntimeError–If the connected drone is running Blunux older than 5.2, which does not report this.
Source code in blueye/sdk/drone.py
1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 | |
is_jetson_platform
is_jetson_platform() -> Optional[bool]
Check if the connected drone is built on the NVIDIA Jetson platform.
The X3 Ultra and X7 run on the Jetson platform and have the 4K camera, which differs
from the camera in the older models: it has no hue control, supports 60 fps and publishes
its calibration. See JETSON_MODELS.
Returns:
-
Optional[bool]–True for the X3 Ultra and X7, False for the other models, and None if the model is not known yet.
Source code in blueye/sdk/drone.py
1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 | |
ping
ping(timeout: float = 1.0)
Ping the drone.
Parameters:
-
timeout(float, default:1.0) –The timeout for the ping request.
Raises:
-
ResponseTimeout–If the drone does not respond within the timeout period.
Source code in blueye/sdk/drone.py
1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 | |
set_lights
set_lights(brightness: float)
Set the intensity of the drone lights.
Parameters:
-
brightness(float) –Set the intensity of the drone light (0..1).
Raises:
-
ValueError–If the brightness is not in the range (0..1).
Source code in blueye/sdk/drone.py
1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 | |
take_control
take_control(timeout=1)
Take control of the drone, disconnecting other clients.
Will disconnect other clients until the client is in control of the drone.
Parameters:
-
timeout(int, default:1) –The timeout for taking control.
Raises:
-
RuntimeError–If the client could not take control of the drone in the given time.
Source code in blueye/sdk/drone.py
1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 | |
Telemetry
Telemetry(parent_drone: 'Drone')
Handles the telemetry messages for the Blueye drone.
Parameters:
-
parent_drone(Drone) –The parent drone instance.
Methods:
-
add_msg_callback–Register a telemetry message callback.
-
get–Get the latest telemetry message of the specified type.
-
remove_msg_callback–Remove a telemetry message callback.
-
set_msg_log_frequency–Set how often a specific telemetry message is written to the dive log.
-
set_msg_publish_frequency–Set the publishing frequency of a specific telemetry message.
Source code in blueye/sdk/drone.py
128 129 130 131 132 133 134 | |
add_msg_callback
add_msg_callback(
msg_filter: List[Message],
callback: Callable[[str, Message], None],
raw: bool = False,
**kwargs: Dict[str, Any]
) -> str
Register a telemetry message callback.
The callback is called each time a message of the type is received.
Parameters:
-
msg_filter(List[Message]) –A list of message types to register the callback for. E.g.,
[blueye.protocol.DepthTel, blueye.protocol.Imu1Tel]. If the list is empty, the callback will be registered for all message types. -
callback(Callable[[str, Message], None]) –The callback function. It should be minimal and return as fast as possible to not block the telemetry communication. It is called with two arguments, the message type name and the message object. An exception raised by the callback is logged and otherwise ignored, so it does not stop the telemetry thread or the other callbacks.
-
raw(bool, default:False) –Pass the raw data instead of the deserialized message to the callback function.
-
**kwargs(Dict[str, Any], default:{}) –Additional keyword arguments to pass to the callback function.
Returns:
-
str–The UUID of the callback.
Source code in blueye/sdk/drone.py
220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
get
get(
msg_type: Message, deserialize=True
) -> Optional[Message | bytes]
Get the latest telemetry message of the specified type.
Parameters:
-
msg_type(Message) –The message type to get. E.g., blueye.protocol.DepthTel.
-
deserialize(bool, default:True) –If True, the message will be deserialized before being returned. If False, the raw bytes will be returned.
Returns:
-
Optional[Message | bytes]–The latest message of the specified type, or None if no message has been received yet.
Source code in blueye/sdk/drone.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | |
remove_msg_callback
remove_msg_callback(callback_id: str) -> Optional[str]
Remove a telemetry message callback.
Parameters:
-
callback_id(str) –The callback ID from when the callback was registered.
Source code in blueye/sdk/drone.py
255 256 257 258 259 260 261 | |
set_msg_log_frequency
set_msg_log_frequency(msg: Message, frequency: float)
Set how often a specific telemetry message is written to the dive log.
The log frequency is independent of the publish frequency, so a message can be logged at a
higher rate than it is published to clients, or the other way around. Like the publish
frequency it is shared by every client and stays in effect until the drone reboots, with
one exception: on the X3 Ultra and X7 a multibeam recording raises the log rate of
PositionEstimateTel, AttitudeTel, CalibratedImuTel, CalibratedImuHpTel,
DepthTel and AltitudeTel while it runs and restores their defaults when it stops,
which replaces a rate set here for those six.
Parameters:
-
msg(Message) –The message to set the log frequency of. Needs to be one of the messages in blueye.protocol that end in Tel, e.g., blueye.protocol.Imu1Tel.
-
frequency(float) –The frequency in Hz. Must be greater than 0 and at most 100.
Raises:
-
ValueError–If the frequency is not greater than 0 and at most 100 Hz.
-
RuntimeError–If the connected drone is running a Blunux version older than 5.1.0, or if the drone refuses to change the log frequency, because the connected drone does not publish the message or logs it as its data arrives rather than on a timer.
Source code in blueye/sdk/drone.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
set_msg_publish_frequency
set_msg_publish_frequency(msg: Message, frequency: float)
Set the publishing frequency of a specific telemetry message.
The drone has one telemetry publisher shared by every connected client, so the new rate also applies to the Blueye app and any other SDK client, and it stays in effect until the drone reboots. Set the rate back before exiting if other clients depend on it.
Only messages the drone publishes on a timer have a publish frequency. The messages in
EVENT_DRIVEN_TELEMETRY are published
when their data arrives, and messages from peripherals are only published while the
peripheral is connected.
Parameters:
-
msg(Message) –The message to set the frequency of. Needs to be one of the messages in blueye.protocol that end in Tel, e.g., blueye.protocol.DepthTel.
-
frequency(float) –The frequency in Hz. Must be greater than 0 and at most 100.
Raises:
-
ValueError–If the frequency is not greater than 0 and at most 100 Hz.
-
RuntimeError–If the drone refuses to change the frequency, because the message is published when its data arrives rather than on a timer, or because the connected drone does not publish it.
Source code in blueye/sdk/drone.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | |