1

I am programming a drone with java script and using node-mavlink https://github.com/padcom/node-mavlink. I am trying to figure out how to detect if the drone is taking off, in the middle of flying or landing. When I read the mavlink documentation it seems like "MAV_LANDED_STATE" is what I want. I understand that I can send a message or command to the drone like this

const mavlinkPort = new SerialPort("/dev/ttyACM0");
const message = new common.RequestDataStream();
message.targetSystem = 1;
message.targetComponent = 0;
message.reqStreamId = 0;
message.reqMessageRate = 1000;
message.startStop = 0;
message.paramId = "SYSTEM_TIME";
await send(mavlinkPort, message);

but how would I send a request to the drone asking it to send back the value of the enum MavLandedState ? I ahve tried sending over

const message = common.MavLandedState

and

const message = new common.MavLandedState()

the first of which gives me an error saying that its outside a buffer and the later returns an error saying that MavLandedState is not a constructor (because it is an enum, I didn't expect it to work but thought I would try it). Please let me know if I haven't provided enough info.

codes
  • 21
  • 4

0 Answers0