Wifi_mode of ARDrone2.0


#1

We know ARDrone2.0 can create the network in Ad-Hoc mode.That it,ARDrone2.0 would own a wifi singla,other device like iphone can connect this wifi to control the Drone.But my question is that can ARDrone2.0 join a network as client? Give an example,my laptap create a wifi singal.I want ARDrone2.0 to connect this wifi singal.Is that Ok? if it could happen,how make it?

plus, the Document ARDrone_Developer_Guide.pdf shows that could happen in page 82 NETWORK:wifi_mode.


#2

Hey,
it is possible, but you have to use telnet and should know basic linux commands…
http://www.drone-forum.com/forum/viewtopic.php?f=8&t=807

I didn’t try it myself, so let me know if you managed to get it working.

Vabe


#3

This is actually a very ironic request as originally that was the only option available to the ARDrone platform. Somewhere in 2011 Parrot enabled the ability for it to act as a hotspot (access point), or wifi client. While it has been a very long time for me (I stopped maintaining ARDrone 1/2 code 3+ years ago) I vaguely recall it still supporting these options natively (without the need to hack supplicants / etc).


#4

Bear with me as I dump some old code:

    // List preference
    final ListPreference wifiModePref = new ListPreference(ctx);
    wifiModePref.setEnabled(!isDemo);
    wifiModePref.setKey("network_wifi_mode");
    wifiModePref.setPersistent(false);
    wifiModePref.setEntries(R.array.wifi_modes);
    wifiModePref.setEntryValues(R.array.wifi_modes_values);
    wifiModePref.setDialogTitle(R.string.prefs_wifi_mode_dialog);
    wifiModePref.setTitle(R.string.prefs_wifi_mode);
    wifiModePref.setDefaultValue(((Integer) config.getWifi_mode()).toString());

    final String[] modes = ctx.getResources().getStringArray(R.array.wifi_modes);
    wifiModePref.setSummary(modes[config.getWifi_mode()]);

    wifiModePref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
		public boolean onPreferenceChange(Preference arg0, Object arg1) {
			final int mode = Integer.parseInt((String) arg1);
	        wifiModePref.setSummary(modes[mode]);
	        config.setWifi_mode(mode);
			return true;
		}
    });
    
    networkPrefCat.addPreference(wifiModePref);	

<string-array name="wifi_modes">
    <item>Infrastructure Host</item>
    <item>Ad-Hoc Network</item>
    <item>Infrastructure Client</item>
</string-array>
	
<string-array name="wifi_modes_values">
    <item>0</item>
    <item>1</item>
    <item>2</item>
</string-array>

And to wrap it all up at a java and native level:

wifi_mode = nativeGetControlConfigInt(wifi_mode_id);

public void setWifi_mode(int wifi_mode) {
	this.wifi_mode = wifi_mode;
	nativeSetControlConfigInt(wifi_mode_id, wifi_mode);
}

void Java_com_shellware_ARPro_ARProConfig_nativeSetControlConfigInt(JNIEnv*  env, jobject thiz, jint cfg, jint value) {

	switch ((_config_ids) cfg) {
...
		case wifi_mode_id:
			ardrone_control_config.wifi_mode = value;
			ARDRONE_TOOL_CONFIGURATION_ADDEVENT(wifi_mode, &ardrone_control_config.wifi_mode, NULL);
			break;
...
		default:
			break;
	}

	return;
}

And finally a nice throwback to Parrot’s old config file that drove a ton of code generation:

ARDRONE_CONFIG_KEY_STR_a10("network", ssid_single_player,  INI_STRING,   string_t,   char*,       (K_READ|K_WRITE), 0, WIFI_NETWORK_NAME,               default_config_callback, CAT_COMMON)
ARDRONE_CONFIG_KEY_STR_a10("network", ssid_multi_player,   INI_STRING,   string_t,   char*,       (K_READ|K_WRITE), 0,  WIFI_NETWORK_NAME,               default_config_callback, CAT_COMMON)
ARDRONE_CONFIG_KEY_IMM_a10("network", wifi_mode,           INI_INT,      int32_t,    int32_t*,    (K_READ|K_WRITE), 0,  WIFI_MODE_INFRA,                               default_config_callback, CAT_COMMON)
ARDRONE_CONFIG_KEY_IMM_a10("network", infrastructure,      INI_BOOLEAN,  bool_t,     bool_t*,     (K_READ|K_WRITE), 0,  0,                               default_config_callback, CAT_COMMON)
ARDRONE_CONFIG_KEY_IMM_a10("network", secure,              INI_BOOLEAN,  bool_t,     bool_t*,     (K_READ|K_WRITE), 0,  0,                               default_config_callback, CAT_COMMON)
ARDRONE_CONFIG_KEY_STR_a10("network", passkey,             INI_STRING,   string_t,   char*,       (K_READ|K_WRITE), 0,  "",                              default_config_callback, CAT_COMMON)

A quick recap:

  1. Set ssid_multi_player and/or ssid_single_player to your intended adhoc / infrastructure / client SSID
  2. Set the secure flag, passkey, and infrastructure flags appropriately
  3. Set wifi_mode to 1

And your AR.Drone should now be hosting an adhoc network corresponding to the values you set.


#5

Ops,I cann’t open the link.
Can you leave contact information of you?
enmmmmm,email would be the best choice.
Looking forward your replay.
Thanks!


#6

Sorry,I still cann’t understand what you have said. Could you tell me more detail? If you could list every step and it’s method in a PDF docment,I would be very pleasure. Thank you very much.