So I’m trying to make a tank control for my drive train and allow the driver to go all the way on the joysticks but the drive train slowly ramps up to full speed so there’s not as much jerk. I know you can just do this by slowly increasing how far you go on the analog sticks but I was wondering how I would do this in programming.
This is what I have so far
//Drivetrain user functions
void axis3Drive ()
{
FL_Drive.spin(directionType::rev,Controller1.Axis3.value() * .40,velocityUnits::pct);
BL_Drive.spin(directionType::rev,Controller1.Axis3.value() * .40,velocityUnits::pct);
this_thread::sleep_for(100);
FL_Drive.spin(directionType::rev,Controller1.Axis3.value() * .65,velocityUnits::pct);
BL_Drive.spin(directionType::rev,Controller1.Axis3.value() * .65,velocityUnits::pct);
this_thread::sleep_for(100);
FL_Drive.spin(directionType::rev,Controller1.Axis3.value() * .85,velocityUnits::pct);
BL_Drive.spin(directionType::rev,Controller1.Axis3.value() * .85,velocityUnits::pct);
this_thread::sleep_for(100);
FL_Drive.spin(directionType::rev,Controller1.Axis3.value(),velocityUnits::pct);
BL_Drive.spin(directionType::rev,Controller1.Axis3.value(),velocityUnits::pct);
}
void axis2Drive ()
{
FR_Drive.spin(directionType::rev,Controller1.Axis3.value() * .40,velocityUnits::pct);
BR_Drive.spin(directionType::rev,Controller1.Axis3.value() * .40,velocityUnits::pct);
this_thread::sleep_for(100);
FR_Drive.spin(directionType::rev,Controller1.Axis3.value() * .65,velocityUnits::pct);
BR_Drive.spin(directionType::rev,Controller1.Axis3.value() * .65,velocityUnits::pct);
this_thread::sleep_for(100);
FR_Drive.spin(directionType::rev,Controller1.Axis3.value() * .85,velocityUnits::pct);
BR_Drive.spin(directionType::rev,Controller1.Axis3.value() * .85,velocityUnits::pct);
this_thread::sleep_for(100);
FR_Drive.spin(directionType::rev,Controller1.Axis3.value(),velocityUnits::pct);
BR_Drive.spin(directionType::rev,Controller1.Axis3.value(),velocityUnits::pct);
}
Controller1.Axis3.changed((axis3Drive));
Controller1.Axis2.changed((axis2Drive));
The axis3 goes but stays at 40% the whole time, any help would be much appreciated, thank you.