bluerobotics / bluerobotics/cockpit

The set home command should be sent as COMMAND_INT so the altitude reference frame can be specified

Closed
#2,871 2 comments 0 reactions 1 assignee Claimed by @rafaellehmkuhl View on GitHub
map mavlink
Dominant language
TypeScript
Stars
198
Forks
63
Avg merge
2d 7h
Merged PRs (30d)
57

Description

`DO_SET_HOME` is currently sent as a `COMMAND_LONG` (`src/libs/vehicle/mavlink/vehicle.ts:1202-1204`):

```ts
async setHomeWaypoint(coordinates: [number, number], altitude: number): Promise {
await this.sendCommandLong(MavCmd.MAV_CMD_DO_SET_HOME, 0, 0, 0, 0, coordinates[0], coordinates[1], altitude)
}
```

`COMMAND_LONG` carries latitude and longitude as floats and has no frame field, so the altitude reference is left implicit. `COMMAND_INT` carries the position as scaled integers (1e7) and includes a `frame` field, letting us state whether the altitude is AMSL, relative to home, or terrain-relative.

Note that the existing `sendCommandInt` helper hardcodes the frame (`src/libs/vehicle/mavlink/vehicle.ts:273`):

```ts
frame: { type: MavFrame.MAV_FRAME_GLOBAL },
```

so it needs an optional frame parameter, defaulting to `MAV_FRAME_GLOBAL` to leave the existing `goTo` caller (line 612) unchanged.

This is a prerequisite for the planned dialog that lets the user choose the reference frame and altitude when explicitly setting a home point.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.