ARDrone2Windows / SDK

Pilot your AR.Drone 2.0 from a Windows Store or Windows Phone app
59 stars 56 forks source link

video recording not working win RT #6

Closed ghost closed 10 years ago

ghost commented 11 years ago

I try your sample app ARDrone2Windows RT/8 but when I try record video it doesnt work or maybe only video is not stored in drone, so I want ask do you have some idea where can be problem? Because video recording is primary feature in my app. Do you have any new or updated/fixed sources? if yes can you put it there on github i will very grateful.

garolion commented 11 years ago

Hello Pavol,

Pictures and recorded videos are partially supported in our SDK. You can take a picture, start or stop a video recording, but we don’t actually expose any simple API to retrieve this content. You need to connect a ftp client to the drone IP address 196.168.1.1), to download your content. We didn’t have time to add this missing FTP client piece in our SDK. Hope it won’t be a challenge to reuse a ftp client code for your app.

Arnaud

From: Pavol Franek [mailto:notifications@github.com] Sent: dimanche 15 septembre 2013 20:55 To: ARDrone2Windows/SDK Subject: [SDK] video recording not working win RT (#6)

I try your sample app ARDrone2Windows RT/8 but when I try record video it doesnt work or maybe only video is not stored in drone, so I want ask do you have some idea where can be problem? Because video recording is primary feature in my app. Do you have any new or updated/fixed sources? if yes can you put it there on github i will very grateful.

— Reply to this email directly or view it on GitHubhttps://github.com/ARDrone2Windows/SDK/issues/6.

ghost commented 11 years ago

But I say - I cant save video to ardrone device not to my device. If I take photo with your SDK samle photo is stored in drone but when I press recording video I cand find any video in memory so I ask where can by problem do you test it with last sources?

AndrewSpec commented 11 years ago

On iOS it's working like this: -by default video is recorded to the smartphone -in settings you can select to record the video to the USB

but I see that this SDK don't allow to enable USB video recording....

my 2GB pendrive is visible but no video is recorded.

Ruslan-B commented 11 years ago

@AndrewSpec I can assume that you can record video to usb stick by sending additional configuration command. Looks like this:

var configuration = new DroneConfiguration();  
var command = configuration.Video.OnUsb.Set(true).ToCommand();
_drone.Client.PostCommand(command);
AndrewSpec commented 11 years ago

@Ruslan-B I've tried this but still no video on my USB.

Ruslan-B commented 11 years ago

Please check do you have more than 100Mb of free space. Here is quotation from the original SDK documentation:

VIDEO:video_on_usb
Description :
CAT_COMMON | Read/Write
Only for AR.Drone 2.0 If this key is set to "TRUE" and a USB key with >100Mb of freespace is connected, the record video stream will be recorded on the USB key.
In all other cases (key set to "FALSE" or no USB key plugged), the record stream is sent to the controlling device, which will be in charge of the actual recording.
AT command example : AT*CONFIG=605,"video:video_on_usb","TRUE"
Please note that the AR.Drone 2.0 only supports USB keys with a grounded USB connector casing, and formatted in FAT32 file format.

I'm just wondering from the iOS application this working fine?

AndrewSpec commented 11 years ago

I've read that in the documentation. My USB stick is a 2GB FAT32 device with all space free. I'm not sure if it's grounded.

In my project I'm using the WP8 client - maybe that's the problem? The WP8 sample is incomplete so maybe the client too...

How it's working on iOS I only know from the documentation :) Never tried that.

garolion commented 11 years ago

We try to investigate your issue. Could you confirm the firmware version you’re running on your drone. We experienced issues in commands with the last firmware update.

From: AndrewSpec [mailto:notifications@github.com] Sent: lundi 16 septembre 2013 20:39 To: ARDrone2Windows/SDK Cc: Arnaud Fontaine Subject: Re: [SDK] video recording not working win RT (#6)

I've read that in the documentation. My USB stick is a 2GB FAT32 device with all space free. I'm not sure if it's grounded.

In my project I'm using the WP8 client - maybe that's the problem? The WP8 sample is incomplete so maybe the client too...

How it's working on iOS I only know from the documentation :) Never tried that.

— Reply to this email directly or view it on GitHubhttps://github.com/ARDrone2Windows/SDK/issues/6#issuecomment-24533496.

AndrewSpec commented 11 years ago

how can I check that from the SDK?

Ruslan-B commented 11 years ago

I've manage to get it work, however, only for mine library. It is useless in case of WP8 or WinRT but it can be implemented in this SDK.

Information about usb stick is located in native navdata option (navdata_hdvideo_stream_t), unfortunately parser for that option is not implemented in this SDK, however this could be done easily. This will work only when multi-configuration mode is active:

// set session id, application id and profile to enable multi-configuration (should be sent once per session)  
AT*CONFIG=[SEQUENCE],"custom:session_id","66443ff6"
AT*CTRL=[SEQUENCE],5,0
// sleep for 500ms

AT*CONFIG=[SEQUENCE],"custom:application_id","dc8a5834"
AT*CTRL=[SEQUENCE],5,0
// sleep for 500ms

AT*CONFIG_IDS=[SEQUENCE],"66443ff6","a07a12ac","dc8a5834"
AT*CONFIG=[SEQUENCE],"custom:profile_id","a07a12ac"
AT*CTRL=[SEQUENCE],5,0
// sleep for 500ms

The commands that needs to be sent to start recording:

// switch codec to MP4_360P_H264_720P_CODEC (mandatory)
AT*CONFIG_IDS=[SEQUENCE],"66443ff6","a07a12ac","dc8a5834"
AT*CONFIG=[SEQUENCE],"video:video_codec","130"

// optional (enables Demo, VideoStream and HDVideoStream)
AT*CONFIG_IDS=[SEQUENCE],"66443ff6","a07a12ac","dc8a5834"
AT*CONFIG=[SEQUENCE],"general:navdata_options","34078721"

// enable video on usb 
AT*CONFIG_IDS=[SEQUENCE],"66443ff6","a07a12ac","dc8a5834"
AT*CONFIG=[SEQUENCE],"video:video_on_usb","TRUE"

// start recording
AT*CONFIG_IDS=[SEQUENCE],"66443ff6","a07a12ac","dc8a5834"
AT*CONFIG=[SEQUENCE],"userbox:userbox_cmd","1,20130917_223810"

And to stop recording:

// stop recording
AT*CONFIG_IDS=[SEQUENCE],"66443ff6","a07a12ac","dc8a5834"
AT*CONFIG=[SEQUENCE],"userbox:userbox_cmd","0"

Please consider that codec been switched, thus it can affect client video decoding.

Ruslan-B commented 11 years ago

@AndrewSpec You can check by requesting configuration from drone via RequestConfiguration() method. After it been acquired you need to check General.SoftVersion on configuration object.

Ruslan-B commented 11 years ago

As I get from mine research the main trick is a switching of video_codec and this can be done only in multi-configuration mode. I can assume that rest of the configuration commands will work without sending AT*CONFIG_IDS in advance.

AndrewSpec commented 11 years ago

My version is 2.4.7

Ruslan-B commented 10 years ago

@AndrewSpec can try to send raw commands mentioned above? The _drone.Client.PostCommand method accepts string and will replace [SEQUENCE] pattern to correct number internally. It should look like this:

_drone.Client.PostCommand("AT*CONFIG=[SEQUENCE],""custom:session_id"",""66443ff6""");
_drone.Client.PostCommand("AT*CTRL=[SEQUENCE],5,0");
Thread.Sleep(500);
_drone.Client.PostCommand("AT*CONFIG=[SEQUENCE],""custom:application_id"",""dc8a5834""");
_drone.Client.PostCommand("AT*CTRL=[SEQUENCE],5,0");
Thread.Sleep(500);
_drone.Client.PostCommand("AT*CONFIG_IDS=[SEQUENCE],""66443ff6"",""a07a12ac"",""dc8a5834""");
_drone.Client.PostCommand("AT*CONFIG=[SEQUENCE],""custom:profile_id"",""a07a12ac""");
_drone.Client.PostCommand("AT*CTRL=[SEQUENCE],5,0");
Thread.Sleep(500);

_drone.Client.PostCommand("AT*CONFIG_IDS=[SEQUENCE],""66443ff6"",""a07a12ac"",""dc8a5834""");
_drone.Client.PostCommand("AT*CONFIG=[SEQUENCE],""video:video_codec"",""130""");
_drone.Client.PostCommand("AT*CONFIG_IDS=[SEQUENCE],""66443ff6"",""a07a12ac"",""dc8a5834""");
_drone.Client.PostCommand("AT*CONFIG=[SEQUENCE],""video:video_on_usb"",""TRUE"");

Where 66443ff6, dc8a5834, a07a12ac - session id, application id, profile id, you can change them later. After this step you may request configuration and it is should reflect these changes.

To start video recording:

_drone.Client.PostCommand("AT*CONFIG_IDS=[SEQUENCE],""66443ff6"",""a07a12ac"",""dc8a5834""");
_drone.Client.PostCommand("AT*CONFIG=[SEQUENCE],""userbox:userbox_cmd"",""1,20130917_223810""");

Where 20130917_223810 - date and time in format yyyyMMdd_HHmmss, but for test you should keep the given value.

And to stop:

_drone.Client.PostCommand("AT*CONFIG_IDS=[SEQUENCE],""66443ff6"",""a07a12ac"",""dc8a5834""");
_drone.Client.PostCommand("AT*CONFIG=[SEQUENCE],""userbox:userbox_cmd"",""0""");

Hope it helps at least to workaround this issue.

AndrewSpec commented 10 years ago

I tried that and still no luck :/

Ruslan-B commented 10 years ago

Sorry for that, in mine case it is working fine (I'm not using this SDK, this is raw command output from mine library), however, you should wait for the reaction from the official maintainer as this is not possible without proper support of multi configuration.

Ruslan-B commented 10 years ago

Apparently @MikeyMCZ found a workaround in the issue #7 for putting drone into multi-configuration mode. Thus in case it is still actual for you - try to add "\r" at the end of any custom command.

MikeyMCZ commented 10 years ago

I have tested this and the configuration commands are ignored. I am using these commands: AT_CONFIG_IDS=15,"11ab11ff","22ef22ff","33cd33ff" AT_CONFIG=16,"userbox:userbox_cmd","1,20130917_223810" The application, profile and session ids are properly setup.

@Ruslan-B - when you are calling config commands, do you send the "AT*CTRL=17,5,0"?

Ruslan-B commented 10 years ago

@MikeyMCZ no I don't do it, usually the "AT_CTRL=[sq],5,0" command needed to confirm switch of app, session and profile ids command only. The rest of commands should only with AT_CONFIG_IDS=... before every command and without any delay. However, this user box commands should start video recording directly to drone memory (as you omitted codec switch and video_on_usb commands) and it should be available via telnet or ftp. Try to search drone filesystem for the file which filename contains 20130917_223810.

MikeyMCZ commented 10 years ago

I have tried this: AT_CONFIG=1,"general:navdata_demo","TRUE" AT_CTRL=2,5,0

AT_CONFIG=3,"custom:session_id","ccccccc3" AT_CTRL=4,5,0

AT_CONFIG=5,"custom:application_id","aaaaaaa3" AT_CTRL=6,5,0

AT_CONFIG=7,"custom:profile_id","bbbbbbb3" AT_CTRL=8,5,0

AT*CTRL=9,4,0

CONFIGURATION RETURNED

AT*CTRL=10,0

AT_CONFIG_IDS=11,"aaaaaaa3","bbbbbbb3","ccccccc3" AT_CONFIG=12,"video:video_codec","130"

AT_CONFIG_IDS=13,"aaaaaaa3","bbbbbbb3","ccccccc3" AT_CONFIG=14,"video:video_on_usb","TRUE"

AT_CONFIG_IDS=15,"aaaaaaa3","bbbbbbb3","ccccccc3" AT_CONFIG=16,"userbox:userbox_cmd","1,20130917_223810"

AT*CTRL=17,4,0

The video recording did not started. And the configuration is not returned after the command sq-17 was send. If I add between sq 16 and 17 the call to AT*CTRL=[sq],5,0 the configuration is returned, however the config calls are ignored. I have no idea what is wrong. I was thinking about the but I have tried to send 0x0D as is specified.

Ruslan-B commented 10 years ago

That's strage at least you should get video_codec and video_on_usb with settings that you send previously. Well at this point I can give only one advice - you can download mine library and try to compile and run demo application (conventional WinForms), that should be relatively easy. Then you need to uncomment few lines in btnSendConfig_Click to start record video to usb. In mine case everything working like a charm. You either get a possibility to check information as attached usb drive in native navdata hdvideo_stream. At least you will be able to check whether it is working at all or not.

garolion commented 10 years ago

Issue solved in the last update. 1/ plug the key 2/ plug the Drone battery 3/ Start the app 4/ record video