Society of Robots - Robot Forum

Software => Software => Topic started by: robofactors on March 30, 2009, 11:58:45 AM

Title: Biped Engine Coding Question
Post by: robofactors on March 30, 2009, 11:58:45 AM
Hey everyone.

I'm working with the biped engine and am not really a C coder, but I think i've found a problem, or just don't understand actually what's going on.

To process the gait, an array is defined for each servo to set the amount of movement:

long signed int forward_left_foot[7]=      {100,150,250,150,100,0,-100};
long signed int forward_left_ankle[7]=      {100,150,250,150,100,0,-100};

The 'walk_forward' routine loops through these arrays to update the various servo positions:

      left_foot=forward_left_foot;
      left_ankle=forward_left_ankle;

The move_biped routine adds these values to the established home position for each servo so all movement is relative to the home position:

   left_foot(left_foot+home_left_foot);
        left_ankle(left_ankle+home_left_ankle);

So if the home position for left_foot is 300, the servo should move to 400 as the 1st value in the array is 100 and it's being added to the home position, and so on as it loops through the array.

What I am finding in the code by adding rprintf statements is that the addition is not actually taking place, so when you execute the 'walk_forward' routine, the servo is actually moving to the values in the array, NOT the home_position plus the value in the array.

Based on the snippets above, can anyone tell me what I"m missing?

If you want to see the whole code, it's available http://www.societyofrobots.com/sor_biped_engine.shtml (http://www.societyofrobots.com/sor_biped_engine.shtml)

THanks,
Marc

Title: Re: Biped Engine Coding Question
Post by: robofactors on March 30, 2009, 01:25:29 PM
Ok,

I've found the problem, it relates to the code moving the robot to the home position which it calculates as absolute, but the walking gait is a relative position so there was some arithmetic code that was causing conflicts.  Looks like the code needs to be all relative to the home position, or all absolute positioning, not a combination of both.  To see the hacked way I overcame it you can look at the attached file
Title: Re: Biped Engine Coding Question
Post by: Admin on March 31, 2009, 08:48:29 PM
(spoke with robofactors already about this)

Yea I made a dumb mistake in the code. The corrected version has been uploaded on the Biped Engine page.