@jawji/orchestrator 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +181 -0
  3. package/dist/adapters/mavsdk-adapter.d.ts +4 -0
  4. package/dist/adapters/mavsdk-adapter.d.ts.map +1 -0
  5. package/dist/adapters/mavsdk-adapter.js +51 -0
  6. package/dist/adapters/mavsdk-adapter.js.map +1 -0
  7. package/dist/adapters/vlm-client.d.ts +3 -0
  8. package/dist/adapters/vlm-client.d.ts.map +1 -0
  9. package/dist/adapters/vlm-client.js +19 -0
  10. package/dist/adapters/vlm-client.js.map +1 -0
  11. package/dist/grpc/mavsdk-client.d.ts +8 -0
  12. package/dist/grpc/mavsdk-client.d.ts.map +1 -0
  13. package/dist/grpc/mavsdk-client.js +34 -0
  14. package/dist/grpc/mavsdk-client.js.map +1 -0
  15. package/dist/index.d.ts +14 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +8 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/modes/landing-zone-check.d.ts +3 -0
  20. package/dist/modes/landing-zone-check.d.ts.map +1 -0
  21. package/dist/modes/landing-zone-check.js +52 -0
  22. package/dist/modes/landing-zone-check.js.map +1 -0
  23. package/dist/modes/vision-assist-mode.d.ts +8 -0
  24. package/dist/modes/vision-assist-mode.d.ts.map +1 -0
  25. package/dist/modes/vision-assist-mode.js +2 -0
  26. package/dist/modes/vision-assist-mode.js.map +1 -0
  27. package/dist/orchestrator.d.ts +13 -0
  28. package/dist/orchestrator.d.ts.map +1 -0
  29. package/dist/orchestrator.js +106 -0
  30. package/dist/orchestrator.js.map +1 -0
  31. package/dist/server/status-server.d.ts +23 -0
  32. package/dist/server/status-server.d.ts.map +1 -0
  33. package/dist/server/status-server.js +35 -0
  34. package/dist/server/status-server.js.map +1 -0
  35. package/dist/types.d.ts +55 -0
  36. package/dist/types.d.ts.map +1 -0
  37. package/dist/types.js +2 -0
  38. package/dist/types.js.map +1 -0
  39. package/dist/vlm/miril-client.d.ts +12 -0
  40. package/dist/vlm/miril-client.d.ts.map +1 -0
  41. package/dist/vlm/miril-client.js +45 -0
  42. package/dist/vlm/miril-client.js.map +1 -0
  43. package/package.json +47 -0
  44. package/proto/action/action.proto +368 -0
  45. package/proto/mavsdk_options.proto +23 -0
  46. package/proto/mission/mission.proto +285 -0
  47. package/proto/telemetry/telemetry.proto +897 -0
@@ -0,0 +1,23 @@
1
+ import type { ConfirmDecision } from '../types.js';
2
+ export interface OrchestratorStatus {
3
+ state: 'idle' | 'holding' | 'awaiting-confirm' | 'no-safe-alternative';
4
+ verdict?: {
5
+ status: 'unsafe' | 'unknown';
6
+ candidate?: {
7
+ latitudeDeg: number;
8
+ longitudeDeg: number;
9
+ description: string;
10
+ };
11
+ };
12
+ }
13
+ export interface StatusServerOptions {
14
+ port: number;
15
+ onConfirm: (decision: ConfirmDecision) => void;
16
+ }
17
+ export interface StatusServer {
18
+ start(): Promise<void>;
19
+ stop(): Promise<void>;
20
+ setStatus(status: OrchestratorStatus): void;
21
+ }
22
+ export declare function createStatusServer(options: StatusServerOptions): StatusServer;
23
+ //# sourceMappingURL=status-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-server.d.ts","sourceRoot":"","sources":["../../src/server/status-server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,kBAAkB,GAAG,qBAAqB,CAAC;IACvE,OAAO,CAAC,EAAE;QAAE,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC;QAAC,SAAS,CAAC,EAAE;YAAE,WAAW,EAAE,MAAM,CAAC;YAAC,YAAY,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;CAC5H;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;CAChD;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,SAAS,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC7C;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAmC7E"}
@@ -0,0 +1,35 @@
1
+ import express from 'express';
2
+ export function createStatusServer(options) {
3
+ let currentStatus = { state: 'idle' };
4
+ let httpServer = null;
5
+ const app = express();
6
+ app.use(express.json());
7
+ app.get('/status', (_req, res) => {
8
+ res.json(currentStatus);
9
+ });
10
+ app.post('/confirm', (req, res) => {
11
+ const decision = req.body;
12
+ options.onConfirm(decision);
13
+ res.status(200).json({ received: true });
14
+ });
15
+ return {
16
+ setStatus(status) {
17
+ currentStatus = status;
18
+ },
19
+ start() {
20
+ return new Promise((resolve) => {
21
+ httpServer = app.listen(options.port, '127.0.0.1', () => resolve());
22
+ });
23
+ },
24
+ stop() {
25
+ return new Promise((resolve, reject) => {
26
+ if (!httpServer) {
27
+ resolve();
28
+ return;
29
+ }
30
+ httpServer.close((err) => (err ? reject(err) : resolve()));
31
+ });
32
+ },
33
+ };
34
+ }
35
+ //# sourceMappingURL=status-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-server.js","sourceRoot":"","sources":["../../src/server/status-server.ts"],"names":[],"mappings":"AAAA,OAAO,OAAyB,MAAM,SAAS,CAAC;AAoBhD,MAAM,UAAU,kBAAkB,CAAC,OAA4B;IAC7D,IAAI,aAAa,GAAuB,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAC1D,IAAI,UAAU,GAAkB,IAAI,CAAC;IACrC,MAAM,GAAG,GAAY,OAAO,EA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0 +1,55 @@
1
+ export interface VehicleState {
2
+ flightMode: 'READY' | 'TAKEOFF' | 'HOLD' | 'MISSION' | 'RETURN_TO_LAUNCH' | 'LAND' | 'OFFBOARD' | 'OTHER';
3
+ latitudeDeg: number;
4
+ longitudeDeg: number;
5
+ absoluteAltitudeM: number;
6
+ }
7
+ export interface LandingCandidate {
8
+ latitudeDeg: number;
9
+ longitudeDeg: number;
10
+ description: string;
11
+ }
12
+ export type ModeVerdict = {
13
+ status: 'safe';
14
+ } | {
15
+ status: 'unsafe';
16
+ candidate?: LandingCandidate;
17
+ } | {
18
+ status: 'unknown';
19
+ reason: string;
20
+ };
21
+ export type ConfirmDecision = {
22
+ action: 'accept-candidate';
23
+ } | {
24
+ action: 'reject';
25
+ };
26
+ export interface VehicleAdapter {
27
+ hold(): Promise<void>;
28
+ gotoLocation(coords: {
29
+ latitudeDeg: number;
30
+ longitudeDeg: number;
31
+ absoluteAltitudeM: number;
32
+ }): Promise<void>;
33
+ resumeMission(): Promise<void>;
34
+ subscribeFlightMode(onChange: (state: VehicleState) => void): () => void;
35
+ }
36
+ export interface CameraSource {
37
+ captureFrame(): Promise<Buffer>;
38
+ }
39
+ export interface VlmClient {
40
+ query(image: Buffer, prompt: string): Promise<unknown>;
41
+ }
42
+ export interface OrchestratorContext {
43
+ vehicle: VehicleAdapter;
44
+ camera: CameraSource;
45
+ vlm: VlmClient;
46
+ }
47
+ export type ConfirmPolicy = 'gated' | 'autonomous';
48
+ export interface OrchestratorConfig {
49
+ mavsdkServerAddress: string;
50
+ vlmClient: VlmClient;
51
+ cameraSource: CameraSource;
52
+ confirmPolicy: ConfirmPolicy;
53
+ statusServerPort: number;
54
+ }
55
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,S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AM,WAAW,mBAAmB;IAClC,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,YAAY,CAAC;IACrB,GAAG,EAAE,SAAS,CAAC;CAChB;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,YAAY,CAAC;AAEnD,MAAM,WAAW,kBAAkB;IACjC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,SAAS,CAAC;IACrB,YAAY,EAAE,YAAY,CAAC;IAC3B,aAAa,EAAE,aAAa,CAAC;IAC7B,gBAAgB,EAAE,MAAM,CAAC;CAC1B"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import type { VlmClient } from '../types.js';
2
+ export type MirilPromptFamily = 'caption_v1' | 'simple_answer_v1' | 'operational_coordinate_v2';
3
+ export interface MirilVlmClientOptions {
4
+ /** OpenAI-compatible chat completions endpoint, e.g. http://127.0.0.1:8000/v1/chat/completions */
5
+ endpoint: string;
6
+ /** Model name/id as configured on the serving backend. Defaults to 'miril-drone-2b-1'. */
7
+ model?: string;
8
+ /** Which of Miril's three documented response shapes to request. Defaults to 'operational_coordinate_v2', the landing-zone-check shape. */
9
+ promptFamily?: MirilPromptFamily;
10
+ }
11
+ export declare function createMirilVlmClient(options: MirilVlmClientOptions): VlmClient;
12
+ //# sourceMappingURL=miril-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"miril-client.d.ts","sourceRoot":"","sources":["../../src/vlm/miril-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAW7C,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG,kBAAkB,GAAG,2BAA2B,CAAC;AAQhG,MAAM,WAAW,qBAAqB;IACpC,kGAAkG;IAClG,QAAQ,EAAE,MAAM,CAAC;IACjB,0FAA0F;IAC1F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2IAA2I;IAC3I,YAAY,CAAC,EAAE,iBAAiB,CAAC;CAClC;AAMD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,SAAS,CA0C9E"}
@@ -0,0 +1,45 @@
1
+ const MIRIL_PROMPTS = {
2
+ caption_v1: 'Describe this aerial scene. Respond with JSON: {"caption": string}.',
3
+ simple_answer_v1: 'Answer the question about this aerial scene. Respond with JSON: {"answer": string}.',
4
+ operational_coordinate_v2: 'Assess this aerial scene for the requested operational task. Respond with JSON: {"description": string, "point_2d": [y, x], "status": string}.',
5
+ };
6
+ export function createMirilVlmClient(options) {
7
+ const promptFamily = options.promptFamily ?? 'operational_coordinate_v2';
8
+ const model = options.model ?? 'miril-drone-2b-1';
9
+ return {
10
+ async query(image, prompt) {
11
+ const instruction = `${MIRIL_PROMPTS[promptFamily]} ${prompt}`;
12
+ const response = await fetch(options.endpoint, {
13
+ method: 'POST',
14
+ headers: { 'content-type': 'application/json' },
15
+ body: JSON.stringify({
16
+ model,
17
+ messages: [
18
+ {
19
+ role: 'user',
20
+ content: [
21
+ { type: 'text', text: instruction },
22
+ { type: 'image_url', image_url: { url: `data:image/jpeg;base64,${image.toString('base64')}` } },
23
+ ],
24
+ },
25
+ ],
26
+ }),
27
+ });
28
+ if (!response.ok) {
29
+ throw new Error(`Miril query failed with status ${response.status}`);
30
+ }
31
+ const completion = (await response.json());
32
+ const content = completion.choices?.[0]?.message?.content;
33
+ if (!content) {
34
+ throw new Error('Miril response had no completion content');
35
+ }
36
+ try {
37
+ return JSON.parse(content);
38
+ }
39
+ catch {
40
+ throw new Error(`Miril response was not valid JSON: ${content}`);
41
+ }
42
+ },
43
+ };
44
+ }
45
+ //# sourceMappingURL=miril-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"miril-client.js","sourceRoot":"","sources":["../../src/vlm/miril-client.ts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C,EAAE,OAAO,EAAE,OAAO,CAAC;YAC1D,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;YAC9D,CAAC;YAED,IAAI,CAAC;gBACH,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC7B,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,IAAI,KAAK,CAAC,sCAAsC,OAAO,EAAE,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@jawji/orchestrator",
3
+ "version": "0.1.0",
4
+ "description": "Standalone onboard vision-assisted autonomy for companion computers, starting with a landing-zone safety check.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "proto"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc",
20
+ "test": "vitest run",
21
+ "test:watch": "vitest"
22
+ },
23
+ "keywords": [
24
+ "mavsdk",
25
+ "drone",
26
+ "autonomy",
27
+ "companion-computer",
28
+ "vision-language-model"
29
+ ],
30
+ "license": "MIT",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/utachicodes/jawji-orchestrator.git"
34
+ },
35
+ "dependencies": {
36
+ "@grpc/grpc-js": "^1.14.4",
37
+ "@grpc/proto-loader": "^0.8.1",
38
+ "google-proto-files": "^5.0.2",
39
+ "express": "^4.21.0"
40
+ },
41
+ "devDependencies": {
42
+ "@types/express": "^4.17.0",
43
+ "@types/node": "^20.0.0",
44
+ "typescript": "^5.0.0",
45
+ "vitest": "^2.1.8"
46
+ }
47
+ }
@@ -0,0 +1,368 @@
1
+ syntax = "proto3";
2
+
3
+ package mavsdk.rpc.action;
4
+
5
+ import "mavsdk_options.proto";
6
+
7
+ option java_package = "io.mavsdk.action";
8
+ option java_outer_classname = "ActionProto";
9
+
10
+ // Enable simple actions such as arming, taking off, and landing.
11
+ service ActionService {
12
+ /*
13
+ * Send command to arm the drone.
14
+ *
15
+ * Arming a drone normally causes motors to spin at idle.
16
+ * Before arming take all safety precautions and stand clear of the drone!
17
+ */
18
+ rpc Arm(ArmRequest) returns(ArmResponse) {}
19
+ /*
20
+ * Send command to force-arm the drone without any checks.
21
+ *
22
+ * Attention: this is not to be used for normal flying but only bench tests!
23
+ *
24
+ * Arming a drone normally causes motors to spin at idle.
25
+ * Before arming take all safety precautions and stand clear of the drone!
26
+ */
27
+ rpc ArmForce(ArmForceRequest) returns(ArmForceResponse) {}
28
+ /*
29
+ * Send command to disarm the drone.
30
+ *
31
+ * This will disarm a drone that considers itself landed. If flying, the drone should
32
+ * reject the disarm command. Disarming means that all motors will stop.
33
+ */
34
+ rpc Disarm(DisarmRequest) returns(DisarmResponse) {}
35
+ /*
36
+ * Send command to take off and hover.
37
+ *
38
+ * This switches the drone into position control mode and commands
39
+ * it to take off and hover at the takeoff altitude.
40
+ *
41
+ * Note that the vehicle must be armed before it can take off.
42
+ */
43
+ rpc Takeoff(TakeoffRequest) returns(TakeoffResponse) {}
44
+ /*
45
+ * Send command to land at the current position.
46
+ *
47
+ * This switches the drone to 'Land' flight mode.
48
+ */
49
+ rpc Land(LandRequest) returns(LandResponse) {}
50
+ /*
51
+ * Send command to reboot the drone components.
52
+ *
53
+ * This will reboot the autopilot, companion computer, camera and gimbal.
54
+ */
55
+ rpc Reboot(RebootRequest) returns(RebootResponse) {}
56
+ /*
57
+ * Send command to shut down the drone components.
58
+ *
59
+ * This will shut down the autopilot, onboard computer, camera and gimbal.
60
+ * This command should only be used when the autopilot is disarmed and autopilots commonly
61
+ * reject it if they are not already ready to shut down.
62
+ */
63
+ rpc Shutdown(ShutdownRequest) returns(ShutdownResponse) {}
64
+ /*
65
+ * Send command to terminate the drone.
66
+ *
67
+ * This will run the terminate routine as configured on the drone (e.g. disarm and open the parachute).
68
+ */
69
+ rpc Terminate(TerminateRequest) returns(TerminateResponse) {}
70
+ /*
71
+ * Send command to kill the drone.
72
+ *
73
+ * This will disarm a drone irrespective of whether it is landed or flying.
74
+ * Note that the drone will fall out of the sky if this command is used while flying.
75
+ */
76
+ rpc Kill(KillRequest) returns(KillResponse) {}
77
+ /*
78
+ * Send command to return to the launch (takeoff) position and land.
79
+ *
80
+ * This switches the drone into [Return mode](https://docs.px4.io/master/en/flight_modes/return.html) which
81
+ * generally means it will rise up to a certain altitude to clear any obstacles before heading
82
+ * back to the launch (takeoff) position and land there.
83
+ */
84
+ rpc ReturnToLaunch(ReturnToLaunchRequest) returns(ReturnToLaunchResponse) {}
85
+ /*
86
+ * Send command to move the vehicle to a specific global position.
87
+ *
88
+ * The latitude and longitude are given in degrees (WGS84 frame) and the altitude
89
+ * in meters AMSL (above mean sea level).
90
+ *
91
+ * The yaw angle is in degrees (frame is NED, 0 is North, positive is clockwise).
92
+ */
93
+ rpc GotoLocation(GotoLocationRequest) returns(GotoLocationResponse) {}
94
+ /*
95
+ * Send command do orbit to the drone.
96
+ *
97
+ * This will run the orbit routine with the given parameters.
98
+ */
99
+ rpc DoOrbit(DoOrbitRequest) returns(DoOrbitResponse) {}
100
+ /*
101
+ * Send command to hold position (a.k.a. "Loiter").
102
+ *
103
+ * Sends a command to drone to change to Hold flight mode, causing the
104
+ * vehicle to stop and maintain its current GPS position and altitude.
105
+ *
106
+ * Note: this command is specific to the PX4 Autopilot flight stack as
107
+ * it implies a change to a PX4-specific mode.
108
+ */
109
+ rpc Hold(HoldRequest) returns(HoldResponse) {}
110
+ /*
111
+ * Send command to set the value of an actuator.
112
+ *
113
+ * Note that the index of the actuator starts at 1 and that the value goes from -1 to 1.
114
+ */
115
+ rpc SetActuator(SetActuatorRequest) returns(SetActuatorResponse) {}
116
+ /*
117
+ * Send command to set the value of a relay.
118
+ *
119
+ * The index of the relay starts at 0.
120
+ * For the relay value, 1=on, 0=off, others possible depending on system hardware
121
+ */
122
+ rpc SetRelay(SetRelayRequest) returns(SetRelayResponse) {}
123
+ /*
124
+ * Send command to transition the drone to fixedwing.
125
+ *
126
+ * The associated action will only be executed for VTOL vehicles (on other vehicle types the
127
+ * command will fail). The command will succeed if called when the vehicle
128
+ * is already in fixedwing mode.
129
+ */
130
+ rpc TransitionToFixedwing(TransitionToFixedwingRequest) returns(TransitionToFixedwingResponse) {}
131
+ /*
132
+ * Send command to transition the drone to multicopter.
133
+ *
134
+ * The associated action will only be executed for VTOL vehicles (on other vehicle types the
135
+ * command will fail). The command will succeed if called when the vehicle
136
+ * is already in multicopter mode.
137
+ */
138
+ rpc TransitionToMulticopter(TransitionToMulticopterRequest) returns(TransitionToMulticopterResponse) {}
139
+ /*
140
+ * Get the takeoff altitude (in meters above ground).
141
+ */
142
+ rpc GetTakeoffAltitude(GetTakeoffAltitudeRequest) returns(GetTakeoffAltitudeResponse) {}
143
+ /*
144
+ * Set takeoff altitude (in meters above ground).
145
+ */
146
+ rpc SetTakeoffAltitude(SetTakeoffAltitudeRequest) returns(SetTakeoffAltitudeResponse) {}
147
+ /*
148
+ * Get the return to launch minimum return altitude (in meters).
149
+ */
150
+ rpc GetReturnToLaunchAltitude(GetReturnToLaunchAltitudeRequest) returns(GetReturnToLaunchAltitudeResponse) {}
151
+ /*
152
+ * Set the return to launch minimum return altitude (in meters).
153
+ */
154
+ rpc SetReturnToLaunchAltitude(SetReturnToLaunchAltitudeRequest) returns(SetReturnToLaunchAltitudeResponse) {}
155
+ /*
156
+ * Set current speed.
157
+ *
158
+ * This will set the speed during a mission, reposition, and similar.
159
+ * It is ephemeral, so not stored on the drone and does not survive a reboot.
160
+ */
161
+ rpc SetCurrentSpeed(SetCurrentSpeedRequest) returns(SetCurrentSpeedResponse) {}
162
+ /*
163
+ * Set GPS Global Origin.
164
+ *
165
+ * Sets the GPS coordinates of the vehicle local origin (0,0,0) position.
166
+ */
167
+ rpc SetGpsGlobalOrigin(SetGpsGlobalOriginRequest) returns(SetGpsGlobalOriginResponse) { option (mavsdk.options.async_type) = SYNC; }
168
+ /*
169
+ * Set home.
170
+ *
171
+ * Sets the home position.
172
+ */
173
+ rpc SetHome(SetHomeRequest) returns(SetHomeResponse) { option (mavsdk.options.async_type) = SYNC; }
174
+ }
175
+
176
+ message ArmRequest {}
177
+ message ArmResponse {
178
+ ActionResult action_result = 1;
179
+ }
180
+
181
+ message ArmForceRequest {}
182
+ message ArmForceResponse {
183
+ ActionResult action_result = 1;
184
+ }
185
+
186
+ message DisarmRequest {}
187
+ message DisarmResponse {
188
+ ActionResult action_result = 1;
189
+ }
190
+
191
+ message TakeoffRequest {}
192
+ message TakeoffResponse {
193
+ ActionResult action_result = 1;
194
+ }
195
+
196
+ message LandRequest {}
197
+ message LandResponse {
198
+ ActionResult action_result = 1;
199
+ }
200
+
201
+ message RebootRequest {}
202
+ message RebootResponse {
203
+ ActionResult action_result = 1;
204
+ }
205
+
206
+ message ShutdownRequest {}
207
+ message ShutdownResponse {
208
+ ActionResult action_result = 1;
209
+ }
210
+
211
+ message TerminateRequest {}
212
+ message TerminateResponse {
213
+ ActionResult action_result = 1;
214
+ }
215
+
216
+ message KillRequest {}
217
+ message KillResponse {
218
+ ActionResult action_result = 1;
219
+ }
220
+
221
+ message ReturnToLaunchRequest {}
222
+ message ReturnToLaunchResponse {
223
+ ActionResult action_result = 1;
224
+ }
225
+
226
+ message GotoLocationRequest {
227
+ double latitude_deg = 1; // Latitude (in degrees)
228
+ double longitude_deg = 2; // Longitude (in degrees)
229
+ float absolute_altitude_m = 3; // Altitude AMSL (in meters)
230
+ float yaw_deg = 4; // Yaw angle (in degrees, frame is NED, 0 is North, positive is clockwise)
231
+ }
232
+ message GotoLocationResponse {
233
+ ActionResult action_result = 1;
234
+ }
235
+
236
+ // Yaw behaviour during orbit flight.
237
+ enum OrbitYawBehavior {
238
+ ORBIT_YAW_BEHAVIOR_HOLD_FRONT_TO_CIRCLE_CENTER = 0; // Vehicle front points to the center (default)
239
+ ORBIT_YAW_BEHAVIOR_HOLD_INITIAL_HEADING = 1; // Vehicle front holds heading when message received
240
+ ORBIT_YAW_BEHAVIOR_UNCONTROLLED = 2; // Yaw uncontrolled
241
+ ORBIT_YAW_BEHAVIOR_HOLD_FRONT_TANGENT_TO_CIRCLE = 3; // Vehicle front follows flight path (tangential to circle)
242
+ ORBIT_YAW_BEHAVIOR_RC_CONTROLLED = 4; // Yaw controlled by RC input
243
+ }
244
+
245
+ message DoOrbitRequest {
246
+ float radius_m = 1; // Radius of circle (in meters)
247
+ float velocity_ms = 2; // Tangential velocity (in m/s)
248
+ OrbitYawBehavior yaw_behavior = 3; // Yaw behavior of vehicle (ORBIT_YAW_BEHAVIOUR)
249
+ double latitude_deg = 5 [(mavsdk.options.default_value)="NaN"]; // Center point latitude in degrees. NAN: use current latitude for center
250
+ double longitude_deg = 6 [(mavsdk.options.default_value)="NaN"]; // Center point longitude in degrees. NAN: use current longitude for center
251
+ double absolute_altitude_m = 7 [(mavsdk.options.default_value)="NaN"]; // Center point altitude in meters. NAN: use current altitude for center
252
+ }
253
+ message DoOrbitResponse {
254
+ ActionResult action_result = 1;
255
+ }
256
+
257
+ message HoldRequest {}
258
+ message HoldResponse {
259
+ ActionResult action_result = 1;
260
+ }
261
+
262
+ message SetActuatorRequest {
263
+ int32 index = 1; // Index of actuator (starting with 1)
264
+ float value = 2; // Value to set the actuator to (normalized from [-1..1])
265
+ }
266
+ message SetActuatorResponse {
267
+ ActionResult action_result = 1;
268
+ }
269
+
270
+ // Commanded values for relays
271
+ enum RelayCommand {
272
+ RELAY_COMMAND_ON = 0; // Turn the relay off
273
+ RELAY_COMMAND_OFF = 1; // Turn the relay on.
274
+ }
275
+ message SetRelayRequest {
276
+ int32 index = 1; // Index of relay (starting with 0)
277
+ RelayCommand setting = 2; // Value to set the relay to
278
+ }
279
+ message SetRelayResponse {
280
+ ActionResult action_result = 1;
281
+ }
282
+
283
+ message TransitionToFixedwingRequest {}
284
+ message TransitionToFixedwingResponse {
285
+ ActionResult action_result = 1;
286
+ }
287
+
288
+ message TransitionToMulticopterRequest {}
289
+ message TransitionToMulticopterResponse {
290
+ ActionResult action_result = 1;
291
+ }
292
+
293
+ message GetTakeoffAltitudeRequest {}
294
+ message GetTakeoffAltitudeResponse {
295
+ ActionResult action_result = 1;
296
+ float altitude = 2; // Takeoff altitude relative to ground/takeoff location (in meters)
297
+ }
298
+
299
+ message SetTakeoffAltitudeRequest {
300
+ float altitude = 1; // Takeoff altitude relative to ground/takeoff location (in meters)
301
+ }
302
+ message SetTakeoffAltitudeResponse {
303
+ ActionResult action_result = 1;
304
+ }
305
+
306
+ message GetReturnToLaunchAltitudeRequest {}
307
+ message GetReturnToLaunchAltitudeResponse {
308
+ ActionResult action_result = 1;
309
+ float relative_altitude_m = 2; // Return altitude relative to takeoff location (in meters)
310
+ }
311
+
312
+ message SetReturnToLaunchAltitudeRequest {
313
+ float relative_altitude_m = 1; // Return altitude relative to takeoff location (in meters)
314
+ }
315
+ message SetReturnToLaunchAltitudeResponse {
316
+ ActionResult action_result = 1;
317
+ }
318
+
319
+ message SetCurrentSpeedRequest {
320
+ float speed_m_s = 1; // Speed in meters/second
321
+ }
322
+ message SetCurrentSpeedResponse {
323
+ ActionResult action_result = 1;
324
+ }
325
+
326
+ message SetGpsGlobalOriginRequest {
327
+ double latitude_deg = 1; // Latitude (in degrees)
328
+ double longitude_deg = 2; // Longitude (in degrees)
329
+ float absolute_altitude_m = 3; // Altitude AMSL (in meters)
330
+ }
331
+ message SetGpsGlobalOriginResponse {
332
+ ActionResult action_result = 1;
333
+ }
334
+
335
+ message SetHomeRequest {
336
+ bool use_current_location = 1; // Use current location
337
+ double latitude_deg = 2; // Latitude (in degrees)
338
+ double longitude_deg = 3; // Longitude (in degrees)
339
+ float absolute_altitude_m = 4; // Altitude AMSL (in meters)
340
+ }
341
+ message SetHomeResponse {
342
+ ActionResult action_result = 1;
343
+ }
344
+
345
+ // Result type.
346
+ message ActionResult {
347
+ // Possible results returned for action requests.
348
+ enum Result {
349
+ RESULT_UNKNOWN = 0; // Unknown result
350
+ RESULT_SUCCESS = 1; // Request was successful
351
+ RESULT_NO_SYSTEM = 2; // No system is connected
352
+ RESULT_CONNECTION_ERROR = 3; // Connection error
353
+ RESULT_BUSY = 4; // Vehicle is busy
354
+ RESULT_COMMAND_DENIED = 5; // Command refused by vehicle
355
+ RESULT_COMMAND_DENIED_LANDED_STATE_UNKNOWN = 6; // Command refused because landed state is unknown
356
+ RESULT_COMMAND_DENIED_NOT_LANDED = 7; // Command refused because vehicle not landed
357
+ RESULT_TIMEOUT = 8; // Request timed out
358
+ RESULT_VTOL_TRANSITION_SUPPORT_UNKNOWN = 9; // Hybrid/VTOL transition support is unknown
359
+ RESULT_NO_VTOL_TRANSITION_SUPPORT = 10; // Vehicle does not support hybrid/VTOL transitions
360
+ RESULT_PARAMETER_ERROR = 11; // Error getting or setting parameter
361
+ RESULT_UNSUPPORTED = 12; // Action not supported
362
+ RESULT_FAILED = 13; // Action failed
363
+ RESULT_INVALID_ARGUMENT = 14; // Invalid argument
364
+ }
365
+
366
+ Result result = 1; // Result enum value
367
+ string result_str = 2; // Human-readable English string describing the result
368
+ }
@@ -0,0 +1,23 @@
1
+ syntax = "proto3";
2
+
3
+ import "google/protobuf/descriptor.proto";
4
+
5
+ package mavsdk.options;
6
+
7
+ option java_package = "options.mavsdk";
8
+
9
+ extend google.protobuf.FieldOptions {
10
+ string default_value = 50000;
11
+ double epsilon = 50001;
12
+ }
13
+
14
+ extend google.protobuf.MethodOptions {
15
+ AsyncType async_type = 50000;
16
+ bool is_finite = 50001;
17
+ }
18
+
19
+ enum AsyncType {
20
+ ASYNC = 0;
21
+ SYNC = 1;
22
+ BOTH = 2;
23
+ }