Getting Hexy the Hexapod and my Nexus 7 to talk to each to other using AI2

In my last post I had 2 basic goals. I wanted to get a blue-tooth connection going between hexy and my nexus (accomplished) and do a head wave…
I didn’t get the head wave but I did access an individual servo, managed to center the servos, and kill the servos in code. So I’m thinking we accomplished the initial goals.

When hexy has his legs centered(my daughter has declared hexy as male) all servos are on and he’s sort of stiff. Somehow is back left hip servo gets into resonance and starts vibrating. I feel sort of bad for the guy.. I issue the kill command and that shuts off all the servos, but it also terminates the blue tooth connection.

Anyway. I found setting up an blue tooth connections to be incredibly easy in AI2..
HexAi2Screenshot

I had made a blue tooth connection with hexy (red light goes solid) but took me a little while to figure out how to send a move command which looks like.
Here is the terminal output for pomoco command for centering.
pomocoTerminalOutput

Here is firmware section of code reading the code.
Servo32ScreenShot

And I found tally count to be interesting as well:
tallyCount

What I find somewhat confusing at the moment it the T’s in the data stream.. It seems the firmware at the moment attempts to ignore it.. Hmmm.. I think I found a bug…currently tallycount reads 4 digits. If the servo time is less than 4 digit length it will add the 0 from the T command..

Ok..I’m looking at the pomoco move command..

PomocoMoveCommand

hmmm. It appears there’s another critter in the move command.

It looks like the move command with power off is never fired… I believe this line:
toSend = “#%.4dL\r”%(self.servoNum,int(servoPos))”
would error out if ever executed.

So.. It seems like the basic Pomoco commands work.. It just seems that may be critters in the main code.
I think for now, I’m just going to dump out the basic commands that exist and try exporting them to a tinywedb.

If I catch the hexapod bug and want to implement some more code, this these links look very interesting to me:
http://www.lynxmotion.net/viewtopic.php?f=8&t=8697 and
http://arduin0.blogspot.com/2012/01/inverse-kinematics-ik-implementation.html
Although I think I’m probably have way too many irons in the fire to get to this…

Anyway… for now.. I just want to keep things small and achieveable a hopefully fall not too deep in the rabbit hole

Next step goals:

  • My next move is going to be to make a tinydb object called tinydbMoves
  • Basically I’m just going to hardcode this one with the following values from a pomoco wave.
  • Execute code on startup to populate the object. (tinydb is not persistant in development)
  • create a way button and create a procedure to execute the tinydb tag.
  • Once the wave is working I would say that goal would be achieved..
    Then I think the thing to do after that would be to setup a tinywebdb and poplulate it with the moves from ponoco and download it.. Some where in there( I would need to compensate for offsets.) But that’s getting way ahead of myself… Baby steps for now..
    Just a side note… this looks interesting.
    http://appinventor.mit.edu/appinventor-sources/

    So.. This is the data from a wave..

    #31P1500T0
    #7P1277T0
    #6P1500T0
    #5P1500T0
    #7P1277T0
    #6P944T0
    #5P1277T0
    #6P1388T0
    #5P1500T0
    #7P1277T0
    #6P944T0
    #5P1277T0
    #6P1388T0
    #5P1500T0
    #7P1277T0
    #6P944T0
    #5P1277T0
    #6P1388T0
    #5P1500T0
    #6P1055T0

    I believe servo 31 is the head…
    I’m just going hard code this into a tinydbMoves for now.. (If it works I’ll probably try it without the T0 which I think is redundant for now….)

    I got the routines to load and fire… It appears that I need to put a delay function into the code(I figured as much. My suspicion is that this is built into the pomomoco software..) I suspect that’s what the T was for..

    Anyway… Need to study the ponoco code a bit more and figure out how to do a delay in Ai2..
    Soo.. The screen shot below is missing the delay but it does seem to be working.

    BasicHexAi2TinydbMove

    Ok… It looks the delay is built here…
    WaveInPomoco

    This entry was posted in Uncategorized. Bookmark the permalink.

    Leave a Reply

    Your email address will not be published. Required fields are marked *