Crazyflie lib for Java

Firmware/software/electronics/mechanics
Post Reply
ahuber1
Beginner
Posts: 15
Joined: Thu Jan 09, 2014 8:19 am

Crazyflie lib for Java

Post 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
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Crazyflie lib for Java

Post by tobias »

Great work and achievement! I really like the GUI widgets, are they QT and did you make them your self?
ahuber1
Beginner
Posts: 15
Joined: Thu Jan 09, 2014 8:19 am

Re: Crazyflie lib for Java

Post 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.
csholmq
Beginner
Posts: 12
Joined: Fri Dec 27, 2013 1:20 pm

Re: Crazyflie lib for Java

Post 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?
ahuber1
Beginner
Posts: 15
Joined: Thu Jan 09, 2014 8:19 am

Re: Crazyflie lib for Java

Post 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"
ahuber1
Beginner
Posts: 15
Joined: Thu Jan 09, 2014 8:19 am

Re: Crazyflie lib for Java

Post 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.
Post Reply