2
$\begingroup$

I am trying to sync motors on a VEX Cortex based robot and have had mixed success using the encoders with position control. I noticed that the motor setup directive

#pragma config(Motor, port2, motorA, tmotorVex393, PIDControl, encoder, encoderPort, I2C_1, 1000)

has a parameter "PIDControl" but I cannot find any documentation as to what it actually does.

I see on the encoder documentation page here that the encoder provides velocity output, but it is not apparently built into the API. So my question is two fold:

1) What does the "PIDControl" directive actually do?

2) How can I use the encoder to control the speed of the motors?

$\endgroup$
2
  • $\begingroup$ Try plugging your code line into a well known search engine. I think this is some sort of flag. You need to look at the documentation of the compiler/system/robot (robotC?), not the encoder... robotc.net/forums/viewtopic.php?f=52&t=5916 $\endgroup$
    – Guy Sirton
    Commented Mar 13, 2014 at 6:17
  • $\begingroup$ I have searched extensively... most of what I find is for NXT. As for the documentation, it does not expose lower-level functions of the language. It is pretty high level. $\endgroup$ Commented Mar 14, 2014 at 1:32

1 Answer 1

2
$\begingroup$
  1. "PIDControl" directive allows the internal to do closed loop feedback control on the motors. You do want this on. Without going into greater detail, you should leave it there so that you can have use more robust motor motions.

  2. You do not use encoders to control speed. You use encoders to control distance. Now, having said that, if you want to get higher performance of motor control, such as eliminate overshooting, you will need to use the encoder to tell the maximum distance (equivalent to the encoder value, you need simple gear math work here, of course). Use the setMotorTarget(...).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.