Wiimote Project » Wiimote Projects » Wiimote accelerometer & motions detecting projects » wiimote analyzer (eziosoft) [update 18/12/2008]
: 1 [2] 3
   
: wiimote analyzer (eziosoft) [update 18/12/2008]  ( 40161 )
0 and 1 Guest are viewing this topic.
Guru
*
Karma: +7/-0
: 203
Offline Offline
MSN Messenger - stoneydumples@hotmail.com AOL Instant Messenger - stoneydumples
« #15 : December 17, 2008, 08:19:51 AM »

Fantastic!


~"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."~
- EF Schumacher
*
Karma: +0/-0
: 35
Offline Offline
« #16 : December 17, 2008, 08:43:22 AM »

If someone is interested as a starting point and hack a bit more, I think (digging in the hard drive) this was a working piece of code, after installing Python for Maemo on my Nokia 770 (but it should work with few modifications also on PC, and other maemo platforms like N800, N810, N810 WiMax).

Code: [Select]
#!/usr/bin/python

#    This program is free software. It comes without any warranty, to
#    the extent permitted by applicable law. You can redistribute it
#    and/or modify it under the terms of the Do What The **LOVE** You Want
#    To Public License, Version 2, as published by Sam Hocevar. See
#    http://sam.zoy.org/wtfpl/COPYING for more details.

import pygame, os
from pygame.locals import *
from bluetooth import BluetoothSocket, BluetoothError, L2CAP
import thread, time

WIDTH = 512
HEIGHT = 256 # Don't change this one

# ADDRESS = '00:00:00:00:00:00' # PC1 - your PC bluetooth address here
# ADDRESS = '00:00:00:00:00:00' # Nokia 770 - your device bluetooth address here
ADDRESS = '00:00:00:00:00:00' # Wiimote - your wiimote bluetooth address here

def init_pygame(): 
  ISMAEMO         = False
  if os.name=="posix" and os.path.exists('/media/mmc1'): ISMAEMO=True
 
  SCREENRECT = Rect(0, 0, 512, 256)

  os.environ["SDL_VIDEO_X11_WMCLASS"]="wiimote"

  pygame.init()
  pygame.display.set_caption('wiimote')
  pygame.mixer.quit() # we don't want pygame hogging the audio device

  # set the display mode
  winstyle = FULLSCREEN
  if not ISMAEMO: winstyle = 1

  bestdepth = pygame.display.mode_ok(SCREENRECT.size, winstyle, 16)
  if not ISMAEMO: bestdepth = pygame.display.mode_ok(SCREENRECT.size, winstyle, 32)

  screen = pygame.display.set_mode(SCREENRECT.size, winstyle, bestdepth)
  if ISMAEMO: pygame.mouse.set_visible(False)
  return screen


# Listening thread
def listener():
    global connected, sensor, fdin, fdout
    # fdin.settimeout(0.1)
    while connected == 1:
        try:
            msg = fdin.recv(23)
        except BluetoothError:
            continue
        if len(msg) >= 7:
            sensor = ord(msg[4])
    print ord(msg[4])
    fdin.close()
    fdout.close()
    connected = -1


def main():
    global connected, sensor, fdin, fdout
    screen = init_pygame()

    # Try to connect
    print 'connecting to ' + ADDRESS + ', please be sure it is discoverable and connectable'
    fdin = BluetoothSocket(L2CAP)
    fdin.connect((ADDRESS, 0x13))
    fdout = BluetoothSocket(L2CAP)
    fdout.connect((ADDRESS, 0x11))
    if not fdin or not fdout:
            raise 'could not connect, check the address'
    # Open window
    pygame.init()
    window = pygame.display.set_mode((WIDTH, HEIGHT), 0)
    color_WHITE = window.map_rgb(255, 255, 255)
    pygame.display.set_caption('Receiving:')
    # Run listener
    old = 127
    sensor = 127
    connected = 1
    thread.start_new_thread(listener, ())
    fdout.send("\x52\x12\x00\x31")
    # Main display loop
    while connected == 1:
        pixels = pygame.surfarray.pixels2d(window)
        for t in range(min(old, sensor) + 1, max(old, sensor)):
            pixels[WIDTH - 3][t] = color_WHITE
        pixels[WIDTH - 2][sensor] = color_WHITE
        old = sensor
        del pixels
        window.unlock()
        window.blit(window, (-1, 0))
        pygame.display.flip()
        for ev in pygame.event.get():
            if ev.type == QUIT: connected = 0
            time.sleep(0.01)
    while connected == 0:
            time.sleep(0.01)
    pygame.display.quit()

if __name__ == '__main__': main()

« : December 17, 2008, 08:45:19 AM insertnick »
Support Admin
*
Karma: +49/-0
: 1178
Offline Offline
MSN Messenger - benpaddlejones@live.com.au
« #17 : December 17, 2008, 04:17:06 PM »

eziosoft
Could the program replay a log? Or even better could it be recorded in a video format?

What would be really cool if the graphing as a video file was loaded next to a video recording of the event synced and played in slow-motion.

This would be something no other data logger on the market can do. You would have science teachers around the world using your application!

benpaddlejones :)




See my full profile and links on my Google Profile: http://www.google.com/profiles/benpaddlejones
*
Karma: +3/-0
: 39
Offline Offline
« #18 : December 17, 2008, 05:02:50 PM »

Reply is not a problem, but video hmmm I have to use google :)
Should I start to make money on this.

Again, I have a few new features such as measurement of distances, and automatic graph in Excel.
I'll post it soon

Support Admin
*
Karma: +11/-3
: 566
Offline Offline
« #19 : December 17, 2008, 05:08:44 PM »

I think i talked about connecting it to my PDa but I havent done anything with it...but I can connect to my SE P1i with MobiPad (symbian)

*
Karma: +3/-0
: 39
Offline Offline
« #20 : December 17, 2008, 05:17:28 PM »

Yes, in symbian is possible. In Windows Mobile not yet. We need a driver:) Maybe one of you will write it?  :D

*
Karma: +3/-0
: 39
Offline Offline
« #21 : December 17, 2008, 09:09:49 PM »

eziosoft
Could the program replay a log? Or even better could it be recorded in a video format?

What would be really cool if the graphing as a video file was loaded next to a video recording of the event synced and played in slow-motion.

This would be something no other data logger on the market can do. You would have science teachers around the world using your application!

benpaddlejones :)





Like this  8)

[youtube]http://fr.youtube.com/watch?v=8XafWDaoA7s[/youtube]

I'll relase this soon.

Guru
*
Karma: +7/-0
: 203
Offline Offline
MSN Messenger - stoneydumples@hotmail.com AOL Instant Messenger - stoneydumples
« #22 : December 18, 2008, 04:35:02 AM »

Fantastic! Doing a split screen type thing and syncing the playback log with footage of the roller-coaster, bike, or car the wiimote was attached to at the  time would be a wonderful learning resource.


~"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."~
- EF Schumacher
Support Admin
*
Karma: +49/-0
: 1178
Offline Offline
MSN Messenger - benpaddlejones@live.com.au
« #23 : December 18, 2008, 01:33:18 PM »

Like this  8)

[youtube]http://fr.youtube.com/watch?v=8XafWDaoA7s[/youtube]

I'll relase this soon.

Awesome!

benpaddlejones


See my full profile and links on my Google Profile: http://www.google.com/profiles/benpaddlejones
*
Karma: +3/-0
: 39
Offline Offline
« #24 : December 19, 2008, 11:23:01 AM »

I decided that I will give you the ability to create video before christmas

to create video from jpg's you can use ie. JPGVideo

I am waiting for your movies

[youtube]http://fr.youtube.com/watch?v=khnXu6FNkoc[/youtube]
« : December 19, 2008, 01:50:52 PM eziosoft »

Guru
*
Karma: +7/-0
: 203
Offline Offline
MSN Messenger - stoneydumples@hotmail.com AOL Instant Messenger - stoneydumples
« #25 : December 19, 2008, 11:59:20 AM »

I'm assuming you select the wii_log.txt, then choose a folder where it's going to export the jpeg's?

It crashed on me after I selected the the folder, so I'm not really sure. If you'd like, I can post the crash log.


~"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."~
- EF Schumacher
*
Karma: +3/-0
: 39
Offline Offline
« #26 : December 19, 2008, 01:49:24 PM »

sorry this was my mistake. I forgoted to add one file.
This is very very alfa.

*
Karma: +3/-0
: 39
Offline Offline
« #27 : January 05, 2009, 03:47:16 PM »

I intend to write a new version of wiimote analyzer. The current version is not refined and contains errors.
Waiting for your proposals, what need to be improved, added, changed ...

Support Admin
*
Karma: +49/-0
: 1178
Offline Offline
MSN Messenger - benpaddlejones@live.com.au
« #28 : January 07, 2009, 05:24:03 AM »

eziosoft
Neat code is always nice!

My only addition would be multiple wiimote support. How cool would it be to compare the same event from two perspectives.

benpaddlejones :)


See my full profile and links on my Google Profile: http://www.google.com/profiles/benpaddlejones
*
Karma: +0/-0
: 1
Offline Offline
« #29 : January 08, 2009, 12:44:45 AM »

Hi...
I'm sorry I can't seem to find the download link... where can I download this from?
Do you have the source code?
Thanks
: 1 [2] 3
   
 
:  

Clicky Web Analytics