we just started using integrated encoders for our four drive motors. I have never messed with programming encoders for autonomous, and currently this is what I have as an attempt at a program to drive forward
#pragma config(I2C_Usage, I2C1, i2cSensors)
#pragma config(Sensor, I2C_1, frontright, sensorQuadEncoderOnI2CPort, , AutoAssign )
#pragma config(Sensor, I2C_2, frontleft, sensorNone)
#pragma config(Sensor, I2C_3, backleft, sensorNone)
#pragma config(Sensor, I2C_4, backright, sensorNone)
#pragma config(Motor, port1, BaseLift, tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port2, LeftDrive, tmotorVex393_MC29, PIDControl, driveLeft, encoderPort, I2C_1)
#pragma config(Motor, port3, RightDrive, tmotorVex393_MC29, PIDControl, reversed, driveRight, encoderPort, I2C_1)
#pragma config(Motor, port4, LiftLeft, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port5, LiftRight, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port6, LiftLeftt, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port7, LiftRightt, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port8, FourBar, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port9, FourBarr, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port10, Intake, tmotorVex393_HBridge, openLoop)
#pragma config(MotorPidSetting, port2, 50, 10, 1000, 12, 10, 0, 0, 0)
#pragma config(MotorPidSetting, port3, 50, 10, 1000, 12, 10, 0, 0, 0)
task autonomous()
{
resetMotorEncoder(RightDrive);
resetMotorEncoder(LeftDrive);
while (true)
{
moveMotorTarget(LeftDrive, 1000, 100, true);
moveMotorTarget(RightDrive, 1000, 100, true);
}
}
could someone tell me why it does not work
thanks in advance