Closed 452 closed 10 years ago
public static void main(String[] args) {
IARDrone drone = null;
try
{
drone = new ARDrone("192.168.1.69");
drone.start();
drone.getNavDataManager().addBatteryListener(new BatteryListener() {
public void batteryLevelChanged(int percentage)
{
System.out.println("Battery: " + percentage + " %");
}
public void voltageChanged(int vbat_raw) { }
});
} catch(Exception e){
e.printStackTrace();
drone.stop();
}
}
Battery: 50 % Battery: 50 % Battery: 50 % Battery: 50 % Battery: 50 % java.lang.IllegalArgumentException at java.nio.Buffer.limit(Buffer.java:267) at de.yadrone.base.navdata.NavDataManager.parse(NavDataManager.java:415) at de.yadrone.base.navdata.NavDataManager.run(NavDataManager.java:341) at java.lang.Thread.run(Thread.java:744) Battery: 50 % java.lang.IllegalArgumentException at java.nio.Buffer.limit(Buffer.java:267) at de.yadrone.base.navdata.NavDataManager.parse(NavDataManager.java:415) at de.yadrone.base.navdata.NavDataManager.run(NavDataManager.java:341) at java.lang.Thread.run(Thread.java:744) Battery: 50 % java.lang.IllegalArgumentException at java.nio.Buffer.limit(Buffer.java:267) at de.yadrone.base.navdata.NavDataManager.parse(NavDataManager.java:415) at de.yadrone.base.navdata.NavDataManager.run(NavDataManager.java:341) at java.lang.Thread.run(Thread.java:744) java.lang.IllegalArgumentException at java.nio.Buffer.limit(Buffer.java:267) at de.yadrone.base.navdata.NavDataManager.parse(NavDataManager.java:415) at de.yadrone.base.navdata.NavDataManager.run(NavDataManager.java:341) at java.lang.Thread.run(Thread.java:744) Battery: 50 % Control ack timeout true java.lang.IllegalArgumentException at java.nio.Buffer.limit(Buffer.java:267) at de.yadrone.base.navdata.NavDataManager.parse(NavDataManager.java:415) at de.yadrone.base.navdata.NavDataManager.run(NavDataManager.java:341) at java.lang.Thread.run(Thread.java:744) java.lang.IllegalArgumentException at java.nio.Buffer.limit(Buffer.java:267) at de.yadrone.base.navdata.NavDataManager.parse(NavDataManager.java:415) at de.yadrone.base.navdata.NavDataManager.run(NavDataManager.java:341) at java.lang.Thread.run(Thread.java:744) Battery: 50 % Battery: 50 % Battery: 50 % java.lang.IllegalArgumentException at java.nio.Buffer.limit(Buffer.java:267) at de.yadrone.base.navdata.NavDataManager.parse(NavDataManager.java:415) at de.yadrone.base.navdata.NavDataManager.run(NavDataManager.java:341) at java.lang.Thread.run(Thread.java:744) java.lang.IllegalArgumentException at java.nio.Buffer.limit(Buffer.java:267) at de.yadrone.base.navdata.NavDataManager.parse(NavDataManager.java:415) at de.yadrone.base.navdata.NavDataManager.run(NavDataManager.java:341) at java.lang.Thread.run(Thread.java:744) Battery: 50 % Battery: 50 % Battery: 50 % Battery: 50 % Battery: 50 % Battery: 50 % java.lang.IllegalArgumentException at java.nio.Buffer.limit(Buffer.java:267) at de.yadrone.base.navdata.NavDataManager.parse(NavDataManager.java:415) at de.yadrone.base.navdata.NavDataManager.run(NavDataManager.java:341) at java.lang.Thread.run(Thread.java:744) java.lang.IllegalArgumentException at java.nio.Buffer.limit(Buffer.java:267) at de.yadrone.base.navdata.NavDataManager.parse(NavDataManager.java:415) at de.yadrone.base.navdata.NavDataManager.run(NavDataManager.java:341) at java.lang.Thread.run(Thread.java:744) java.lang.IllegalArgumentException at java.nio.Buffer.limit(Buffer.java:267) at de.yadrone.base.navdata.NavDataManager.parse(NavDataManager.java:415) at de.yadrone.base.navdata.NavDataManager.run(NavDataManager.java:341) at java.lang.Thread.run(Thread.java:744) Battery: 50 % Battery: 50 % Battery: 50 % Battery: 50 % Battery: 50 % Battery: 50 % Battery: 50 % Battery: 50 % Battery: 50 %
Concerning the first (original issue). That seems to be no bug, cause you are only allowed to open the same port once. If you start YADrone multiple times this error ("Address already in use") will appear. Make sure to close all running instances. ToDo: better exception management in YADrone (and in the tutorial) in order to shutdown the whole process via System.exit if an exception occurs.
Concerning the second issue: Which firmware version does your drone have ?
firmware 2.4.8 AR.Drone 2.0 YADrone sources from Github
Exceptions are now propagated. But does this hold for all important exceptions ? If so, please re-open.
os Windows 7 x64 AR.Drone connected to my home router with internet