0.16.0 • Published 8 months ago
dronecan.ts v0.16.0
Dronecan.ts
TypeScript implementation of the DroneCAN protocol.
Usage overview
Define protocol schema
export const schema = {
messages: [
message({
id: 341,
type: "uavcan.protocol.NodeStatus",
definition: {
uptimeSec: uint(32),
health: enumeration(2, ["ok", "warning", "error", "critical"] as const),
mode: enumeration(3, [
"operational",
"initialization",
"maintenance",
"software update",
4,
5,
6,
"offline",
] as const),
subMode: uint(3),
vendorSpecificStatusCode: uint(16),
},
}),
],
services: [],
} as const;
Broadcast
dronecan.broadcast("uavcan.protocol.NodeStatus", {
uptimeSec: 0,
health: "ok",
mode: "operational",
subMode: 0,
vendorSpecificStatusCode: 0,
})
Request
const info = await dronecan.request("uavcan.protocol.GetNodeInfo", destinationId, {});
Respond
dronecan.onRequest("uavcan.protocol.GetNodeInfo", () => ({
status: {
uptimeSec: 0,
health: "ok",
mode: "operational",
subMode: 0,
vendorSpecificStatusCode: 0,
},
softwareVersion: {
major: 1,
minor: 0,
optionalFieldFlags: 0,
vcsCommit: 0,
imageCrc: 0n,
},
hardwareVersion: {
major: 1,
minor: 0,
uniqueId: new Uint8Array(new Array(16)),
certificateOfAuthenticity: new Uint8Array(),
},
name: "",
});
0.16.0
8 months ago
0.12.0
1 year ago
0.13.0
1 year ago
0.12.1
1 year ago
0.14.0
1 year ago
0.15.0
1 year ago
0.11.0
1 year ago
0.10.1
1 year ago
0.10.2
1 year ago
0.10.3
1 year ago
0.10.4
1 year ago
0.10.0
1 year ago
0.9.0
1 year ago
0.8.0
1 year ago
0.9.1
1 year ago
0.7.0
1 year ago
0.6.0
1 year ago
0.5.0
2 years ago
0.4.0
2 years ago
0.3.0
2 years ago
0.2.0
2 years ago
0.1.0
2 years ago