I’ve been attempting to get our team’s auton more precise and the built-in RobotC PID control seems to be a great option to get to exact locations without long/complicated auton functions that would need optimization later on in the season. Searching through previous threads (and threads on NXT - not sure whether some functions carry over or not) and the RobotC Help docs then trying it out in some test programs, I haven’t been able to use MoveMotorTarget() to get my robot to move to a position correctly. So far I have:
void setPIDAll ( bool set = true )
{
setPIDforMotor(L, set); //Is this the correct command? This is the most recent I could find in the documentation.
setPIDforMotor(R, set);
}
void pidTest()
{
setPIDAll( true ); //turn on PID
setMotorTarget(L, 500, 110, true);
setMotorTarget(R, 500, 110, true);
setPIDAll( false ); //turn off PID
}
This code makes the robot drive backward indefinitely; Much further than 500 encoder ticks. We have our drive set up with both sides on a Y-Splitter using one IME on the front motor of each side.
Is there a better way to do this? Is MoveMotorTarget() correct or still supported?
Thanks you guys.