Xan's Phoenix Code

Hi Xan,

YES. I’ll share it! Please be patient… :wink:

I think I understood what you meant, and I think my english are pretty bad too. Not that I mean yours bad at all :wink: I remember having a business trip to Netherland, and I was always amazed of how many equaly sounded words you have in your language as for norwegian. Maybe your gramma are similar to ours? I don’t know, but I’ve no problem understanding you anyway. :blush: pardon my bad english :laughing:

I found an article about “stepping patterns in ants”. Very interesting, and my goal is to implement that. The rear legs have a bit further travellengths, I think :unamused:

Hi zenta and xan, i relly interested in inverse kinematic and also the balance gesture calculation for hexapod robot. now, i’m buildfing a hexapod robot using futaba S3102 servo. can both of you share about the calculation? and also for the gait.

xan, ive download your source code that you post. I’m confused with the coordinate. where is x, y and z. can you draw me the explanation? and also aout the rotatio0n x, y and z. thanx alot

Hi edi14_10,

Off course I’m willing to share but what exactly do you need? The IK calculations are included in my code and if you want to figure out how it completely works I suggest that you take a close look to Zenta’s PEP. I think it is easier to figure out the IK with the PEP because you can change values on your pc and see what happens. There are also some good books and sites around where you can get information. And there is a lot of information on this forum :wink:

Yeah you are right about the coordinates, they are not standard. The coordinates are referred to the front of the bot and not the top. So if you look at the front, X is sideways, Y is up/down, Z is forward/backward.

I hope this helps! Good luck!

Xan

**Hi guys. the work you have done with these hexapods are outstanding.
without kissing your ass too much, i am wondering if the abillity’s of this code…> **

((phorip01.bas)) *
**
<…can be edited to work with BA28 rather than with BApro, and also SSC-32 v1! This also meaning 'the earlier version of LynxTerm, Basic Micro Atom IDE, and SSC-32 Firmware!
*
**
Phoenix Bot Board II / BASIC Atom Pro Tutorial-**
lynxmotion.com/images/files/phorip01.bas

**more to the point im looking for hexapod ripple code to run on the above! **

thanx!

I can tell you that adding support for the Atom 28 is not likely to ever happen. The Pro is much faster and holds larger programs. I doubt the Phoenix code will run on the slower Atom processor. Besides I know what new features Zenta and Xan are working on. I’m sure they want to move forward on their code and not start spinning wheels making changes to the code for the slower Atoms…

***thank. as you may have guessed i was expecting that reply. Im all for ripping the code down, just wanted to know how?

When looking at a hexapod ripple code, (one leg at a time or two up at a time with a slight delay) its easy to see that if the middle legs are removed it acctulay resembles a quad gait!

having said this, with a few body (cog) tweeks i feel i could get my quad design to walk!***

http://i531.photobucket.com/albums/dd355/innerbreed/20080526_115722.jpg

Anything is poss-
Tripod Actually Walking!
youtube.com/watch?v=4FABBKPo … re=related

hey that is pretty sharp looking! :slight_smile:

can you “tilt” and “rotate” the body with the feet stationary?

the reason I ask is you may be able to exploit the fact the head can shift the center of gravity away from a moving leg, allowing you to reposition the leg forward of its previous position… effectively doing a one leg at a time walk sequence.

I agree! Nice looking bot! Keep up the great work.

EddieB>

thank you for your comments.
follow link on this project. dont want to spam thread.

lynxmotion.net/phpbb/viewtop … ht=stalker

Hi innerbreed,

You sure made a cool looking walker! I followed your thread as well and I love your innovating way of building legs from heli parts. :wink:

But back to the topic. I agree with Jim and I think that you’re better of switching to the pro version as well. Running the code on SSC V1 shouldn’t be a problem since V1.1 of the code uses software offsets.

I think that it is possible to get the code up and moving on 4 legs with some modifications. But walking should be a different story because a hex don’t need to worry a lot about the COG.

Xan

Xan,

I want you to take a look at this code for your servodriver function. I know it is in VB… that is because I have been working on it as part of my project but you could port it back and use it in your code.

Essentially, it has the exact same function as your servodriver code but doesn’t send repeat servo commands if the positions haven’t changed. It saves alot of bandwidth in and out of your serial connection.

Check it out:

[code]
'--------------------------------------------------------------------
'[PULSE WIDTH CHECKS](Variables initialized to 0)
'These variables store the last pulse width string sent to a servo
Dim RFCoxaLastPWStringSent As String = “” 'Last pulse-width command send to SSC-32
Dim RFFemurLastPWStringSent As String = “”
Dim RFTibiaLastPWStringSent As String = “”

Dim RMCoxaLastPWStringSent As String = ""
Dim RMFemurLastPWStringSent As String = ""
Dim RMTibiaLastPWStringSent As String = ""

Dim RRCoxaLastPWStringSent As String = ""
Dim RRFemurLastPWStringSent As String = ""
Dim RRTibiaLastPWStringSent As String = ""

Dim LFCoxaLastPWStringSent As String = ""
Dim LFFemurLastPWStringSent As String = ""
Dim LFTibiaLastPWStringSent As String = ""

Dim LMCoxaLastPWStringSent As String = ""
Dim LMFemurLastPWStringSent As String = ""
Dim LMTibiaLastPWStringSent As String = ""

Dim LRCoxaLastPWStringSent As String = ""
Dim LRFemurLastPWStringSent As String = ""
Dim LRTibiaLastPWStringSent As String = ""

'--------------------------------------------------------------------
'[SERVO DRIVER] Updates the positions of the servos
Private Sub ServoDriver()
Dim NextPWStringToSend As String = “”
Dim TotalPWStringToSend As String = “”
Dim DataSent As Boolean = False

    'Front Right leg
    'Coxa
    NextPWStringToSend = "#" & RFCoxaPin & "P" & Math.Round((-RFCoxaAngle + 90) / 0.10588238) + 650
    If RFCoxaLastPWStringSent = NextPWStringToSend Then
        'Do nothing
    Else
        TotalPWStringToSend = TotalPWStringToSend + NextPWStringToSend
        RFCoxaLastPWStringSent = NextPWStringToSend
        DataSent = True
    End If
    'Femur
    NextPWStringToSend = "#" & RFFemurPin & "P" & Math.Round((-RFFemurAngle + 90) / 0.10588238) + 650
    If RFFemurLastPWStringSent = NextPWStringToSend Then
        'Do nothing
    Else
        TotalPWStringToSend = TotalPWStringToSend + NextPWStringToSend
        RFFemurLastPWStringSent = NextPWStringToSend
        DataSent = True
    End If
    'Tibia
    NextPWStringToSend = "#" & RFTibiaPin & "P" & Math.Round((-RFTibiaAngle + 90) / 0.10588238) + 650
    If RFTibiaLastPWStringSent = NextPWStringToSend Then
        'Do nothing
    Else
        TotalPWStringToSend = TotalPWStringToSend + NextPWStringToSend
        RFTibiaLastPWStringSent = NextPWStringToSend
        DataSent = True
    End If

    'Middle Right leg
    'Coxa
    NextPWStringToSend = "#" & RMCoxaPin & "P" & Math.Round((-RMCoxaAngle + 90) / 0.10588238) + 650
    If RMCoxaLastPWStringSent = NextPWStringToSend Then
        'Do nothing
    Else
        TotalPWStringToSend = TotalPWStringToSend + NextPWStringToSend
        RMCoxaLastPWStringSent = NextPWStringToSend
        DataSent = True
    End If
    'Femur
    NextPWStringToSend = "#" & RMFemurPin & "P" & Math.Round((-RMFemurAngle + 90) / 0.10588238) + 650
    If RMFemurLastPWStringSent = NextPWStringToSend Then
        'Do nothing
    Else
        TotalPWStringToSend = TotalPWStringToSend + NextPWStringToSend
        RMFemurLastPWStringSent = NextPWStringToSend
        DataSent = True
    End If
    'Tibia
    NextPWStringToSend = "#" & RMTibiaPin & "P" & Math.Round((-RMTibiaAngle + 90) / 0.10588238) + 650
    If RMTibiaLastPWStringSent = NextPWStringToSend Then
        'Do nothing
    Else
        TotalPWStringToSend = TotalPWStringToSend + NextPWStringToSend
        RMTibiaLastPWStringSent = NextPWStringToSend
        DataSent = True
    End If

    'Rear Right leg
    'Coxa
    NextPWStringToSend = "#" & RRCoxaPin & "P" & Math.Round((-RRCoxaAngle + 90) / 0.10588238) + 650
    If RRCoxaLastPWStringSent = NextPWStringToSend Then
        'Do nothing
    Else
        TotalPWStringToSend = TotalPWStringToSend + NextPWStringToSend
        RRCoxaLastPWStringSent = NextPWStringToSend
        DataSent = True
    End If
    'Femur
    NextPWStringToSend = "#" & RRFemurPin & "P" & Math.Round((-RRFemurAngle + 90) / 0.10588238) + 650
    If RRFemurLastPWStringSent = NextPWStringToSend Then
        'Do nothing
    Else
        TotalPWStringToSend = TotalPWStringToSend + NextPWStringToSend
        RRFemurLastPWStringSent = NextPWStringToSend
        DataSent = True
    End If
    'Tibia
    NextPWStringToSend = "#" & RRTibiaPin & "P" & Math.Round((-RRTibiaAngle + 90) / 0.10588238) + 650
    If RRTibiaLastPWStringSent = NextPWStringToSend Then
        'Do nothing
    Else
        TotalPWStringToSend = TotalPWStringToSend + NextPWStringToSend
        RRTibiaLastPWStringSent = NextPWStringToSend
        DataSent = True
    End If

    'Front Left leg
    'Coxa
    NextPWStringToSend = "#" & LFCoxaPin & "P" & Math.Round((-LFCoxaAngle + 90) / 0.10588238) + 650
    If LFCoxaLastPWStringSent = NextPWStringToSend Then
        'Do nothing
    Else
        TotalPWStringToSend = TotalPWStringToSend + NextPWStringToSend
        LFCoxaLastPWStringSent = NextPWStringToSend
        DataSent = True
    End If
    'Femur
    NextPWStringToSend = "#" & LFFemurPin & "P" & Math.Round((-LFFemurAngle + 90) / 0.10588238) + 650
    If LFFemurLastPWStringSent = NextPWStringToSend Then
        'Do nothing
    Else
        TotalPWStringToSend = TotalPWStringToSend + NextPWStringToSend
        LFFemurLastPWStringSent = NextPWStringToSend
        DataSent = True
    End If
    'Tibia
    NextPWStringToSend = "#" & LFTibiaPin & "P" & Math.Round((-LFTibiaAngle + 90) / 0.10588238) + 650
    If LFTibiaLastPWStringSent = NextPWStringToSend Then
        'Do nothing
    Else
        TotalPWStringToSend = TotalPWStringToSend + NextPWStringToSend
        LFTibiaLastPWStringSent = NextPWStringToSend
        DataSent = True
    End If

    'Middle Left leg
    'Coxa
    NextPWStringToSend = "#" & LMCoxaPin & "P" & Math.Round((-LMCoxaAngle + 90) / 0.10588238) + 650
    If LMCoxaLastPWStringSent = NextPWStringToSend Then
        'Do nothing
    Else
        TotalPWStringToSend = TotalPWStringToSend + NextPWStringToSend
        LMCoxaLastPWStringSent = NextPWStringToSend
        DataSent = True
    End If
    'Femur
    NextPWStringToSend = "#" & LMFemurPin & "P" & Math.Round((-LMFemurAngle + 90) / 0.10588238) + 650
    If LMFemurLastPWStringSent = NextPWStringToSend Then
        'Do nothing
    Else
        TotalPWStringToSend = TotalPWStringToSend + NextPWStringToSend
        LMFemurLastPWStringSent = NextPWStringToSend
        DataSent = True
    End If
    'Tibia
    NextPWStringToSend = "#" & LMTibiaPin & "P" & Math.Round((-LMTibiaAngle + 90) / 0.10588238) + 650
    If LMTibiaLastPWStringSent = NextPWStringToSend Then
        'Do nothing
    Else
        TotalPWStringToSend = TotalPWStringToSend + NextPWStringToSend
        LMTibiaLastPWStringSent = NextPWStringToSend
        DataSent = True
    End If

    'Rear Left leg
    'Coxa
    NextPWStringToSend = "#" & LRCoxaPin & "P" & Math.Round((-LRCoxaAngle + 90) / 0.10588238) + 650
    If LRCoxaLastPWStringSent = NextPWStringToSend Then
        'Do nothing
    Else
        TotalPWStringToSend = TotalPWStringToSend + NextPWStringToSend
        LRCoxaLastPWStringSent = NextPWStringToSend
        DataSent = True
    End If
    'Femur
    NextPWStringToSend = "#" & LRFemurPin & "P" & Math.Round((-LRFemurAngle + 90) / 0.10588238) + 650
    If LRFemurLastPWStringSent = NextPWStringToSend Then
        'Do nothing
    Else
        TotalPWStringToSend = TotalPWStringToSend + NextPWStringToSend
        LRFemurLastPWStringSent = NextPWStringToSend
        DataSent = True
    End If
    'Tibia
    NextPWStringToSend = "#" & LRTibiaPin & "P" & Math.Round((-LRTibiaAngle + 90) / 0.10588238) + 650
    If LRTibiaLastPWStringSent = NextPWStringToSend Then
        'Do nothing
    Else
        TotalPWStringToSend = TotalPWStringToSend + NextPWStringToSend
        LRTibiaLastPWStringSent = NextPWStringToSend
        DataSent = True
    End If

    
    'Send Line and <CR>
    If DataSent = True Then
        'Wait for previous commands to be completed
        'EDIT
        Do Until SSCDone = "."
            SendSerialData("Q" & Chr(13))
            SSCDone = ReadInputBuffer(1)
        Loop
        SSCDone = "+"

        SendSerialData(TotalPWStringToSend & "T200" & Chr(13))
    End If

End Sub[/code]

What do you think?

Flowbot

I agree. and i will be buying the new hardware. i did enquire to ActiveRobots about a month ago and she was going to ring me afew days after my enquiry but never did. also they put a huge markup on the products so i have been looking on ebay and other things.

I have a ATMEGA168-20PU MCU chip laying about, will that work all the same with the SSc-32?

cant find Atom Pro at a good price and as LM dont do international transactions im stuck for choice.

LM have this chip at the right price and i only wish i could find a uk distrobutor that doesnt add high % to the cost.

Trust me i will be orderong it at some point!

thanx guys.

Hi Flowbot,

Thanks for sharing your code and ideas with us! I really appreciate it!

This does sound like a good idea and I did thought about it but decided that I couldn’t use is in my application. Using IK makes it possible to get really fluid movements but on the other hand, if a parameter is only slightly changed, all the servos will move. Try moving or rotating the body, All the servos will change. Only moving one leg at the time will move 3 servos max. But while walking, all legs are moving because if 1 or more legs are in the air, the other legs are pushing the body in the right direction.

This functionality will definitely be a good thing in other applications but in this application will only make the uC more sweaty :wink:

Xan

Hi All,

I just mailed V1.2 of my code to Jim. :smiley:

This video demonstrates the features of V1.2.

A detailed explanation will come up soon. :wink:

Xan

I am going to study the 1.2v now, I cant wait :slight_smile:

Great work Xan, the gaits are really impressive, especially the speed movements. Superb work!

Yeah, Xan’s work on the speed are really awesome.

Reading all the RC pwm’s are slowing down my code…

Thanks for sharing Xan!

Hi all,

Thanks for the comments! I really appreciate it! :smiley:

What’s new in version 1.2

Improved gait engine:
A universal gait engine which makes is possible to simply add new gait types by setting properties. I’ll explain the settings with a 6 steps ripple gait for example.

StepsInGait = 6 Total number of steps in the gait
NrLiftedPos = 1 Number of positions in the air (blue position)
TLDivFactor = 4 Number of movements on the ground (red arrows)
NomGaitSpeed = 150 Nominal speed of a single step

LRGaitLegNr = 1
RFGaitLegNr = 2
LMGaitLegNr = 3
RRGaitLegNr = 4
LFGaitLegNr = 5
RMGaitLegNr = 6
Defining sequence of the legs.

Example 2: 12 steps tripod

StepsInGait = 12 Total number of steps in the gait
NrLiftedPos = 3 Number of positions in the air (blue position)
HalfLiftHeigth = TRUE True places the outer upper positions (2 and 12) to half the height of the middle position (1). False places the outer upper positions on the same height as the middle position.
TLDivFactor = 8 Number of movements on the ground (red arrows)
NomGaitSpeed = 100 Nominal speed of a single step

LRGaitLegNr = 1
RFGaitLegNr = 3
LMGaitLegNr = 5
RRGaitLegNr = 7
LFGaitLegNr = 9
RMGaitLegNr = 11
Defining sequence of the legs.

Example 3: 6 steps Tripod

StepsInGait = 6 Total number of steps in the gait
NrLiftedPos = 2 Number of positions in the air (blue position)
HalfLiftHeigth = FALSE
TLDivFactor = 4 Number of movements on the ground (red arrows)
NomGaitSpeed = 150 Nominal speed of a single step

LRGaitLegNr = 4
RFGaitLegNr = 1
LMGaitLegNr = 1
RRGaitLegNr = 1
LFGaitLegNr = 4
RMGaitLegNr = 4
Defining sequence of the legs.

Improved gait speed:
The analog sticks not only controls the step length but also the speed of the gait.

5 different gaits: Thanks to Zenta
Gaits included are:

  • 6 steps ripple
  • 12 steps ripple
  • 9 steps quadripple
  • 4 steps tripod
  • 6 steps tripod

Improved body rotations: Thanks to Zenta
The improved body calculations that Zenta posted before are implemented

Internal timer to improve SSC communication:
A internal timer measures the calculation time of each step. This makes it possible to get a perfect timing between the BB2 and the SSC. This makes the gaits very stable.

Turn on/off the bot with the remote:
Press the start button on the PS2 remote to turn on and off the bot.

Servo offsets moved to SSC V2 registers:
The offsets of the servos are moved to the SSC V2 register. This way there is no need to change the offsets in case of a new version.

Optional compiling for the SSC setup:
The code uses a constant called “SSC_LM_SETUPâ€

Hi Xan,

Very good explanation!

These pictures was great for visualisation of the gaits!

What program did you use to make them?

A picture of my Tripod Gait :

the problem is that during to steps the hexapod doesn’t move…
But it easy to start (first step send a Tripod in position 5).

To stop the walk : send up legs to position 2 and the over legs that are on the floor and not in postion 2 up in 5 then down in 2.

Beth has updated your Project Page with the revision 1.2 basic code, text, images and links. Go get it guys!

lynxmotion.com/images/html/proj102.htm