WaitUntilMotorStop

Our team is trying to calibrate the robot arms during initialization. They tried using getMotorCurrentLimitFlag(frontLiftMotor) but it never triggers

setMotorSpeed(frontLiftMotor, -50);

while(!getMotorCurrentLimitFlag(frontLiftMotor)){
    //loop until motor stall
}

They also tried waitUntilMotorStop(frontLiftMotor) but this also never returns.

Any suggestions? They are just trying to lower the robot arm to its lowest possible position at the start of the program. They are doing this in case the drivers forget to manually set the robot correctly at the start.

Shouldn’t getMotorCurrentLimitFlag allow them to do this?

http://help.robotc.net/WebHelpVEX/index.htm#Resources/topics/VEX_IQ/ROBOTC/Motor_Commands/getMotorCurrentLimitFlag.htm

What’s the best source of documentation for RobotC VexIQ now?

Thanks,

Cris

The trouble with waitUntilMotorStop/isMotorZeroVelocity/… is that it considers the programmed velocity instead of the actual measured velocity. So as long as the motor is trying to finish a move (either due to infinite setMotor or while working asynchronously after set/moveMotorTarget) it won’t report a stall. My kids have spent good two hours trying to figure their way around that.
At the end they came with a little complicated solution involving a slow-ish function sampling the motor encoder twice with a delay, plus a dead-band to let the motor actually start moving.

Now they consider it the best thing since sliced bread and use it left, right and center in many variants in the autonomous, even for drivebase moves.

As for the current limit, it really depends on what the value you use. Something somewhere mentioned the max current at over 3A, but VexIQ motors apparently work below 1A at full power when unlimited. Thus, for calibration moves, they use 100mA current limit, though I think w/o the flag. The flag might still work well, but don’t expect it to trigger unless you lower the limit significantly from the default.

You need to set the motor current trigger point first because otherwise it will be at around 4A default which is a lot.
setMotorCurrent(motorX, 200); would set it to 200mA. Have a play around to find a threshold that doesn’t trigger during movement but does once it hits the endstop and stalls.
Be sure to set the current back to a higher level once done. setMotorCurrent(motorX, 4000); will do it. The actual max is less than that but you don’t need to be precise.