|
Re: Help with Speed control using Cortex and US Digital Encoders
Quote:
Originally Posted by badtkee
so if i use the PID() code given earlier, would just changing
motor[1] = pwm_out
to
motor [1] = -pwm_out
would that make the motors go backwards? or how can this be done?
|
Not exactly. If the sign of the output does not match the sign of the sensor variable, you will end up with a negative feedback loop as the loop will forever get farther from it's target.
The easiest way would be to invert the setpoint and let the control loop handle the motor inversion.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor
"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
|