View Single Post
  #11   Spotlight this post!  
Unread 27-07-2012, 21:50
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Help with Speed control using Cortex and US Digital Encoders

Quote:
Originally Posted by badtkee View Post
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