-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
5,038 additions
and
1,381 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ repos: | |
rev: stable | ||
hooks: | ||
- id: black | ||
language_version: python3.7 | ||
language_version: python3.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
from .camera import DepthUnitOverlay, FontSizeOverlay, LogoOverlay, TemperatureUnitOverlay | ||
from .constants import WaterDensities | ||
from .drone import Drone | ||
from .utils import open_local_documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING, Optional | ||
|
||
import blueye.protocol | ||
|
||
# Necessary to avoid cyclic imports | ||
if TYPE_CHECKING: | ||
from .drone import Drone | ||
|
||
|
||
class Battery: | ||
def __init__(self, parent_drone: Drone): | ||
self._parent_drone = parent_drone | ||
|
||
@property | ||
def state_of_charge(self) -> Optional[float]: | ||
"""Get the battery state of charge | ||
*Returns*: | ||
* Current state of charge of the drone battery (0..1) | ||
""" | ||
battery_tel = self._parent_drone.telemetry.get(blueye.protocol.BatteryTel) | ||
if battery_tel is not None: | ||
return battery_tel.battery.level | ||
else: | ||
return None |
Oops, something went wrong.