I am trying to make something that smoothly increases the drivetrain velocity as it drives for smooth acceleration. The following code I made and tested in VexVR (Didn’t have access to the bot at the time) but once I tested it on the bot itself it seemed not to be setting the velocity during the while loop. Is there something that is preventing it from being set very often?
#-------------------
def driveFor(dire, dist, units, startVel, endVel, inc):
drive.set_drive_velocity(startVel, PERCENT)
drive.drive_for(dire, dist, units, wait=False)
vel = startVel
while drive.is_moving():
vel = min((vel+inc), endVel)
drive.set_drive_velocity(vel)
wait(100, MSEC)
#-------------------