node-mavlink
node-mavlink copied to clipboard
Dropped mavlink messages after GLOBAL_POSITION_INT and after RAW_IMU
Here is the script I am testing with.
#!/usr/bin/env node
var SerialPort = require('serialport').SerialPort;
var mavlink = require('mavlink');
//Open serial port
var port = new SerialPort('/dev/ttyAMA0', {
baudrate: 57600
});
//When port is open, start up mavlink
port.on('open', function() {
console.log("Serial Port is ready");
//listening for system 1 component 1
var m = new mavlink(1,1);
var buffer = "";
//When mavlink is ready, assign some listeners
m.on('ready', function() {
console.log("Mavlink is ready!");
//Parse any new incoming data
port.on('data', function(data) {
m.parse(data);
});
m.on('message', function(msg){
// console.log('got msg.id = ' + msg.id + ', buffer len·
//' + buffer.length);
buffer += 'message #'+msg.sequence+' received, type '+msg.id+': '+m.getMessageName(msg.id)+"\n";
if (buffer.length > 1024 * 4) {
console.log("Here is the entire buffer: \n" + buffer);
buffer = "";
}
});
m.on('sequenceError', function(mismatch){
buffer += 'sequenceError: ' + mismatch + "\n";
});
});
});
The output:
message #238 received, type 74: VFR_HUD
message #239 received, type 163: AHRS
message #240 received, type 165: HWSTATUS
message #241 received, type 2: SYSTEM_TIME
message #242 received, type 27: RAW_IMU
sequenceError: 1
message #244 received, type 29: SCALED_PRESSURE
message #245 received, type 150: SENSOR_OFFSETS
message #246 received, type 1: SYS_STATUS
message #247 received, type 152: MEMINFO
message #248 received, type 42: MISSION_CURRENT
message #249 received, type 24: GPS_RAW_INT
message #250 received, type 62: NAV_CONTROLLER_OUTPUT
message #251 received, type 162: FENCE_STATUS
message #252 received, type 33: GLOBAL_POSITION_INT
sequenceError: 1
message #254 received, type 35: RC_CHANNELS_RAW
message #255 received, type 30: ATTITUDE
message #0 received, type 74: VFR_HUD
message #1 received, type 163: AHRS
message #2 received, type 165: HWSTATUS
message #3 received, type 2: SYSTEM_TIME
message #4 received, type 27: RAW_IMU
sequenceError: 1
message #6 received, type 29: SCALED_PRESSURE
message #7 received, type 150: SENSOR_OFFSETS
message #8 received, type 1: SYS_STATUS
message #9 received, type 152: MEMINFO
message #10 received, type 42: MISSION_CURRENT
message #11 received, type 24: GPS_RAW_INT
message #12 received, type 62: NAV_CONTROLLER_OUTPUT
message #13 received, type 162: FENCE_STATUS
message #14 received, type 33: GLOBAL_POSITION_INT
sequenceError: 1
message #16 received, type 35: RC_CHANNELS_RAW
message #17 received, type 30: ATTITUDE
message #18 received, type 0: HEARTBEAT
message #19 received, type 74: VFR_HUD
message #20 received, type 163: AHRS
message #21 received, type 165: HWSTATUS
message #22 received, type 2: SYSTEM_TIME
message #23 received, type 27: RAW_IMU
sequenceError: 1
message #25 received, type 29: SCALED_PRESSURE
message #26 received, type 150: SENSOR_OFFSETS
message #27 received, type 1: SYS_STATUS
message #28 received, type 152: MEMINFO
message #29 received, type 42: MISSION_CURRENT
message #30 received, type 24: GPS_RAW_INT
message #31 received, type 62: NAV_CONTROLLER_OUTPUT
message #32 received, type 162: FENCE_STATUS
message #33 received, type 33: GLOBAL_POSITION_INT
sequenceError: 1
message #35 received, type 35: RC_CHANNELS_RAW
message #36 received, type 30: ATTITUDE
message #37 received, type 74: VFR_HUD
message #38 received, type 163: AHRS
message #39 received, type 165: HWSTATUS
message #40 received, type 2: SYSTEM_TIME
message #41 received, type 27: RAW_IMU
sequenceError: 1
message #43 received, type 29: SCALED_PRESSURE
message #44 received, type 150: SENSOR_OFFSETS
message #45 received, type 1: SYS_STATUS
message #46 received, type 152: MEMINFO
message #47 received, type 42: MISSION_CURRENT
message #48 received, type 24: GPS_RAW_INT
message #49 received, type 62: NAV_CONTROLLER_OUTPUT
message #50 received, type 162: FENCE_STATUS
message #51 received, type 33: GLOBAL_POSITION_INT
sequenceError: 1
message #53 received, type 35: RC_CHANNELS_RAW
message #54 received, type 30: ATTITUDE
message #55 received, type 74: VFR_HUD
message #56 received, type 163: AHRS
message #57 received, type 165: HWSTATUS
message #58 received, type 2: SYSTEM_TIME
message #59 received, type 27: RAW_IMU
sequenceError: 1
message #61 received, type 29: SCALED_PRESSURE
message #62 received, type 150: SENSOR_OFFSETS
message #63 received, type 1: SYS_STATUS
This is executing on a Raspberry Pi that is physically wired up to the Pixhawk with the serial cable, as instructed here.
I am employing manual string buffering (dumping every 32K), just in case performance is an issue.
Now maybe there is some explanation here. The behavior seems to be pretty repeatable.
Also, more things that I would like to know:
- How to speed up the report rate
- Where to find a list of the actual full set of data I should be receiving from the Pixhawk
Hello, I came up to your github repository https://github.com/omcaree/node-mavlink. My challenge is to collect data send from arduino as mavlink messages in pixhawk thorugh node.js module. Kindly can you elaborately explain how to write application in pixhawk in order to decode that messages and use it for further purposes. Regards, Ajay