VB Windows Hexapod Control Program based on Xan's Code

okay ichange port to 6062 from API

the the error doesnt come. but when i enable facetracking
the hex controll crap…

hmm i dont know.

the tracking works fine when you using?

Here are the long-promised videos of my hex tracking blue objects! Currently running my VB.net software + Roborealm. Hardware = SSC32 and bluetooth. Enjoy.

Youtube links:

Video 1:
youtube.com/watch?v=VPvZATRDbXk
Video 2:
youtube.com/watch?v=6hwTM1mO42Y

great :smiley:

it looks really good!

Hi Flowbot,

I already said before that I like the way you’ve mounted the cam on top of the hex. It gives it a unique look!

Great work on the tracking part! How do you control the neck? Do you move it to his max and start walking then or do you move the body and neck like 20/80%?

Have you got a link to the cam you’re using. I’m curious about the spec’s.

Keep up the good work!

Xan

Yeah, I would like to know what camera your using too.

Thanks!

Right now his movement is triggered at 80% of max. I found that it creates a smoother overall motion.

Here is a link to the camera:
rfwel.com/shop/product.php?productid=1432 - $160
digitbus.com/home-security/w … -time.html - $80

I would have to say that I have been really pleased with this camera overall. It is the perfect size, easy to mount (the original mount just screws off the bottom and I just screwed it back onto a plate!) It also has a built in li-ion battery (still deciding if I like that) and nightvision.

The only drawback is that because it uses IR for nightvision, it has a red filter on the lens. This makes the color red show up really weak in the standard daytime picture. So, for example the robot has trouble telling the difference between skin and say my mission style furniture.

While watching your videos I couldn’t help thinking that I could get about the same reaction to waving a small bag of cookies (or chips) in front of a 2yo… except when you placed it on the floor they would have pounced on it. :smiling_imp: :smiley: :laughing:

I’m glad you didn’t think it was a commercial for “Pledge Multi-surface Wipes”! I was a little worried. :open_mouth:

Xan, here is the code for the face tracking…it is still a little rough but it gets good results:

[code] Private Sub FaceTracking()
'Input variables
Dim VisionHeight As Integer = 0
Dim VisionWidth As Integer = 0
Dim VisionArea As Integer = 0
Dim InputString As String = 0
Dim COGx As Double = 0
Dim COGy As Double = 0
Dim ObjectSize As Double = 0
'Calculations
Dim CenterX As Double = 0
Dim CenterY As Double = 0
Dim MovementCorrectionFactor As Integer = 75 'Percentage of “offcenterness” to correct per move
Dim DeadZone As Integer = 20 'In Pixels…should equal the smallest unit of pixels/degree
Dim MoveIncrement As Integer = 25 'Pixels/servo degree
Dim MoveTotal As Double = 0

    'Calculate Vision Field Size and Center
    VisionSource.GetDimension(VisionWidth, VisionHeight)
    VisionArea = VisionHeight * VisionWidth
    CenterX = VisionWidth / 2
    CenterY = VisionHeight / 2

    'Get Object Position Data and Convert to Numbers
    InputString = VisionSource.GetVariable("COG_X")
    If InputString = "" Then
        COGx = CenterX
    Else
        COGx = Double.Parse(InputString)
    End If

    InputString = VisionSource.GetVariable("COG_Y")
    If InputString = "" Then
        COGy = CenterY
    Else
        COGy = Double.Parse(InputString)
    End If

    InputString = VisionSource.GetVariable("COG_BOX_SIZE")
    If InputString = "" Then
        'Do nothing
    Else
        ObjectSize = Double.Parse(InputString)
        ObjectSize = Math.Pow(ObjectSize, 2)
    End If

    'Track
    If Math.Abs(COGx - CenterX) < DeadZone Then
        'Camera is in deadzone so do nothing
    Else
        MoveTotal = (((COGx - CenterX) / MoveIncrement) * (MovementCorrectionFactor / 100))
        HeadPanY = HeadPanY + MoveTotal
        If HeadPanY > HeadPan_MAX Then
            HeadPanY = HeadPan_MAX
        ElseIf HeadPanY < HeadPan_MIN Then
            HeadPanY = HeadPan_MIN
        End If
    End If

    If Math.Abs(COGy - CenterY) < DeadZone Then
        'Camera is in deadzone so do nothing
    Else
        MoveTotal = (((COGy - CenterY) / MoveIncrement) * (MovementCorrectionFactor / 100))
        HeadTiltX = HeadTiltX + MoveTotal
        If HeadTiltX > HeadTilt_MAX Then
            HeadTiltX = HeadTilt_MAX
        ElseIf HeadTiltX < HeadTilt_MIN Then
            HeadTiltX = HeadTilt_MIN
        End If
    End If

    'Turning in circle to track movement
    If HeadPanY >= (0.8 * HeadPan_MAX) Then
        'Debug.Print("Right")
        TravelRotationY = TravelRotationYMax / 2
    ElseIf HeadPanY <= (0.8 * HeadPan_MIN) Then
        'Debug.Print("Left")
        TravelRotationY = -TravelRotationYMax / 2
    Else
        TravelRotationY = 0
    End If

    'Tilting body up/down to track movement
    If HeadTiltX >= (0.65 * HeadTilt_MAX) Then
        'Debug.Print("Up")
        If Math.Abs(BodyRotX - 1) < (BodyRotXMax / 4) Then
            BodyRotX = BodyRotX - 1
        End If
    ElseIf HeadTiltX <= (0.45 * HeadTilt_MIN) Then
        If Math.Abs(BodyRotX + 1) < (BodyRotXMax / 4) Then
            BodyRotX = BodyRotX + 1
        End If
    Else
        BodyRotX = 0
    End If

End Sub[/code]

flowbotx, this code do you have inegrate in V1.1?
its true? or do you have an modyfications?
its the original… in V1.1 i think.

realy cool

Nice catch. No, all of this is not in 1.1.

Version 1.2 of the software with Roborealm support (the one you see in the video) has been posted. See first post thread and enjoy.

Did you ever get it running btw?

What turret are you using for the camera? Lynx B - Pan and Tilt Kit from lynxmotion? Do you have it operating from the ssc-32?

It is a custom turret that I had made by Big Blue Saw…it is based on one similar to this but used differently:
hexapodrobot.com/products/ro … 1-PTH.html

And, yep, it is being controlled by the SSC32.

Hi Flowbot,

Thanks for sharing your code. I’ve checked your code and noticed that you start walking at 80% like you said on a earlier post. Did you also tried twisting the body before starting to walk? I think this would even make it look more natural then it already does!

Xan

Yeah. I thought that twist at 60% and walk at 80% might look really nice…just haven’t implmented it yet.

Version 1.2a is coming…

Upgrades:

Cosmetic:
Drop down box for gait selection (you aksed for it T4ndu, you got it!)
Check box for on road/ off road selection
Completely new tab dedicated to blob tracking

Features:
Individual blob tracking features can now be turned on and off and/or combined…such as twisting, 360 degree rotation, head movement, tilt etc.

wow
great!

I look forward to it.
because really what have you done good

realy cool!

This is what I’m thinking about for options, in order of preference:

  1. Custom turret that FlowbotX had made by Big Blue Saw. I really liked the behavior in the video, it was perfect. I would need specs I could send to Big Blue Saw, servos used, preferably pictures of how it was mounted. A close up of the mounting would be helpful regardless of which option I choose.

bigbluesaw.com/saw/

  1. The MSR-H01 Pan/Tilt Head Kit. I think I saw this in another video. I looked good for the sensor setup but not sure how it would work for a camera setup.

hexapodrobot.com/products/robots/Hexapod_MSR-H01-PTH.html

3a. Lynx A-Pan and Tilt. This seems like what would probably work best (over option 3b) but I can’t tell from the picture.

lynxmotion.com/images/html/build016.htm

3b. Lynx B - Pan and Tilt Kit. This looks like it would work but seems a little high up in the air. Hard to tell without actually seeing it.

lynxmotion.com/Product.aspx?productID=287&CategoryID=61

I ordered this from Wal-mart. Seems to be stuck in infrared mode even in full lighting. The infrared lights turn on and off properly and infrared mode works properly in the dark but doesn’t seem to switch off when back in light (even though I can see the infrared lights turn off). Ends up having a more or less black and white negative image with no color. Sent a message to Astak support. They didn’t have much for trouble shooting on their site so I’m not very hopeful. May have to send it back.

walmart.com/catalog/product.do?product_id=5903356

That’s ultra-strage. My camera switches back and forth with ease. I would try to return it and get another.

Also, what hexapod do you have? Because that might influence which will be the best pan/tilt option. Do you have project thread?

Additionally, I can send you the cad file I sent to Big Blue Saw. But, I’m not sure what the price will be right now since they aren’t having a sale. They do, however, have sales every so often.