Thanks for the explaination, Jake. I probably would of figured it out eventually, and may try again to work it out in my mind.
Quote:
|
Originally Posted by Jake M
And as for the one reversed motor, we usually just wire it in reverse, rather than make the code more complicated. For one, our main programming mentor would (bleep) about it if the code wasn't exactly perfect, and it makes it that much easier to understand months later.
|
We did that for several years, just reverse the wires, but like what the hot dog commercial says, we have to answer to a higher standard, that of FIRST safety rules. Or at least that's what our shop says. Even if it isn't in the book, I agree with them. Red to Red, Black to Black. This year I watched the inspectors do their thing and (like inspectors everywhere) you never know what will catch their eye.
Besides, that's what comments are for. Months later? Try years. Or just an hour later.
Code:
//Put modified joystick numbers into the four motors
//The (256- ) part reverses one side's motors so no reverse wiring is needed!
pwm13 = pwm14 = Limit_Mix(2000 + p1_yNew + p1_xNew - 127);
pwm15 = pwm16 = Limit_Mix(2000 + (256 - p1_yNew) - (256 - p1_xNew) + 127);
It's unbalanced, but so are the original motor positions. I don't disagree with your programming mentor; robots
are perfectionists. But life and robots are full of quirks, and that you gotta live with.