I am using Okapilabs ChassisControllerFactory in order to turn the robot. A command would look like
drive.turnAngle(100_deg);
I am wondering how I would slow down the speed of the turn, or alternatives to use with the integrated motor encoders.
I am using Okapilabs ChassisControllerFactory in order to turn the robot. A command would look like
drive.turnAngle(100_deg);
I am wondering how I would slow down the speed of the turn, or alternatives to use with the integrated motor encoders.
if your motor(s) are defines as left_drive_motors
get the gearing as follows:
double gearing = (double)left_drive_motors.getGearing();
and your chassis is called chassis
then
double gearing = (double)left_drive_motors.getGearing();
chassis->setMaxVelocity(gearing*0.5);
sets the max velocity to half the gearing which is either the gearset
or the GearsetRatioPair
.
I don’t see a function to get the gearing directly from the chassis. But it may be possible.
You can also do something similar with setMaxVoltage
.
If you already know your motor gearings (or you don’t specify them in code), then your max velocity will be 200 by default, no need to read them from the motors.
Then, you can set the chassis max velocity accordingly.
chassis->setMaxVelocity(100); // half speed