IDENTIFYING THE LEGS WITH IN THE .bas FILE!

HOW DO I IDENTIFY THE LEGS WITH IN THE .bas FILE!
WHAT I AM LOOKING FOR IS TO FIND WHERE ELSE THE FOLLOWING NUMBERS CORRISPOND TO IN THE CODE!


LegUpdatePosition
serout p15,i38400,"#",RRHH,RRHH2,“P”,DEC HipH_Pulse(0),"#",RRHV,RRHV2,“P”,DEC HipV_Pulse(0),"#",RRK,RRK2,“P”,DEC Knee_Pulse(0), |
“#”,FRHH,FRHH2,“P”,DEC HipH_Pulse(2),"#",FRHV,FRHV2,“P”,DEC HipV_Pulse(2),"#",FRK,FRK2,“P”,DEC Knee_Pulse(2), |

	"T170",13]	

return

--------------------------------- sorry i didnt place this in as a code but i cant activate the colors on the numbers in code inserts!!

I KNOW THAT THESE NUMBERS ASSOCIATE EACH OF THE SERVOS TO EACH OF THE LEGS BUT, CAN THESE NUMBERS BE FOUND IN OTHER PARTS OF THE CODE SO I CAN TRY AND PLACE A DELAY BETWEEN THE MOVEMENTS OF EACH LEG, CREATING A RIPPLE LIKE GAIT.

THANK YOU.

I am not sure exactly you mean by identify the legs., but there are comments in the code where many of these defines are, for example:
RRHH - Right Rear Hip Horizontal (which on my Hex is SSC pin 0)
RRHH2

The numbers in red are array indexes. For example HipH_Pulse is defined: HipH_Pulse var Word(6)
This is array of six 2 byte(word) long numbers, which would be one per leg. To index for which value in the array in this case would go from 0 to 5. So HipH_Pulse(0) would give you the first value in the array.

So in the code extract, you would have:
Array index 0 - Right Rear leg
Array index 2 - Front Right leg
and not included hare
index 1 - Right Middle leg

I hope I answered your question.

Kurt

sorry if i didnt explain myself properly, but you did sort of answer my queston!

i guess i need to look up info on INDEXes!
i had some sort of idea that that was what i needed to look.
im still understanding some of the code, especially when it comes to indexing.
i reason i ask is because i want to create a quad code! let me explain…
In the hexapod code, i can take out the middle legs (only leaving four legs, front + back). and after studying the hexapod ripple gait, i feel i could create a quad code using this type of gait!
as i dont have a ripple or tetragait i was looking to set a delay between the four exsisting legs so that only one leg moves at a time.
i guess i also need to study the [code];-------------Tripod ‘A’ Up
A_U
for Index = 0 to Legs - 2 Step 2
YPos(Index) = -Tibia_Length + LegUpShift + Height
XPos(Index) = XPos(Index) + ((-XPos2(Index) - XPos(Index))/StepFlag)*Steps + HipV_HipH + Femur_Length
ZPos(Index) = ZPos(Index) + ((-ZPos2(Index) - ZPos(Index))/StepFlag)*Steps
Rotate(Index) = Rotate(Index) + ((-XCoord - Rotate(Index))/StepFlag)*Steps
next

return

;-------------Tripod ‘A’ Down
A_D
for Index = 0 to Legs - 2 Step 2
YPos(Index) = -Tibia_Length + Height
XPos(Index) = XPos(Index) + ((XPos2(Index) - XPos(Index))/NbSteps)*Steps2 + HipV_HipH + Femur_Length
ZPos(Index) = ZPos(Index) + ((ZPos2(Index) - ZPos(Index))/NbSteps)*Steps2
Rotate(Index) = Rotate(Index) + ((XCoord - Rotate(Index))/NbSteps)*Steps2
next

return

;-------------Tripod ‘B’ Up
B_U
for Index = 1 to Legs - 1 Step 2
YPos(Index) = -Tibia_Length + LegUpShift + Height
XPos(Index) = XPos(Index) + ((-XPos2(Index) - XPos(Index))/StepFlag)*Steps + HipV_HipH + Femur_Length
ZPos(Index) = ZPos(Index) + ((-ZPos2(Index) - ZPos(Index))/StepFlag)*Steps
Rotate(Index) = Rotate(Index) + ((-XCoord - Rotate(Index))/StepFlag)*Steps
next

return

;-------------Tripod ‘B’ Down
B_D
for Index = 1 to Legs - 1 Step 2
YPos(Index) = -Tibia_Length + Height
XPos(Index) = XPos(Index) + ((XPos2(Index) - XPos(Index))/NbSteps)*Steps2 + HipV_HipH + Femur_Length
ZPos(Index) = ZPos(Index) + ((ZPos2(Index) - ZPos(Index))/NbSteps)*Steps2
Rotate(Index) = Rotate(Index) + ((XCoord - Rotate(Index))/NbSteps)*Steps2
next

return	

;--------------------------------------------------------------------[/code]
to find out were to set the delays!

If:
Array index 0 - Right Rear leg
Array index 1 - Right Middle leg
Array index 2 - Front Right leg
Is:
Array index 3 - Left Rear leg
Array index 4 - Left Middle leg
Array index 5 - Front Left leg

thank you Kurt.

Probably an easy way to try this out is to simply break up the serout to the SSSC32 into 4 serouts (one per leg) and you could either wait an amount of time before trying to move the next leg, or you could check the SSC32 to see if the previous move was done…

Sounds like you’ve identified the legs now. From zero count CCW from rear right.

It might be a little hard to convert the TRIPOD gait (it’s not a ripple gait)to a 'quad gait. If you simply take out the middle legs, the tripods (triangles) have no support on one side!

I’m thinking maybe a 4-cycle gait is needed; basically moving the legs in four steps. There is a good graphic of 'quad leg movement somewhere in the LM website, but I can’t find it again. I’d work to implement that.

Found it!

lynxmotion.com/images/data/qp2-v1.pdf

Also some code at:

lynxmotion.com/ViewPage.aspx?ContentCode=downloads&CategoryID=21

Alan KM6VV

your right:

i will be working on covertion of the steps sometime this week. ill be posting the final code once finished. if it works!!!

funny you found the links:
lynxmotion.com/images/data/qp2-v1.pdf
as i only found it a few days ago too! wierd!

thanks man ill upload code into the projects page under S-T-A-L-K-E-R POST!
J.

ok well we have these index arrays for the following legs!

index 0 - Right Rear leg RR
index 1 - Left Rear leg RL
index 2 - Front Right leg FR
index 3 - Front Left leg FL

now im abit confused because in the hex code it only shows the up/down subs for indexes (0) and (1). Not quite understanding the (to Legs - #) bit?!

A_U for Index = 0 to Legs - 2 Step 2 A_D for Index = 0 to Legs - 2 Step 2 B_U for Index = 1 to Legs - 1 Step 2 B_D for Index = 1 to Legs - 1 Step 2

I think i have figured it out,
did you mean like this!

[code]for Index = 1 to Step 2 :> RL up
:followed by code!
RETURN

for Index = 1 to Step 1 :> RL down
:followed by code!
RETURN

for Index = 2 to Step 2 :> FR up
:followed by code!
RETURN

for Index = 2 to Step 1 :> FR down
:followed by code!
RETURN

for Index = 0 to Step 2 :> RR up
:followed by code!
RETURN

for Index = 0 to Step 1 :> RR down
:followed by code!
RETURN

for Index = 3 to Step 2 :> RR up
:followed by code!
RETURN

for Index = 3 to Step 1 :> RR down
:followed by code!
RETURN[/code]

i have acutally put these subs in order they will be called to make it easier to understand!

The constant “legs” is 4, so

for Index = 0 to Legs - 2 Step 2

would have Index equal to the following values, 0 & 2. It wouldn’t get to 4. So we’re picking out two of the legs, RR and FR.

Another example:

for Index = 1 to Legs - 1 Step 2

Index equal to 1 & 3, RL and FL

index 0 - Right Rear leg RR
index 1 - Left Rear leg RL
index 2 - Front Right leg FR
index 3 - Front Left leg FL

Alan KM6VV

thanks for that i have finally got it!
nice one i understand the whole indexing/steps thing.
these things look complicated intill someone shows you, but now i see its quite simple.

!
im still stuck on how to get one leg to move up while the body moves forward to counter act the centre of gravity then the same leg moves down -then the sequence repeats for next leg!
im actually lokking to move indexes 0 - 3 and 1 - 2 so its opposite legs
or how to set a delay between the indexes 0 - 2 and also 1 - 3
thanks man.

That’s often the way it goes.

!

Go back and study the “How Does It Walk” paragraph in the 'Quad manual (and quoted in this thread). The 'bot actually moves more then one lega at a time, but there are for distinct states to the gait.

You don’t need delays as such (but the Atom BASIC main loop might), but you do need 4 states or phases to the gait. Not just the basic “tripod up” and “tripod down” (two states) of a hexapod gait.

Alan KM6VV

sorry guess i edited post befor you pressed submit!

i studied the paragraph and it does moves the opposite legs at the same time.
sorry for confusion dude!

The illustrations for the quad creep and diagonal gaits illustrated on this site might be easier to follow.

oricomtech.com/projects/nico-wlk.htm

Alan KM6VV

For the fun of it you might try studying how the Big Dog walks:
I know this video has been around, but it is still fun to watch:
myeeosprofile.com/video-W1czBcnX1Ww-Boston%20Dynamics%20Big%20Dog%20

my legs are set out similar to this:
lynxmotion.com/images/jpg/symqp01.jpg

i am looking to find out how to move indexes 0 - 3 and 1 - 2 so its the opposite legs that move.

' Quadruped Overview '-------------------- ' **Right Side** ' ' | | ' _|_ _|_ ' F / 2 \____/ 0 | B ' R | | A ' O | ____ | C ' N \_3_/ \_1_| K ' T | | ' | | ' ' **Left Side** '==================================================== ' Walk Forward Diagram '---------------------- ' | ' | ' F \ / | / \ ' O _\_ _/_ | _/_ _\_ ' R / 2 \____/ 0 | | / 2 \____/ 0 | ' <-W | | | | | ' A | ____ | | | ____ | ' R \_3_/ \_1_| | \_3_/ \_1_| ' D \ / | / \ ' \ / | / \ ' '==================================================== ' 3DOF Leg Diagram '---------------------- ' ' [3] 1= Hip Horizontal ' // \\ ' // \\ [1] 2= Hip Vertical ' // \\ // ' // [2] 3= Knee ' // ' // ' ' '==================================================== ;index 0 - Right Rear leg RR ;index 1 - Left Rear leg RL ;index 2 - Front Right leg FR ;index 3 - Front Left leg FL

thank you.

Not sure what you’re asking. I would suggest, however if you’re using an array for the joints as per Atom BASIC code, then you number them in a similar fashion. RR leg is 0, go CCW from there; so FR leg is 1, etc. (previously sugested).

Alan KM6VV

in the code it is saying

for Index = 0 to Legs - 2 Step 2

values, 0 & 2 RR and FR

for Index = 1 to Legs - 1 Step 2

values, 1 & 3, RL and FL

i am looking to find out how to move indexes 0 - 3 together in the same gait and 1 - 2 together in the same gait so its the opposite legs that move and not 0 & 2 and 1 & 3. just the left then the right as suggested in the code.

OK, you want to move TWO legs at the SAME time. First let’s break up the problem a little.

Use a loop to calculate the distances for the leg to move (joint angles).

for Index = 0 to 5
  XPos2(Index) = -(DCoord * COS(DAngle + (Index * 43 + 21)) / 300) ; 43 => 60 degrees
  ZPos2(Index) = -(DCoord * SIN(DAngle + (Index * 43 + 21)) / 300) ; 43 => 60 degrees
next

The hexapod code moves one tripod at a time. So you apply the required leg move to the legs you want ( leg 1 & 3 in this case).

for Index = 1 to Legs - 1 Step 2

When you go to MOVE the legs, Have the SSC32 move the two legs at the same time (or ALL of them, as needed).

serout p15,i38400, |
"#",RRHH,RRHH2,"P",DEC HipH_Pulse(0),	|
"#",RRHV,RRHV2,"P",DEC HipV_Pulse(0), |
"#",RRK,RRK2,"P",DEC Knee_Pulse(0), |
"#",FRHH,FRHH2,"P",DEC HipH_Pulse(2), |
"#",FRHV,FRHV2,"P",DEC HipV_Pulse(2), |
"#",FRK,FRK2,"P",DEC Knee_Pulse(2), 13]

Above you can see several servos being command to move at one time.

Is this what you’re asking?

Alan KM6VV

this is the gait i am looking to create…

youtube.com/watch?v=lxIy3jYuQCo

i have spoken closly with the designer (Park Jeong-Woo) and iv posted jim info on the algorithms and control etc, sent to me by Jeong-Woo

hopfully LM can create a quad gait using info from it…
watch this space!!!

How’s it coming along with the quad gait?

That’s still an interesting video, and still up after a year!

What algorithms etc. did you get from Park Jeong-Woo, perhaps you’d like to share them?

Alan KM6VV

hi alan. been a while since iv posted here! but i am still working on a quad:
lynxmotion.net/phpbb/viewtop … &start=120

lynxmotion.net/phpbb/viewtopic.php?t=4616