Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to protocol v3 #123

Merged
merged 97 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
48c63dc
Remove 3.7, add 3.11 to supported python versions
sindrehan Feb 21, 2023
afa3bcd
Update blueye.protocol
sindrehan Feb 21, 2023
48d5b40
Add watchdog publisher for v3 protocol
sindrehan Feb 23, 2023
757bc65
Add telemetry client for v3 protocol
sindrehan Feb 23, 2023
eac78cf
Add client for controlling drone with v3 protocol
sindrehan Feb 23, 2023
3945d94
Update light control to v3
sindrehan Feb 23, 2023
ecbdab4
Update pose property to v3
sindrehan Feb 23, 2023
d8068bb
Update error_flags property to v3
sindrehan Feb 23, 2023
47231a6
Update active video streams property to v3
sindrehan Feb 23, 2023
3e55a98
Update water density control to v3 protocol
sindrehan Feb 23, 2023
49bb231
Update depth property to v3 protocol
sindrehan Feb 23, 2023
e903eaf
Update tilt control to v3 protocol
sindrehan Feb 23, 2023
5b66cef
Set lights in range 0..1 instead of 0..255
sindrehan Feb 23, 2023
50423d3
Update state of charge property to v3 protocol
sindrehan Feb 24, 2023
da093c5
Update motion control to v3 protocol
sindrehan Feb 24, 2023
5d7b6d4
Update auto depth control to v3 protocol
sindrehan Feb 24, 2023
b8e04d4
Update auto heading control to v3 protocol
sindrehan Feb 24, 2023
69ed5f3
Remove state watcher from motion class
sindrehan Feb 24, 2023
7399e23
Update recording control to v3 protocol
sindrehan Feb 24, 2023
8b2b59f
Add parameter to differentiate guestport cameras
sindrehan Feb 27, 2023
0facc2f
Add independent record control for gp camera
sindrehan Feb 27, 2023
1add9f9
Update record time property to v3 protocol
sindrehan Feb 27, 2023
82140d2
Remove UDP Client
sindrehan Feb 27, 2023
48eff6b
Set daemon=True for connection threads
sindrehan Feb 28, 2023
822dda7
Add request/response client for v3 protocol
sindrehan Feb 28, 2023
541e1ce
Organize new init/deinit of new clients
sindrehan Feb 28, 2023
634854d
Update ping function to v3 protocol
sindrehan Feb 28, 2023
bc9abc8
Add function for getting/setting camera parameters
sindrehan Feb 28, 2023
e90bc73
Update bitrate property to v3 protocol
sindrehan Feb 28, 2023
f1eed84
Fix mocks for new clients
sindrehan Feb 28, 2023
f52ca3f
Update code coverage action
sindrehan Feb 28, 2023
5cfecb1
Update exposure property to v3 protocol
sindrehan Mar 1, 2023
cc5e8f7
Update whitebalance property to v3 protocol
sindrehan Mar 1, 2023
da19f62
Update hue property to v3 protocol
sindrehan Mar 1, 2023
ebfa337
Update resolution property to v3 protocol
sindrehan Mar 1, 2023
cd4d76b
Update framerate property to v3 protocol
sindrehan Mar 1, 2023
e394e92
Update overlay properties to v3 protocol
sindrehan Mar 1, 2023
a6e3152
Update picture function to v3 protocol
sindrehan Mar 1, 2023
1e8a0be
Update system time property to v3 protocol
sindrehan Mar 1, 2023
38a8ea5
Fix timestamp creation
sindrehan Mar 1, 2023
1132974
Remove tcp_client and slave_mode
sindrehan Mar 1, 2023
242a411
Move connect request to ReqRep client
sindrehan Mar 10, 2023
b8cc750
Fix default timeout in connect function
sindrehan Mar 10, 2023
b948a95
Only start watchdog if in control of drone
sindrehan Mar 10, 2023
38ddeb8
Only set time/disable thrusters if in control
sindrehan Mar 11, 2023
f22f615
Add disconnect request
sindrehan Mar 11, 2023
cf2dcf5
Add property for getting connected clients
sindrehan Mar 11, 2023
749fa8b
Add property for getting client in control
sindrehan Mar 11, 2023
524304a
Add method for taking control from other clients
sindrehan Mar 11, 2023
5f8efc7
Add option to auto take control on connect
sindrehan Mar 11, 2023
8365e3d
Publish watchdog even if not in control
sindrehan Apr 11, 2023
fa33f7f
Adjust timeout for sending control messages
sindrehan Apr 11, 2023
5de866b
Remove unused import
sindrehan Apr 12, 2023
7264820
Add timeout to take_control function
sindrehan Apr 12, 2023
dc1b0dc
Increase default timeout for connect
sindrehan Apr 12, 2023
02fe57d
Forward underlying exception with ConnectionError
sindrehan Apr 12, 2023
14e0b48
Add property for still picture stream bitrate
sindrehan Apr 12, 2023
b9cafca
Add function for setting telemetry frequency
sindrehan Apr 12, 2023
f6a4d63
Wrap doc string
sindrehan Apr 14, 2023
cbb81e5
Fix codecov flags
sindrehan May 9, 2023
4bbba49
Remove unused imports
sindrehan May 9, 2023
19deddb
Document state variable
sindrehan May 9, 2023
4b3a529
Prefix "private" variables with underscore
sindrehan May 9, 2023
f5327c8
Remove connection check before verifying version
sindrehan May 9, 2023
b77df1b
Check that connected drone runs v3.1 or newer
sindrehan May 9, 2023
4969abe
Fix typo in camera parameters
sindrehan May 9, 2023
909d1ee
Make all telemetry functions return an Optional
sindrehan May 9, 2023
a67123f
Document empty excepts
sindrehan May 9, 2023
38d1ea2
Only include sdk in one way for clarity
sindrehan May 9, 2023
548c681
Add callbacks for telemetry messages
johannesschrimpf May 15, 2023
aa726f5
Use fullmatch to match callback types
johannesschrimpf May 15, 2023
52a0a5a
Support callbacks for raw data
johannesschrimpf May 15, 2023
2daf1b8
Add sleep and fix depth printing in print_status.py
johannesschrimpf May 15, 2023
b71ea68
Add more examples
johannesschrimpf May 15, 2023
917e797
Import annotations from __future__
sindrehan May 26, 2023
296be6b
Add missing import
sindrehan May 26, 2023
eca41b8
Use class as key in _state dictionary
sindrehan May 26, 2023
e711902
Disregard telemetry messages we're unable to parse
sindrehan May 26, 2023
178b3d6
Update blueye.protocol
sindrehan May 26, 2023
bdca510
Import Callable from typing
sindrehan May 26, 2023
b2550d7
Specify filter with list of types instead of regex
sindrehan May 26, 2023
08f75e2
Fix formatting
sindrehan May 26, 2023
689ed57
Remove unused import
sindrehan May 26, 2023
bd87cac
Extract response waiting to separate function
sindrehan May 31, 2023
0ea13b8
Bump major version
sindrehan Jun 2, 2023
1677117
Add documentation for subscribing to telemetry
sindrehan Jun 2, 2023
aaf13c9
Make get_client_info a static method
sindrehan Jun 2, 2023
63df27f
Rename AutoConnect to auto_connect
sindrehan Jun 2, 2023
f89ecb2
Move SoC property to Battery class
sindrehan Jun 2, 2023
eea1119
Move telemetry control to separate class
sindrehan Jun 20, 2023
25d090e
Add function for getting any telemetry message
sindrehan Jun 20, 2023
bf14633
Bring back NoConnectionClient
sindrehan Jun 20, 2023
4daf061
Add v2 migration guide
sindrehan Jun 20, 2023
4aeea7e
Add docs for protobuf protocol
sindrehan Jun 20, 2023
7557023
Change required Blunux version to v3.2
sindrehan Jun 23, 2023
dce0d34
Use Telemetry class instead of telemetry_watcher
sindrehan Jun 23, 2023
79f9eff
Handle None from telemetry.get() properly
sindrehan Jul 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python: ["3.7", "3.8", "3.9", "3.10"]
python: ["3.8", "3.9", "3.10", "3.11"]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
Expand All @@ -23,17 +26,15 @@ jobs:
run: poetry install
- name: Run tests
run: poetry run pytest -k "not connected_to_drone" --cov-report=xml --cov blueye
- name: Upload coverage
run: |
curl -s https://codecov.io/bash |\
bash -s -- -F \
$(echo ${{ matrix.os}} |\
cut -d "-" -f 1 |\
sed "s/$/_python${{ matrix.python }}/" |\
sed "s/\.//")
shell: bash
env:
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS,PYTHON
fail_ci_if_error: false
files: ./coverage.xml
flags: ${{ matrix.os }}_${{ matrix.python }}
name: codecov-umbrella
continue-on-error: true

CheckFormatting:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ repos:
rev: stable
hooks:
- id: black
language_version: python3.7
language_version: python3.8
1 change: 0 additions & 1 deletion blueye/sdk/__init__.py
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
28 changes: 28 additions & 0 deletions blueye/sdk/battery.py
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
Loading