Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add remaining navdata options #29

Closed
wants to merge 43 commits into from
Closed

Add remaining navdata options #29

wants to merge 43 commits into from

Conversation

jfsiii
Copy link
Collaborator

@jfsiii jfsiii commented Nov 18, 2012

Added the 22 missing navdata options.

Notes:

  • I altered the demo and rawMeasures data structures.
  • I fixed any tests I broke, but wrote no new ones for the data I added.
  • I got rid of as many French variables as I could, but many remain. It's especially hard to translate the abbreviations. For example, is Planif short for the Frenchplanification, which would be planned in English?

I just saw your new-api branch. Do you already have a plan/roadmap for the API & navdata? I don't want to waste your time with PRs that have different structures than you'd like.

John Schulz and others added 30 commits November 11, 2012 14:50
Committing without testing. What could go wrong?
* 'master' of git://github.com/Contra/node-ar-drone:
  config test
  chaining
 * `require('..')` not `require('ar-drone')`
 * Use `client` (not `drone`) for ARDrone instance.
 * Use hyphens, not underscores, for script names.
John Schulz added 10 commits November 17, 2012 15:35
Unsure `ARDrone_SDK_2_0/ARDroneLib/Soft/Common/navdata_common.h:753` has `uint32_t link_quality` but using that:

 * Breaks a test
 * Produces a value from 0 - 500
 * Causes strange behavior[^1]

[^1]: (Values were observed to start at 500 and gradually decline to 0 in about 10 seconds. Sometime later the value would incrementally increase back to 500 and, again, slide back down to 0.)
Based on (guessing, after reading) ARDrone_SDK_2_0/ARDroneLib/Soft/Lib/ardrone_tool/Navdata/ardrone_navdata_file.c:51
var pngStream = arDrone.createPngStream();

var lastPng;
pngStream
.on('error', console.log)
.on('data', function(pngBuffer) {
.on('data', function (pngBuffer) {
lastPng = pngBuffer;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use spaces after the function keyword in an unnamed function (to keep in sync with the style used in the project).

@felixge
Copy link
Owner

felixge commented Nov 18, 2012

First of all, amazing work! ❤️ this patch!

Problems:

  • There are some style issues (minor)
  • Some stuff in this patch should be done in another pull request
  • There are no tests for the new stuff (unless I am missing something)

Anyway:

  • I just made you a contributor on this repo
  • I added you as an author on npm

So you can go ahead and merge / publish this as soon as you feel happy with it. You know what I'd like to see changed, but if you don't have time, IMO it's better to get this in now anyway.

Going forward:

I've been hacking on a new API over here: https://github.com/felixge/node-ar-drone/commits/new-api

One of the the changes is turning the navdata stuff into a more human friendly object:

https://github.com/felixge/node-ar-drone/blob/new-api/lib/navdata/message.js

However, now that you've added all the navdata stuff there is, I'm not sure if my approach is a good idea, or if we should continue to group navdata elements by the option tag they belong to.

The reason why I wanted to restructure this whole thing is to simplify the programming. Example:

if (navdata.demo && navdata.demo.batteryPercentage < 30) {
  console.log('Battery is too low for flips now!');
}

Could be simplified to just:

if (navdata.demo.batteryPercentage < 30) {
  console.log('Battery is too low for flips now!');
}

Would love to hear your thoughts on this!

(One possible way to do this better is to pass all the navdata option tags you want to receive when configuring the client, and if incomplete navdata packages are received, we simply don't emit them - that may work really well)

@felixge
Copy link
Owner

felixge commented Nov 19, 2012

❤️ those patches above!

@csanz
Copy link
Contributor

csanz commented Nov 19, 2012

👍

This is going to be very useful John! thanks

@jfsiii
Copy link
Collaborator Author

jfsiii commented Nov 19, 2012

Thanks for the compliment, I'm just glad to help. Thanks for adding me to the project, that's incredible.

I'll work on addressing as many of the problems as I can before I merge this:

  • I've already reverted @contra's work used in Better chaining API + object for config #28
  • I've already fixed the formatting issues for anonymous functions in the examples.
  • I'll move the examples to a feature branch and make a PR from there.
  • I'll fix any BC breakages. I'll revert any changes I made to existing data structures or, at worst, leave in the keys and add new ones. If I do the latter, BC will be maintained but the new structure is available if you want it.
  • I'll add tests for the new navdata items.

@jfsiii
Copy link
Collaborator Author

jfsiii commented Nov 19, 2012

I've created a new branch each for the examples and navdata changes.

When they're ready, I'll close this PR and submit one from each of them.

@jfsiii jfsiii closed this Nov 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants