Quote:
Originally Posted by nealpatel
So what is the value of max?
|
Code:
max = abs(front_left);
if (abs(front_right)>max) max = abs(front_right);
if (abs(rear_left)>max) max=abs(rear_left);
if (abs(rear_right)>max) max=abs(rear_right);
Front_left, front_right, rear_left, and rear_right can each exceed 1.0.
When all the above code has been executed, max will contain the largest absolute value of [front_left, front_right, rear_left, rear_right].
If max exceeds 1.0, then all the wheel speeds are divided by max in order to force the largest one to have a magnitude of 1.0:
Code:
if (max>1)
{front_left/=max; front_right/=max; rear_left/=max; rear_right/=max;}
Quote:
|
It seems you forgot a couple lines of code there.
|
I don't think so.
Quote:
|
I am assuming 1.0 but just want to make sure.
|
That assumption would be wrong in general. Max equals 1.0 only if the largest absolute value is 1.0.
Quote:
|
And thanks that that pdf, it was really helpful.
|
I'm glad it helped. Feel free to ask questions.