5
$\begingroup$

I am currently working on a legged hexapod which moves around using a tripod gait. I have two sets of code to control the tripod.

Set 1: Time based control

In this code set, I set the tripod motor set to move at their rated rpm for a required amount of time before shifting to the other tripod motor set.

PID control would be based on counting the number of transitions using an optical speed encoder, Calculating the error based on difference between actual speed and required speed and then adjusting the error with fixed Kd and Ki values.

Set 2: Transitions based control

In this code set I count to the number of transitions required to complete one rotation of the leg(tripod motor set) before starting the other leg(tripod motor set).

PID control would be time based. Calculation of error would be the difference in time taken for individual motors of the motor set.

Query: The set 2 shows promising results even without PID control, but the first set does not.Why so? The motors are basically set to move 1 rotation before the other set moves.

Would the speed differences between the motors cause it to destabilize?

How often do I update the PID loop?

My robot seems to drag a little bit. How do I solve this?

$\endgroup$
  • 2
    $\begingroup$ I suggest moving the part regarding the "drag" to another question. Also, the last part about "arduino pin" is another question by itself. Heck even the question on "destabilization" could be asked separately. $\endgroup$ – Shahbaz Jun 10 '13 at 16:18
  • 1
    $\begingroup$ While I don't think there is anything particularly wrong in this question framework, I shall do as asked. $\endgroup$ – Naresh Jun 11 '13 at 1:39
  • 1
    $\begingroup$ it contains three almost separate questions. You will get better answers if you ask them separately. Also, future visitors will be able to find what they need more easily. $\endgroup$ – Shahbaz Jun 11 '13 at 8:42
  • $\begingroup$ Please at the very least, submit the arduino question as a separate question. I've removed that text from this question, as it's unrelated to your main query. If you want to copy it to a new question, you can find the original text in the edit history. I suggest posting the drag question separately as well. $\endgroup$ – Ian Jun 22 '13 at 19:00
3
$\begingroup$

It sounds like you have 6 legs with some number of PID-controlled joints on each leg. You would like to move 3 legs at a time, while the other 3 legs stand in a stable tripod configuration.

Instead of figuring out how to move each set of 3 legs as one unit, you should be treating them as individual legs. You will send a leg a set of desired joint positions, and the PID control on each joint motor will effect that change. By sending a steady stream of desired joint positions, you will be describing a trajectory for the leg to follow.

Coordinating the actions of all 6 legs simply involves a series of checkpoints to make sure that no leg gets too far behind the others. You need not keep all 6 legs on the same checkpoint; for example, you might keep each set of tripods tightly in sync but only sync the 2 sets at the point in the gait where the weight is shifted.

Another way to imagine the checkpoints is to consider the gait to be a series of repeated movements of each leg, where each leg is slightly phase-shifted. In that case, the checkpoints would be the "constraints" on the allowed phase differences (e.g. this CMU paper).

$\endgroup$
2
$\begingroup$

I believe that your set #2 works better because you're already applying feedback to it, in the form of counting transitions of your encoder.

My knee-jerk method to do this control would be to first use quadrature encoders on each motor, to make sure that I was capturing any backwards motion that might mess me up. Then I would store a time vs. position trajectory that I wanted the motor to follow, which would result in my desired velocity trajectory. Then I would servo the motors to the desired positions using PID control.

The rule of thumb for control loops that generally works is to sample ten times faster than your desired bandwidth. That works out to a sampling interval that's ten times shorter than the amount of time you want to allow for your system to settle after it is operating in its linear range (which roughly starts at the last instant that any of the variables come out of saturation).

If your encoders are coarse enough that they don't go through many transitions in your desired control loop sampling interval, you may be better off sampling at the encoder transitions. This will make your life difficult as the speed changes, but perhaps not as difficult as trying to cope with control loop updates with insufficient information.

Some of the articles linked to here may help, particularly "PID Without a PhD" and the one on operating motors with friction and backlash: http://www.wescottdesign.com/articles.html

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.