0%
0%

# Star Wars training droid

Flying training droid that interacts with its opponent.

Similar projects worth following
14.5k views
The goal is to create a flying training droid that interacts with its opponent. Inspired by the Star Wars lightsaber training droid. We will do this by using wiimote to locate a mini quadcopter. A computer calculates the necessary corrections and sends them to the quadcopter.

The Code is online!
https://bitbucket.org/rlutters/hack-a-day-sci-fi-contest

• 1 × Arduino Duemilanove
• 2 × Wiimote
• 1 × Kinect Sensor
• 1 × Apple Macbook Pro (with Windows) We need something to run the software on.
• ### The code is online, demo of stereovision

So first of all you can find the c# code of the project here:

https://bitbucket.org/rlutters/hack-a-day-sci-fi-contest

We also have a demo video for the stereovision:

• ### Putting in the stereovision

So for the last part we needed a way to get an x,y,z coordinate. We had some idea's how but we ended with Stereo vision.

With just 2 motes we could calculate an x,y,z coordinate, since 2 lines in space intersect only trough one point.
This seemed to work great, we could track the copter easily when moved him slow, but when we triend it with the flying copter we saw that the motes where sometimes giving incorrect values causing our copter to crash.

With stereo vision there are 4 zones:
First is outside everyones range, you don't want to be there
- Seccond is the blind spot (marked black). Like the first, you don't want to be there.
- Third is the gray area. This is the field where you are seen by only one mote. This could be used to get you back to forth place, since we have a clue of where you are.
- Last is the light gray area, this is where we have stereo vision.

Since the motes are on one line we can say that the y value are the same, practical we take the average.

For the z and x value we use the x value off the motes and draw a mental line between the mote center and the point they see.
Those two lines intersect eachother and that intersection is our x and z value.

• ### 2 axis control tested (video)

After some fine tuning of the PID's we could finally do some test with 2 axis control by the computer.

but first something about the progress of connecting everything.

1. connect the available WiiMotes.
you can connect a WiiMote in windows 7 by just using the standard windows bluetooth wizard. It creates a new HID device in you device list. So at the left lower corner of our application you can search for available WiiMote's.

Once there is a WiiMote connected you get the 2-axis representation of de the detected IR-lightsource on the right (the red dot). You also can put the wanted location on de grid by clicking it (the blue dot).

2. Connect to the RCremote.

On the left upper corner there is the connection panel to connect to the arduino that sends the pwm signal to the rc-remote.

you can adjust the PID gains and min, max values realtime with the text boxes. The current output is also visible (value between 0 and 255).

So with 1 WiiMote we can determine the position of the quadcopter in 2-axis.
the other axes can still be controlled by the RC remote in the classic way.

Time for a little demo:

Wat is happening here is that the computer is adjusting the throttle (height) and the roll. (the orange propellers are the front.)

• ### Flight Test

Last monday we did our very first flight test in order to tune the PID control.

During the tests we let our program control the throttle of our quadcopter and made it fly up to a given height.

The tests proved that the PID control needs good finetuning for a good control over the quadcopter.

Here are some video's of our test flights:

• ### Bug fixing, bug fixing and OH IT WORKS

Well at least in theory... https://www.dropbox.com/s/hg650wtnxxq2ws1/Capture.avi

In the screen capture you can see the PID in action after I moved the targeted point, if i put the target point back to the corner (0,0) then it starts to descend again. Now we wait for test flight 2 on monday. Fingers crossed.

• ### Attempt one on flight

This saterday we tried to get flight... Well that didn't work out.

We had some issue but after 4 hours looking at the problem we didn't see it. Luckely it is quite testable so this week we will have an update.

• ### Creating a GUI

I proudly present the UI version 1:

In it we have RC control on top and on the bottom the feedback from the wiimote (no real wiimotes where hurt during the making off)

Next step now is connecting the GUI to the code writting by colleagues, I hope we get it ready by saterday for our first flight test.

• ### Making the quadcopter visible for the wiimote

To make it possible for the wiimotes to see the quadcopter. We added some IR-emitting diodes. To make sure the quad is visible in different angles. I searched led's with the biggest radiation angle. The maximum angle of normal IR's LED's  is 100°. But you can find SMD led's with 140°. So I ordered some SMD's . The wavelength is 940nm because the wiimote is the most sensitive to 940nm.

They are so small it is hard to see them! :p

• ### 3D position from wiimote signals

As it turns out, it requires some long-forgotten math skills (and patience!) to get a 3D-position from the wiimote outputs. I started with a 2D position determination.

Below you see the top view of our setup. Cam A to C represent the three wiimotes, each with their FOV. The 3 FOVs overlap in the pale blue part, this will be our field of action. Each wiimote returns an x-value between 0 and 1, the horizontal relative position of the quad in the wiimote's FOV. When the quad would be positioned on the red dot, the wiimotes would return e.g. 0.8 (camA), 0.1 (camB), 0.6 (camC).

Of course we have to work the other way around. The quad is positioned in the field somewhere and we get 3 x-values from the wiimotes. I almost finished the calculations to determine the quad's x,y-coordinates from the wiimote x-values.

The next step - after this piece of art :-) - will be to implement the y-values returned by the wiimotes (which define the vertical relative position of the quad in the wiimote's FOV) into my calculations to determine x,y,z-coordinates of the quad in our field of action.

• ### Starting to implement the PID Controllers

To have a nice and stabile control of the movement of the quadcopter. We will use PID-controllers for the different movements. There will be 4 of them to have full control over the quad. (throttle, pitch, roll, yaw)

The PID-controller calculates the error between the setpoint (wanted position) and the current position and gives a output value that we kan use to adjust the position of the quadcopter.

After some trail and error we managed to get the PID-controller to react to a slider in a test application.

Share

## Discussions

Rebelj12a wrote 11/12/2014 at 12:14 point
2 things....

Make it round... *easy enough*

Make it shoot things. (more difficult... I would suggest CO2 and airsoft pellets.) Looks like you are getting the targeting down just fine.

------
Also use a raspberry pi to move the software to onboard.
The pellets though, I have my heart set on airsoft pellets.

Almost forgot. Add in either a ultrasonic rangefinder or laser rangefinder for additional accuracy.

Are you sure? yes | no

Aleksandar Bradic wrote 07/02/2014 at 22:16 point

Are you sure? yes | no

trungkstn wrote 05/19/2014 at 20:36 point
where can i buy material (motor, circuit and frame) of small quadcopter?

Are you sure? yes | no

Eric Evenchick wrote 04/07/2014 at 15:38 point
Wasn't sure if this project was serious at first. Glad to see it's actually coming together!

Are you sure? yes | no

RodolpheH wrote 04/07/2014 at 16:08 point
I wasn't sure either. I even had the same idea but I didn't found how to make it looks like in the movie. But since it's based on Star Wars, a lot of people want to see it finished. That is a good motivation for the creator !

Are you sure? yes | no

frederiek.vandepitte wrote 04/08/2014 at 15:10 point
By this saterday we should have a first movie.
It will be very exerimental, that's for sure

Are you sure? yes | no

Eric Evenchick wrote 04/08/2014 at 17:50 point
Nice, looking forward to seeing it.

Are you sure? yes | no

WimB wrote 04/08/2014 at 18:25 point
We've got some extra motivation now to keep up our great work!

Are you sure? yes | no

RodolpheH wrote 03/26/2014 at 08:03 point
Will it fire tiny lasers ?

Are you sure? yes | no

frederiek.vandepitte wrote 03/27/2014 at 12:32 point
Actualy the droid fired plasma bolts (see link), but we might add that functionality of a "laser targetter".
(http://scifi.stackexchange.com/questions/13170/can-mirrors-be-used-to-deflect-lightsabers)

Are you sure? yes | no

smok wrote 03/25/2014 at 21:44 point
I'm intrigued. Would it be a multicopter?

Are you sure? yes | no

Roeland54 wrote 03/25/2014 at 22:51 point
The anti-gravity device is still on my to do list... so yes it will be a multicopter.

Are you sure? yes | no

Eric Evenchick wrote 03/27/2014 at 16:30 point
There going to be the risk of getting hit with the blades... that's some serious encouragement!

Are you sure? yes | no

# Does this project spark your interest?

Become a member to follow this project and never miss any updates