Skip to content

Commit 82e8fbb

Browse files
committed
Merge branch 'master' into hs/adis
2 parents a0c25f3 + b032513 commit 82e8fbb

File tree

8 files changed

+255
-9
lines changed

8 files changed

+255
-9
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Compile TypeScript Protobuf Definitions
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
compile:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout source
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: "latest"
20+
registry-url: "https://registry.npmjs.org/"
21+
scope: "@blueyerobotics"
22+
23+
- name: Create tsconfig
24+
run: |
25+
cd protobuf_definitions
26+
echo '{
27+
"compilerOptions": {
28+
"target": "ES2020",
29+
"module": "CommonJS",
30+
"declaration": true,
31+
"outDir": "dist",
32+
"strict": true,
33+
"esModuleInterop": true
34+
},
35+
"include": ["./**/*.ts"]
36+
}' > tsconfig.json
37+
38+
- name: Create package
39+
run: |
40+
cd protobuf_definitions
41+
SHORT_SHA=${GITHUB_SHA::8}
42+
echo '{
43+
"name": "@blueyerobotics/protocol-definitions",
44+
"version": "3.2.0-'${SHORT_SHA}'",
45+
"license": "LGPL-3.0-only",
46+
"description": "TypeScript definitions for Blueye Robotics protocols",
47+
"repository": {
48+
"type": "git",
49+
"url": "https://github.com/BluEye-Robotics/ProtocolDefinitions.git"
50+
},
51+
"main": "dist/index.js",
52+
"types": "dist/index.d.ts",
53+
"files": ["dist"],
54+
"scripts": {
55+
"build": "tsc"
56+
},
57+
"dependencies": {
58+
"@bufbuild/protobuf": "^2.5.2"
59+
},
60+
"devDependencies": {
61+
"ts-proto": "^2.7.5",
62+
"typescript": "^5.8.3"
63+
}
64+
}' > package.json
65+
66+
- name: Install dependencies
67+
run: |
68+
sudo apt-get update
69+
sudo apt-get install -y protobuf-compiler
70+
cd protobuf_definitions
71+
npm install
72+
73+
- name: Generate
74+
run: |
75+
cd protobuf_definitions
76+
mkdir -p ./out/ &&
77+
protoc *.proto --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./out \
78+
--ts_proto_opt=outputIndex=true \
79+
--ts_proto_opt=globalThisPolyfill=true \
80+
--ts_proto_opt=useExactTypes=false
81+
82+
- name: Compile
83+
run: |
84+
cd protobuf_definitions
85+
npm run build
86+
87+
- name: Publish to npm
88+
run: |
89+
cp README.npm.md protobuf_definitions/README.md
90+
cd protobuf_definitions
91+
npm publish --access public --tag latest
92+
env:
93+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
94+
95+
- name: Check npm pack contents
96+
run: |
97+
cd protobuf_definitions
98+
npm pack
99+
tar -tzf *.tgz

Blueye.Protocol.Protobuf.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55
<GenerateDocumentationFile>true</GenerateDocumentationFile>
66
<LangVersion>13.0</LangVersion>
77
<PackageId>Blueye.Protocol.Protobuf</PackageId>
8-
<VersionPrefix>4.9.0</VersionPrefix>
8+
<VersionPrefix>5.0.0</VersionPrefix>
99
<Company>Blueye Robotics AS</Company>
1010
<ProduceReferenceAssembly>True</ProduceReferenceAssembly>
1111
<PackageDescription>Library with dotnet representation of the ProtocolDefinition protobuf files.</PackageDescription>
1212
<RepositoryUrl>https://github.com/BluEye-Robotics/ProtocolDefinitions</RepositoryUrl>
1313
</PropertyGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="Google.Protobuf" Version="3.30.2" />
17-
<PackageReference Include="Google.Protobuf.Tools" Version="3.30.2">
16+
<PackageReference Include="Google.Protobuf" Version="3.31.1" />
17+
<PackageReference Include="Google.Protobuf.Tools" Version="3.31.0">
1818
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1919
<PrivateAssets>all</PrivateAssets>
2020
</PackageReference>
21-
<PackageReference Include="Grpc.Tools" Version="2.71.0">
21+
<PackageReference Include="Grpc.Tools" Version="2.72.0">
2222
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
2323
<PrivateAssets>all</PrivateAssets>
2424
</PackageReference>

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ install(TARGETS blueyeprotocol
2929
EXPORT blueyeprotocol
3030
LIBRARY DESTINATION lib)
3131
install(FILES ${ProtoHeaders} DESTINATION include/blueyeprotocol)
32+
install(FILES ${ProtoFiles} DESTINATION include/blueyeprotocol/protobuf)
3233

3334
add_custom_target(pyblueyeprotocol
3435
DEPENDS ${PROTO_PY})

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,30 @@
55
This repository contains protocol definitions for interacting with the Blueye underwater drones.
66

77
## Protocol v2
8+
89
Drones running a Blunux version \< 3.0 will need to use the legacy protocol. [blueye.legacyprotocol](https://github.com/BluEye-Robotics/blueye.legacyprotocol) contains a Python package that is built on this protocol and simplifies its use.
910

1011
## Protocol v3
12+
1113
Version 3 of the Blueye communication protocol is based on [Protocol Buffers](https://developers.google.com/protocol-buffers).
1214

13-
The protobuf definitions are compiled to language specific libraries, and are available as a [NuGet package](https://github.com/BluEye-Robotics/ProtocolDefinitions/packages/1239508) and a [Python package](https://pypi.org/project/blueye.protocol/).
15+
The protobuf definitions are compiled to language specific libraries, and are available as a [NuGet package](https://github.com/BluEye-Robotics/ProtocolDefinitions/packages/1239508), [Python package](https://pypi.org/project/blueye.protocol/) and a [npm package](https://www.npmjs.com/package/@blueyerobotics/protocol-definitions).
1416

1517
Automatically generated documentation for the protocol format can be found [here](https://blueyebuildserver.blob.core.windows.net/protocoldefinitions/docs/protocol.html).
1618

1719
### Installation
20+
1821
#### OS X
22+
1923
```
2024
make
2125
make install PREFIX=/usr/local
2226
```
2327

2428
### Uninstall
29+
2530
#### OS X
31+
2632
```
2733
make uninstall PREFIX=/usr/local
2834
```

README.npm.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# @blueyerobotics/protocol-definitions
2+
3+
TypeScript protobuf definitions for Blueye Robotics protocols generated using [ts-proto](https://github.com/stephenh/ts-proto).
4+
5+
## Installation
6+
7+
```bash
8+
npm install @blueyerobotics/protocol-definitions
9+
```
10+
11+
## Usage
12+
13+
```ts
14+
import { blueye } from "@blueyerobotics/protocol-definitions";
15+
16+
// Create a new GetBatteryReq message
17+
const request = blueye.protocol.GetBatteryReq.create();
18+
19+
// Serialize the message to a Uint8Array (binary)
20+
const binary = blueye.protocol.GetBatteryReq.encode(request).finish();
21+
22+
// ...
23+
24+
// For demonstration, we will simulate a response from the device
25+
const response = blueye.protocol.GetBatteryRep.create({
26+
battery: {
27+
level: 85,
28+
voltage: 12.5,
29+
temperature: 25,
30+
},
31+
});
32+
33+
const binaryResponse = blueye.protocol.GetBatteryRep.encode(response).finish();
34+
35+
// Decode a binary response back into a message
36+
const decoded = blueye.protocol.GetBatteryRep.decode(binaryResponse);
37+
38+
// Access fields
39+
console.log(decoded.battery?.level);
40+
```

protobuf_definitions/control.proto

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,12 @@ message StartDiveCtrl {
215215
// at which point the user exited the dive view.
216216
message EndDiveCtrl {
217217
}
218+
219+
// Message sent when the user wants to format a connected removable storage device.
220+
//
221+
// The app will receive a RemovableStorageTel message with information about the newly formatted drive.
222+
//
223+
// Warning: The drone will delete any partitions and format the drive with a single exFat partition.
224+
// Any data on the drive will be lost.
225+
message FormatRemovableStorageDeviceCtrl {
226+
}

protobuf_definitions/message_formats.proto

Lines changed: 83 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,28 @@ message BinlogRecord {
2121
google.protobuf.Timestamp clock_monotonic = 3; // Posix CLOCK_MONOTONIC timestamp.
2222
}
2323

24+
// Log entry
25+
//
26+
// Used to store ROS log entries in the bez file
27+
message LogEntry {
28+
enum LogLevel {
29+
LOG_LEVEL_UNSPECIFIED = 0; // Unspecified log level.
30+
LOG_LEVEL_TRACE = 1; // Trace log level.
31+
LOG_LEVEL_DEBUG = 2; // Debug log level.
32+
LOG_LEVEL_INFO = 3; // Info log level.
33+
LOG_LEVEL_WARNING = 4; // Warning log level.
34+
LOG_LEVEL_ERROR = 5; // Error log level.
35+
LOG_LEVEL_CRITICAL = 6; // Critical log level.
36+
}
37+
google.protobuf.Timestamp timestamp = 1; // Timestamp of the log entry.
38+
string process_name = 2; // Name of the process that generated the log entry.
39+
uint64 process_id = 3; // Process ID of the log entry.
40+
uint64 thread_id = 4; // Thread ID of the log entry.
41+
string source = 5; // Source of the log entry (specific class or named logger).
42+
LogLevel level = 6; // Log level, info, warning, error, etc.
43+
string message = 7; // Log message.
44+
}
45+
2446
// Motion input from client.
2547
//
2648
// Used to indicate the desired motion in each direction.
@@ -376,6 +398,20 @@ message Attitude {
376398
float yaw = 3; // Yaw angle (-180°..180°).
377399
}
378400

401+
// Location source used in magnetic declination look-up.
402+
enum LocationSource {
403+
LOCATION_SOURCE_UNSPECIFIED = 0; // The position is not set.
404+
LOCATION_SOURCE_USER = 1; // Typically pilot device GPS.
405+
LOCATION_SOURCE_DRONE = 2; // Blueye GPS, DVL, or a USBL system.
406+
}
407+
408+
// The Magnetic Declination status used to get true North compass readings based on location.
409+
message MagneticDeclination {
410+
LocationSource location_source = 1; // Location source used for the magnetic declination look-up in geographiclib.
411+
float declination = 2; // The declination which is applied to the yaw field in the Attitude msg.
412+
LatLongPosition location = 3; // The location used for the magnetic declination look-up.
413+
}
414+
379415
// Drone altitude over seabed, typically obtained from a DVL.
380416
message Altitude {
381417
float value = 1; // Drone altitude over seabed (m).
@@ -569,12 +605,48 @@ message StorageSpace {
569605
int64 free_space = 2; // Available bytes of storage space (B).
570606
}
571607

608+
// Storage partition.
609+
message StoragePartition {
610+
StorageSpace storage_space = 1; // The amount of storage space on the device.
611+
string file_system_type = 2; // File system type of the removable storage device.
612+
string device_path = 3; // Partition device path
613+
string mount_path = 4; // Mount path of the partition.
614+
}
615+
616+
// Removable storage device.
617+
message RemovableStorageDevice {
618+
// Overall status of the storage device.
619+
enum Status {
620+
STATUS_UNSPECIFIED = 0; // Unspecified.
621+
STATUS_READY = 1; // The storage device is valid and ready for use.
622+
STATUS_FORMATTING = 2; // The storage device is being formatted
623+
STATUS_ERROR = 3; // The storage device is in an error state.
624+
}
625+
string vendor_name = 1; // USB vendor name.
626+
string model_name = 2; // Model name of the USB storage device.
627+
string device_path = 3; // Mount path of the storage device.
628+
Status status = 4; // Status of the storage device.
629+
RemovableStorageErrorFlags error_flags = 5; // Any active error flags for the storage device.
630+
repeated StoragePartition partitions = 6; // List of partitions on the storage device.
631+
}
632+
633+
// Error flags related to a removable storage device.
634+
message RemovableStorageErrorFlags {
635+
// Optional error message to give additional information from the drone to a client about active error flags.
636+
string error_message = 1;
637+
bool no_partitions_found = 2; // Device is attached but no partitions are found.
638+
bool multiple_partitions_found = 3; // Multiple partitions are found.
639+
bool wrong_file_system_found = 4; // The wrong file system is found.
640+
bool device_is_read_only = 5; // The device is in read-only mode.
641+
bool formatting_failed = 6; // Formatting of the device failed.
642+
}
643+
572644
// Compass calibration state.
573645
message CalibrationState {
574646

575647
// Status of the compass calibration procedure.
576648
//
577-
// When calibration is started, the status will indicate the active (upfacing) axis.
649+
// When calibration is started, the status will indicate the active (up facing) axis.
578650
enum Status
579651
{
580652
STATUS_UNSPECIFIED = 0; // Unspecified status.
@@ -586,7 +658,7 @@ message CalibrationState {
586658
STATUS_CALIBRATING_Y_NEGATIVE = 6; // Compass is calibrating and the negative Y axis is active.
587659
STATUS_CALIBRATING_Z_POSITIVE = 7; // Compass is calibrating and the positive Z axis is active.
588660
STATUS_CALIBRATING_Z_NEGATIVE = 8; // Compass is calibrating and the negative Z axis is active.
589-
STATUS_CALIBRATING_THRUSTER = 9; // Compass is calibrating for thruster interferance.
661+
STATUS_CALIBRATING_THRUSTER = 9; // Compass is calibrating for thruster interference.
590662
}
591663

592664
Status status = 1; // Current calibration status.
@@ -717,6 +789,7 @@ enum Resolution {
717789
RESOLUTION_UNSPECIFIED = 0; // Resolution not specified.
718790
RESOLUTION_FULLHD_1080P = 1; // 1080p Full HD resolution.
719791
RESOLUTION_HD_720P = 2; // 720p HD resolution.
792+
RESOLUTION_UHD_4K = 3; // 4K Ultra HD resolution.
720793
}
721794

722795
// Available camera frame rates.
@@ -737,13 +810,16 @@ enum Camera {
737810
message CameraParameters {
738811
int32 h264_bitrate = 1; // Bitrate of the h264 stream (bit/sec).
739812
int32 mjpg_bitrate = 2; // Bitrate of the MJPG stream used for still pictures (bit/sec).
813+
740814
int32 exposure = 3; // Shutter speed (1/10000 * s), -1 for automatic exposure.
741815
int32 white_balance = 4; // White balance temperature (2800..9300), -1 for automatic white balance.
742816
int32 hue = 5; // Hue (-40..40), 0 as default.
743817

744818
float gain = 9; // Iso gain (0..1).
745819

746-
Resolution resolution = 6; // Stream, recording and image resolution.
820+
Resolution resolution = 6; // Stream, recording and image resolution (deprecated).
821+
Resolution stream_resolution = 10; // Stream resolution.
822+
Resolution recording_resolution = 11; // Recording and image resolution.
747823
Framerate framerate = 7; // Stream and recording framerate.
748824
Camera camera = 8; // Which camera the parameters belong to.
749825
}
@@ -863,6 +939,8 @@ enum GuestPortDeviceID {
863939
GUEST_PORT_DEVICE_ID_BLUEPRINT_SUBSEA_OCULUS_C550D = 41; // Blueprint Subsea Oculus C550d.
864940
GUEST_PORT_DEVICE_ID_BLUEPRINT_SUBSEA_OCULUS_M370S = 42; // Blueprint Subsea Oculus M370s.
865941
GUEST_PORT_DEVICE_ID_WATERLINKED_SONAR_3D15 = 43; // Waterlinked Sonar 3D-15.
942+
GUEST_PORT_DEVICE_ID_CERULEAN_TRACKER_650 = 44; // Cerulean Tracker 650.
943+
GUEST_PORT_DEVICE_ID_BLUEYE_EXTERNAL_USB_STORAGE = 45; // Blueye External USB Storage
866944
}
867945

868946
// Guest port number.
@@ -881,6 +959,7 @@ enum NavigationSensorID {
881959
NAVIGATION_SENSOR_ID_NMEA = 3; // NMEA stream from external positioning system.
882960
NAVIGATION_SENSOR_ID_BLUEYE_GNSS = 4; // Blueye GNSS device on the ROV.
883961
NAVIGATION_SENSOR_ID_NORTEK_DVL_NUCLEUS = 5; // Nortek DVL Nucleus 1000.
962+
NAVIGATION_SENSOR_ID_CERULEAN_TRACKER_650 = 6; // Cerulean Tracker 650.
884963
}
885964

886965
// Navigation sensor used in the position observer with validity state.
@@ -1142,4 +1221,5 @@ message CPUInfo {
11421221
float memory_bus_load = 2; // Memory bus load (0..1).
11431222
float main_queue_load = 3; // Main queue load (0..1).
11441223
float guestport_queue_load = 4 ; // Guestport queue load (0..1).
1224+
float comm_queue_load = 5; // Communication queue load (0..1).
11451225
}

0 commit comments

Comments
 (0)