Final video of the day - why translation can't be picked up by the motionplus.
Showing posts with label video. Show all posts
Showing posts with label video. Show all posts
Wednesday, December 15, 2010
Horizontal orientation
I can thoroughly recommend Will Kymlicka's Contemporary Political Philosophy, if you're into that sort of thing. What I mean while I'm waggling my hand around is that an airship shouldn't pitch or roll too much (yaw being rotation in the horizontal plane).
Angle
Secondly, I now have a genuine wiimote with the motionplus attachment. This, at the moment, only gives the rotation speed (or rate of change of angle, if you want to put it that way) of the three axes - none of the reverse-engineering projects seem to have been able to get any other information out of it.


Top three graphs are the acceleration, velocity, and position again. The bottom two are the rate of angle change and (by integration again) the angle. What I did with the wiimote was to hold it in a steady orientation, and then twist it (as accurately as I could) 90 degrees around each axis and back again fairly quickly - you can see that in the three humps in the bottom graph. This integrated data seems to be more accurate in some respects than the raw orientation data you get from the accelerometers.
It may look as if I fumble and drop the wiimote at the start of this video. This was entirely intentional. Honest.
Position
Still haven't become a LabVIEW expert, though I did start the computer-based training and there's a fairly good explanation of state transition diagrams which should be useful for the students when they come to design code.
What I have done is to modify the code from here, so I can plot graphs of acceleration, velocity and position. As I thought, nowhere near accurate enough for navigation - although talking to Simon before a meeting this morning, it seems they aren't going to be expected to fly the airship around, just take off, hover and land.
Here's a graph showing what happens when I lift the wiimote off the desk and put it down again, fairly quickly.

The top graph shows acceleration, the middle one velocity, and the bottom one position. I think the best you can say about this is that it's clear that the blue line is the vertical acceleration, and the wiimote started moving about 1.75 seconds after I hit the record button. Calculation errors eventually lead to a bogus velocity in all three directions, even when the device is returned to the rest position - all three velocity lines and the position line should return to zero after about 2.5 seconds.
What I have done is to modify the code from here, so I can plot graphs of acceleration, velocity and position. As I thought, nowhere near accurate enough for navigation - although talking to Simon before a meeting this morning, it seems they aren't going to be expected to fly the airship around, just take off, hover and land.
Here's a graph showing what happens when I lift the wiimote off the desk and put it down again, fairly quickly.

The top graph shows acceleration, the middle one velocity, and the bottom one position. I think the best you can say about this is that it's clear that the blue line is the vertical acceleration, and the wiimote started moving about 1.75 seconds after I hit the record button. Calculation errors eventually lead to a bogus velocity in all three directions, even when the device is returned to the rest position - all three velocity lines and the position line should return to zero after about 2.5 seconds.
Wednesday, December 8, 2010
More LabVIEW
Another one of the example VIs, showing orientation and button presses. Unfortunately I didn't have time this afternoon to become a LabVIEW expert from scratch, maybe tomorrow.
LabVIEW and Windows
Instructions are here: http://decibel.ni.com/content/docs/DOC-1353
This is running inside a Windows XP virtual machine, thanks to VirtualBox.
Time to start learning about LabVIEW...
This is running inside a Windows XP virtual machine, thanks to VirtualBox.
Time to start learning about LabVIEW...
Multiple IR sources
Aiming the wiimote out of the window on a moderately sunny day, to show how it picks up multiple IR highlights. (I say "intensity and size" towards the end - I mean "intensity and position", of course).
Tuesday, December 7, 2010
More video
Roughly the same program as in the previous post, though I have fiddled with it slightly.
#!/usr/bin/python
import cwiid
from time import sleep
print "Press 1+2 on the Wiimote now"
wiimote = cwiid.Wiimote()
# Rumble to indicate a connection
wiimote.rumble = 1
print "Connection established - release buttons"
sleep(0.2)
wiimote.rumble = 0
sleep(2.0)
print "Up / Down / Left / Right = toggle LEDs."
print "A/B = long/short vibrate."
print "+/- = start/stop display of accelerometer data."
print "1/2 = start/stop display of infra-red data."
print "Home = end program."
wiimote.enable(cwiid.FLAG_MESG_IFC)
wiimote.rpt_mode = cwiid.RPT_ACC | cwiid.RPT_BTN | cwiid.RPT_IR | cwiid.RPT_STATUS
loop = True
show_acc = False
show_infrared = False
last_acc = (0, 0, 0)
delta_acc = [0, 0, 0]
led_status = 0
last_ir = ""
rumble_counter = 0
while (loop):
sleep(0.01)
messages = wiimote.get_mesg()
if rumble_counter:
rumble_counter = rumble_counter - 1
if rumble_counter == 0:
wiimote.rumble = 0
for mesg in messages:
# Accelerometer:
if mesg[0] == cwiid.MESG_ACC:
if show_acc:
acc = mesg[1]
if acc != last_acc:
for i in range(3):
delta_acc[i] = acc[i] - last_acc[i]
print "Acc: {0[0]:5} {0[1]:5} {0[2]:5} {1}".format(
delta_acc, acc)
last_acc = acc
# Button:
elif mesg[0] == cwiid.MESG_BTN:
if mesg[1] & cwiid.BTN_HOME:
print "Ending Program"
loop = False
if mesg[1] & cwiid.BTN_PLUS and not show_acc:
show_acc = True
if mesg[1] & cwiid.BTN_MINUS and show_acc:
print "Ending accelerometer display"
show_acc = False
if mesg[1] & cwiid.BTN_B:
rumble_counter = 10
wiimote.rumble = 1
if mesg[1] & cwiid.BTN_A:
rumble_counter = 30
wiimote.rumble = 1
if mesg[1] & cwiid.BTN_UP:
led_status = led_status ^ cwiid.LED1_ON
wiimote.led = led_status
if mesg[1] & cwiid.BTN_DOWN:
led_status = led_status ^ cwiid.LED2_ON
wiimote.led = led_status
if mesg[1] & cwiid.BTN_LEFT:
led_status = led_status ^ cwiid.LED3_ON
wiimote.led = led_status
if mesg[1] & cwiid.BTN_RIGHT:
led_status = led_status ^ cwiid.LED4_ON
wiimote.led = led_status
if mesg[1] & cwiid.BTN_1 and not show_infrared:
show_infrared = True
last_ir = ""
if mesg[1] & cwiid.BTN_2 and show_infrared:
print "Ending IR display"
show_infrared = False
# Infra-red
elif mesg[0] == cwiid.MESG_IR:
if show_infrared:
sources = mesg[1]
output = "IR: "
for spot in sources:
if spot:
output = output + \
"S {0} P {1:12}".format(spot["size"], spot["pos"])
found = True
if output != last_ir:
print output
last_ir = output
else:
print mesg
Friday, December 3, 2010
Subscribe to:
Posts (Atom)