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

Implement multiconfiguration #103

Open
vmsh0 opened this issue Sep 26, 2014 · 3 comments
Open

Implement multiconfiguration #103

vmsh0 opened this issue Sep 26, 2014 · 3 comments

Comments

@vmsh0
Copy link

vmsh0 commented Sep 26, 2014

Multiconfiguration is needed for some CONFIG options (some of the "video:" ones in particular).

Please ignore everything below this line.

If you don't plan to implement it can you help with a workaround?

var adrone = ardrone = require("ar-drone");

var drone = ardrone.createClient();

var UdpControl = drone._udpControl,
    CmdCreator = UdpControl._cmdCreator,
    CmdQueue = UdpControl._cmds;

var app_id = "JoyStickControl",
    pro_id = "JoyStickControlP0",
    ses_id = "JoyStickControlS0";

var pushCmd = function(type, args) {
    cmd = CmdCreator.raw(type, args, false, {}, function(e){console.log(e)});
    CmdQueue.push(cmd);
}

var pushAuthenticatedConfig = function(args) {
    pushCmd("CONFIG_IDS", [app_id, pro_id, ses_id]);
    pushCmd("CONFIG", args);
}

clearInterval(drone._interval);
drone._interval = null;

pushCmd("CONFIG", ["custom:application_id", app_id]);
pushCmd("CONFIG", ["custom:profile_id", pro_id]);
pushCmd("CONFIG", ["custom:session_id", ses_id]);
pushAuthenticatedConfig(["general:navdata_demo", "TRUE"]);
pushAuthenticatedConfig(["control:outdoor", OUTDOOR]);
pushAuthenticatedConfig(["control:flight_without_shell", SHELL]);
pushAuthenticatedConfig(["video:video_codec", "131"]); // 131 = H264_720P_CODEC

UdpControl.flush();

drone._setInterval(30);

The Drone ignores these commands or they don't get sent at all, I don't know.

@wiseman
Copy link
Collaborator

wiseman commented Sep 27, 2014

I've done some work toward implementing multiconfig (see #33 and PR #76) but I don't know when I'll have the opportunity to finish it. I can't think of a workaround, sorry.

@vmsh0
Copy link
Author

vmsh0 commented Sep 27, 2014

I may want to look into that myself, as I need that urgently, and that would be a good chance to learn some more Node programming.
I was thinking of this:

  • In UdpControl.flush() check if command is CONFIG (when processing blocking commands)
  • If it is CONFIG, craft a CONFIG_IDS command on the fly
  • Send CONFIG_IDS and CONFIG in the same packet
  • Wait for ACK and repeat for other queued blocking commands (this is already done obviously)

All of this, only if Multiconfiguration has been set up with a function of UdpControl, to which the caller passes application and user id (the session id is generated randomly as required by Parrot).
This function would be also exposed by the Client object, if one doesn't use the UdpControl directly.
If it has not been set up then just do everything the normal way.

If you think this would work and you are ok with me doing this, I'd like to try.

@wiseman
Copy link
Collaborator

wiseman commented Nov 14, 2014

Sorry I didn't respond sooner. My take on it is that working code wins, so if you can figure out a way to make this happen, we can always clean it up later if we need to.

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

No branches or pull requests

2 participants