Page 1 of 1

Crazyflie lib for Java

Posted: Tue Jan 14, 2014 8:00 pm
by ahuber1
Hi all,

i started develop a Crazyflie lib and GUI in Java.
Based on the Android Client i started change the source code to use usb4java library for communication.
Now i can share my projects starting with the lib over https://bitbucket.org/ahuber1/crazyflie-lib.
The main class to use it is se.bitcraze.crazyflie.Crazyflie.
There are already some things to do from now like finish scan for devices.
Currently always the first device found are used.
Parameters and Logging ToC are read from it at every connect.
Parameters are read at connect and can be written and re-read if need.
Logging Groups can be registered and you can add multiple listeners for each group (sample available in src/test/java).

Code: Select all

		try {
			crazyflie.connect("radio://1:1M");
			Logging logging = crazyflie.getLogging();
			crazyflie.addLoggingListener(new LogListener() {

				@Override
				public void valuesReceived(String name,
						Map<String, Object> values) {
					log.info("Got {}: {}", name, values.toString());
				}
			},"acc","gyro");
			logging.addGroup("acc", 10, "acc.x", "acc.y", "acc.z", "acc.zw");
			logging.addGroup("gyro", 10, "gyro.x", "gyro.y", "gyro.z");
			Thread.sleep(3000);
		} finally {
			crazyflie.disconnect();
		}
The Altitude hold mode can be switched on or off per Method.
I will also preparing my GUI Project to bitbucket, it does already have Controller Support based on JInput lib.
I have attached a image how it currently looks like.
There are no special features available, the plan was first to get it flying :)
Bildschirmfoto 2014-01-14 um 20.20.02.png
Any comments are Welcome

Andreas

Re: Crazyflie lib for Java

Posted: Wed Jan 15, 2014 10:47 am
by tobias
Great work and achievement! I really like the GUI widgets, are they QT and did you make them your self?

Re: Crazyflie lib for Java

Posted: Wed Jan 15, 2014 2:44 pm
by ahuber1
Thanks!

No there are no QT, everthing is written in java.
I don't make make it by myself, i found it at http://harmoniccode.blogspot.de/search/ ... teelseries.

Re: Crazyflie lib for Java

Posted: Wed Jan 15, 2014 9:41 pm
by csholmq
Yay for Java!

I noticed you had a test class. I built using

Code: Select all

mvn package
but after that I couldn't get the test class going.

Any tips?

Re: Crazyflie lib for Java

Posted: Thu Jan 16, 2014 8:13 am
by ahuber1
You can use your IDE (i use Eclipse IDE) to start the Test class.
But you can execute it also with maven.

Code: Select all

mvn exec:java -Dexec.mainClass="se.bitcraze.test.crazyflie.CrazyflieTest" -Dexec.classpathScope="test"

Re: Crazyflie lib for Java

Posted: Fri Jan 17, 2014 8:42 pm
by ahuber1
After some days later i uploaded my Java GUI Client to https://bitbucket.org/ahuber1/crazyflie-flight-control.
The Client is very basic at the moment.
It has support for Altitude Hold Mode and use a Button as "Start" Button which enable the Gamepad Sticks, and can be used as Killswitch.
When you press the "Start" Button the thrust are set to half of maximum available, the copter does not take off but i have a good range to control it.
For all non programmers i uploaded a executable jar file in the downloads area.