Closed Mezcall closed 8 years ago
OK, here is where I'm at:
I've updated 2 of the examples examples/events.js
and examples/flightplan.js
The event named "AvailabilityStateChanged" seems to be the one that indicates that the drone is ready to start an autopilot sequence.
Here was my output:
$ node examples/events.js
ready
69
landed
unknown <Buffer 01 0a 02 00 00 00 00 00 00 00 00 00 00>
ComponentStateListChanged { component: 'Calibration', State: 1 }
ComponentStateListChanged { component: 'GPS', State: 0 }
ComponentStateListChanged { component: 'Mavlink_File', State: 1 }
ComponentStateListChanged { component: 'TakeOff', State: 1 }
AvailabilityStateChanged { AvailabilityState: 0 }
MavlinkFilePlayingStateChanged { state: 'stopped',
filepath: '/data/ftp/internal_000/flightplans/flightPlan.mavlink\u0000\u0000\u0000\u0000\u0000',
type: 'unknown enum' }
GPSFixStateChanged { fixed: 0 }
68
67
66
65
64
63
62
GPSFixStateChanged { fixed: 1 }
ComponentStateListChanged { component: 'GPS', State: 1 }
AvailabilityStateChanged { AvailabilityState: 1 }
This is where we would try to call Mavlink.start()
61
60
https://github.com/hybridgroup/node-bebop/blob/bugfix/mavlink-commands/examples/events.js#L26
So I modified examples/flightplan.js
to take this into account, however it is night here now, and I cannot try any more autopilot antics until daylight.
However, this might work https://github.com/hybridgroup/node-bebop/blob/bugfix/mavlink-commands/examples/flightplan.js#L28
As soon as stop raining here I test. If you can test before me, tell me something please.
Regards
@deadprogram I tested the flightplan.js however, even will all conditions met, the state is paused... Once you get to test there, tell me something please.
You got a different state than stopped? Please paste your output.
I've got it working. Give me a few minutes to fix another error, and test a few more things out.
I just have the stopped state... Now i cant run it to have the output. If you have this working please tell me how Thanks
OK get the latest code I just pushed, it should work for you:
$ node examples/flightplan.js
ready
BatteryStateChanged
52
FlyingStateChanged
landed
unknown <Buffer 01 0a 02 00 00 00 00 00 00 00 00 00 00>
ComponentStateListChanged { component: 'Calibration', State: 1 }
ComponentStateListChanged { component: 'GPS', State: 1 }
ComponentStateListChanged { component: 'Mavlink_File', State: 1 }
ComponentStateListChanged { component: 'TakeOff', State: 1 }
AvailabilityStateChanged { AvailabilityState: 1 }
MavlinkFilePlayingStateChanged { state: 'stopped',
filepath: '/data/ftp/internal_000/flightplans/flightPlan.mavlink\u0000\u0000\u0000\u0000\u0000',
type: 'unknown enum' }
GPSFixStateChanged { fixed: 1 }
MavlinkFilePlayingStateChanged { state: 'playing',
filepath: '\u0000\u0000\u0000\u0000\u0000',
type: 'invalid enum' }
ComponentStateListChanged { component: 'Mavlink_File', State: 1 }
ComponentStateListChanged { component: 'TakeOff', State: 1 }
ComponentStateListChanged { component: 'TakeOff', State: 1 }
AvailabilityStateChanged { AvailabilityState: 1 }
FlyingStateChanged
takingOff
FlyingStateChanged
hovering
MavlinkFilePlayingStateChanged { state: 'playing',
filepath: '\u0000\u0000\u0000\u0000\u0000',
type: 'invalid enum' }
MavlinkFilePlayingStateChanged { state: 'playing',
filepath: '/data/ftp/internal_000/flightplans/flightPlan.mavlink\u0000\u0000\u0000\u0000\u0000',
type: 'unknown enum' }
FlyingStateChanged
flying
BatteryStateChanged
51
BatteryStateChanged
50
BatteryStateChanged
49
MavlinkFilePlayingStateChanged { state: 'paused',
filepath: '/data/ftp/internal_000/flightplans/flightPlan.mavlink\u0000\u0000\u0000\u0000\u0000',
type: 'unknown enum' }
FlyingStateChanged
MavlinkFilePlayingStateChanged { state: 'stopped',
filepath: '/data/ftp/internal_000/flightplans/flightPlan.mavlink\u0000\u0000\u0000\u0000\u0000',
type: 'unknown enum' }
FlyingStateChanged
landed
I like your output :) As soon as it stops raining i will test
Thank you
The flightPlan.mavlink file must be in the "examples" or is what is already in the drone?
It uses the path to what is in the drone. You can upload a file to the drone via FTP, the path just needs to match where it gets uploaded to.
That file was just to have an example of the file format on hand for future use.
Okay, exactly what I thought. Once I have feedback I put here.
Thank you very much @deadprogram
@deadprogram I tested now and it worked.
Thank you for your work and patience
Hi everyone we've just released v0.5.0 which has many improvements including the Mavlink stuff thanks especially to @brunoua for helping debug/test it. Please give it a try, and if needed reopen this issue. Thanks!
Hello,
I'm trying to run a flightPlan in mavlink format, but i get an error: It seems that this lib cannot parse the string? there is no write method in string type.
Code and error description bellow.
code: var obj = { filepath: "flightPlan.mavlink", type:"flightPlan" }; drone.Mavlink.start(obj);
error: \node_modules\node-bebop\lib\commandToBuffer.js:64 types[part.type].write(buffer, parseInt(part.value, 10), offset); ^
TypeError: types[part.type].write is not a function at path..\node_modules\node-bebop\lib\commandToBuffer.js:64:22 at Array.forEach (native) at writeBuffer (path..\node_modules\node-bebop\lib\commandToBuffer.js:61:11) at module.exports (path..\node_modules\node-bebop\lib\commandToBuffer.js:73:10) at Mavlink.start (path..\node_modules\node-bebop\lib\Mavlink.js:13:16) at path..\node_modules\node-bebop\examples\mavlink.js:11:19 at null. (path..\node_modules\node-bebop\lib\bebop.js:255:7)
at null. (path..\node_modules\node-bebop\lib\bebop.js:273:5)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
Thank you