• aditya mehrotra.

chip updates: making the puppy walk (again) [updates]

So today I made a small plan to have the puppy walk and here it is. This is very similar to the last making the puppy walk plan we documented before but this time we know the zeroing technique to keep walking a little consistent you know?


We drew out a few steps which involve transferring weight from front-back and etc. We're going to implement them and try them pretty soon. Here they are:



Another thing though, before we talk about all of this, we want to probably figure out a way to do this non-statically. Like read the foot positions of the robot at any given time and figure out how to get the robot to lift any foot and here's how we're going to do it likely instead of the plan above.



Okay so here's what we do... first we're going to need to do some experiments.


In the standup configuration that has correct zero we'll first move the legs to different x positions...

x=-0.02, x=-0.05; and figure out which of those lets us take the weight off the front legs

then x = 0.05, x=0.05, x=0.07; and figure out which of those lets us take the weight off the back legs

And now we'll have two x-thresholds X_FRONT and X_BACK which represent the boundary of at least how far the feet need to be in whatever direction to pick up a front or a back leg... 

So then what we'll do is once we've figured this out we can develop a decent algorithm you know? To move any leg at any time what we'll do is first determine what the current xyz foot positions are from the CURRENT_XYZ variable that gets published by forward kinematics.


Then we'll write a function that does the following:


INPUTS: foot to move, location to move to, and current_XYZ foot positions

PROCESS:
(1) searches the legs you aren't moving for their x-positions
(2) identifies the one that is farthest from the target of X_FORWARD or X_BACKWARD
(3) it moves ALL of the legs in the correct direction by the amount of the distance from the target the farthest leg is
(4) then it moves the leg you want to move

What this does, basically, is assume if the feet are at mostly the correct x-position moving a leg will not cause the platform to fall over. This is a reasonable assumption without our operating domain but it'll require a significant amount of testing to get it right so maybe we should get to it.


Here's the code so far:


'''
Moves an individual leg from any starting position to any finishing position
LEG IS "FL," "FR," BL," or "BR"
and LOCATION is the [xyz] we want to go to
LIFT is the height to lift the leg while it's in motion
'''
def move_LEG(LEG, LOCATION, LIFT):
     #setup the variables
    waypoints = []
    COMMAND = list(CURRENT_XYZ)
    targetX = 0.05
    sign = 0

    #FIRST we determine what the direction and cutoffs are
    if(LEG=="FL" or LEG=="FR"):
        targetX = DEFAULTS.TARGET_X_FRONT
        sign = -1
    if(LEG=="BL" or LEG=="BR"):
        targetX = DEFAULTS.TARGET_X_BACK
        sign = 1

    #then we figure out which legs don't meet the cutoff
    #then  determine what the dX of motion is to move the legs
    xs = [COMMAND[0], COMMAND[3], COMMAND[6], COMMAND[9]]
    toMove = []
    dx = 0.0
    for x in xs:
       if((sign==-1 and x>=targetX) or (sign==1 and x<=targetX)):
            toMove.append(x)
    if(sign==-1):
        dx=max(toMove)
    if(sign==1):
        dx=min(toMove)
    dx = sign*abs(dx-targetX)

     #now populate the vector
    COMMAND[0] = COMMAND[0]+dx
    COMMAND[3] = COMMAND[3]+dx
    COMMAND[6] = COMMAND[6]+dx
    COMMAND[9] = COMMAND[9]+dx

     #now add that to the 
    waypoints.append(doIK(COMMAND))

     #then we pick up the leg and move it
     if(LEG=="FL"):
         pass
     if(LEG=="FR"):
         pass
     if(LEG=="BL"):
         pass
     if(LEG=="BR"):
         pass

     return waypoints

Let's test this much so far in test mode...

Okay turns out the offsets we set at the moment were too much -0.05 for forward x makes the platform fall over. Let's start with -0.02 for forward x oops. And 0.06 for backward x offset.


NOTE: before we did any testing we made sure to tune that offset because otherwise we'd get nowhere with this kind of testing and it'd all fall apart the next time we turn the robot off and turn it back on. But the front legs SLIP when we try this but they definitely take the weight off. So what we're going to do is do a slight forward lean when leaning backwards, and a slight backward lean when leaning forwards.


#calculate dx but also 
 #now make the platform push down with its font legs when leaning backwards
 #and make the platform push down with its back legs when leaning forwards
 #this is to avoid slip
 if(sign==-1):
        dx=max(toMove)
        COMMAND[1] = COMMAND[1]+0.015
        COMMAND[4] = COMMAND[4]+0.015
 if(sign==1):
        dx=min(toMove)
        COMMAND[7] = COMMAND[1]+0.015
        COMMAND[10] = COMMAND[4]+0.015
 dx = sign*abs(dx-targetX)


We also really should implement some form of slip detection for the feet so the platform knows when its slipping - you know like traction control?


I don't know how we'd do traction control right now but just an idea we should look out for in the future. I'm a also thinking now we should do the opposite, make the back legs y rise a little when we transfer weight to them not the front... let's try that.


AHA it works look:


Now we're going to go ahead and run some testing for the back legs and then we'll work on the individual what happens when you move a leg. I do want to point out that what we're doing here is the hard part... this weight transfer part is the real challenge and then walking after this will be a breeze if we can get it to transfer weight off the foot from any position.


0.06 is not enough for the back... 0.08 is too much... 0.07? 0.07. BUT with no increase in y on the front legs. This is going to happen sometimes because of the asymmetry of the platform, in fact we might just go with 0.067 and DECREASE the height of the front legs.



Okay so this one is a bit extreme but we fixed it by just NOT increasing the height of the front legs and it's pretty good now! Of course with testing we'll improve these bound values. Now let's get to actually moving the leg.


'''
Moves an individual leg from any starting position to any finishing position
LEG IS "FL," "FR," BL," or "BR"
and LOCATION is the [xyz] we want to go to
LIFT is the height to lift the leg while it's in motion
'''
def move_LEG(LEG, LOCATION, LIFT):
 #setup the variables
    waypoints = []
    COMMAND = list(CURRENT_XYZ)
    targetX = 0.05
    sign = 0

 #FIRST we determine what the direction and cutoffs are
 if(LEG=="FL" or LEG=="FR"):
        targetX = DEFAULTS.TARGET_X_FRONT
        sign = -1
 if(LEG=="BL" or LEG=="BR"):
        targetX = DEFAULTS.TARGET_X_BACK
        sign = 1

 #then we figure out which legs don't meet the cutoff
 #then  determine what the dX of motion is to move the legs
    xs = [COMMAND[0], COMMAND[3], COMMAND[6], COMMAND[9]]
    toMove = []
    dx = 0.0
 for x in xs:
 if((sign==-1 and x>=targetX) or (sign==1 and x<=targetX)):
            toMove.append(x)

 #calculate dx but also 
 #now make the platform push down with its font legs when leaning backwards
 #and make the platform push down with its back legs when leaning forwards
 #this is to avoid slip
 if(sign==-1):
        dx=max(toMove)
        COMMAND[7] = COMMAND[7]+0.015
        COMMAND[10] = COMMAND[10]+0.015
 if(sign==1):
        dx=min(toMove)
        COMMAND[1] = COMMAND[1]+0.0
        COMMAND[4] = COMMAND[4]+0.0
    dx = sign*abs(dx-targetX)

 #now populate the vector
    COMMAND[0] = COMMAND[0]+dx
    COMMAND[3] = COMMAND[3]+dx
    COMMAND[6] = COMMAND[6]+dx
    COMMAND[9] = COMMAND[9]+dx

 #now add that to the 
    waypoints.append(doIK(COMMAND))

 #then we pick up the leg and move it
 if(LEG=="FL"):
        COMMAND[10] = COMMAND[10]-0.01
        waypoints.append(doIK(COMMAND))
        COMMAND[1] = COMMAND[1]-LIFT
        waypoints.append(doIK(COMMAND))
        COMMAND[0] = LOCATION[0]
        COMMAND[1] = LOCATION[1]
        COMMAND[2] = LOCATION[2]
        waypoints.append(doIK(COMMAND))
        COMMAND[10] = COMMAND[10]+0.01
        COMMAND[7] = COMMAND[7]-0.015
        COMMAND[10] = COMMAND[10]-0.015
        waypoints.append(doIK(COMMAND))
 if(LEG=="FR"):
 pass
 if(LEG=="BL"):
 pass
 if(LEG=="BR"):
 pass

 #now reerse the shift at the end
    COMMAND[0] = COMMAND[0]-dx
    COMMAND[3] = COMMAND[3]-dx
    COMMAND[6] = COMMAND[6]-dx
    COMMAND[9] = COMMAND[9]-dx

 #now add that to the 
    waypoints.append(doIK(COMMAND))

 return waypoints

Okay so this made the platform fall over on its face but we made a few edits. First, we moved that reversing the lean at the end to before we reverse the shift. And second we made the platform lift its foot higher like a 0.25 step height because I think 0.15 really isn't enough.


But also the platform started behaving funny just doing random things and I think that's usually caused by the jetson heating up too much so we're going to just turn off the old boy for now and get back to this soon but good progress.


#updates #omgrobots #yay #platforms #chip

0 views0 comments
© copyright 2019 | aditya mehrotra