Lemlib 0.5.0 PID

Okay, so I’m using Lemlib 0.5.0 on PROS kernel 3.8.3. I’ve setup the PID configuration, and am using two vertical tracking wheels, one horizontal tracking wheel, and an IMU. I’m trying to tune the PID, and am following the guide from the official docs. However, once i set everything but the kP and kD to 0, the robot won’t move at all. help would be appreciated, code is below.

pros::Controller master(pros::E_CONTROLLER_MASTER);
pros::Motor front_left_motor(4, pros::E_MOTOR_GEAR_BLUE); // left_motor_group
pros::Motor middle_left_motor(5, pros::E_MOTOR_GEAR_BLUE); // left_motor_group
pros::Motor back_left_motor(6, pros::E_MOTOR_GEAR_BLUE); // left_motor_group
pros::Motor front_right_motor(-1, pros::E_MOTOR_GEAR_BLUE); // right_motor_group
pros::Motor middle_right_motor(-2, pros::E_MOTOR_GEAR_BLUE); // right_motor_group
pros::Motor back_right_motor(-3, pros::E_MOTOR_GEAR_BLUE); // right_motor_group

// left motor group
pros::MotorGroup leftMotors({ front_left_motor, middle_left_motor, back_left_motor });
// right motor group
pros::MotorGroup rightMotors({ front_right_motor, middle_right_motor, back_right_motor });
pros::Motor_Group arm_motor({-9,10}); 
pros::Motor intake(7, pros::E_MOTOR_GEAR_BLUE);
pros::ADIDigitalOut mogo('A', false); 
pros::ADIDigitalOut doinker('H', false);
 
lemlib::Drivetrain drivetrain(&leftMotors, // left motor group
                              &rightMotors, // right motor group
                              15.0625, // 10 inch track width
                              lemlib::Omniwheel::NEW_325, // using new 4" omnis
                              360, // drivetrain rpm is 360
                              2 // horizontal drift is 2 (for now)
);

// imu
pros::Imu imu(8);
// horizontal tracking wheel encoder
pros::Rotation horizontal_encoder(13);
// vertical tracking wheel encoders
pros::Rotation vertical_encoder(11);
pros::Rotation vertical_encoder_two(-12);
// horizontal tracking wheel
lemlib::TrackingWheel horizontal_tracking_wheel(&horizontal_encoder, lemlib::Omniwheel::NEW_2, -5.75);
// vertical tracking wheel no. 1
lemlib::TrackingWheel vertical_tracking_wheel_one(&vertical_encoder, lemlib::Omniwheel::NEW_2, -2);
// vertical tracking wheel no. 2
lemlib::TrackingWheel vertical_tracking_wheel_two(&vertical_encoder_two, lemlib::Omniwheel::NEW_2, 2.25);

// odometry settings
lemlib::OdomSensors sensors(&vertical_tracking_wheel_one, // vertical tracking wheel 1, set to null
                            &vertical_tracking_wheel_two, // vertical tracking wheel 2, set to nullptr as we are using IMEs
                            &horizontal_tracking_wheel, // horizontal tracking wheel 1
                            nullptr, // horizontal tracking wheel 2, set to nullptr as we don't have a second one
                            &imu // inertial sensor
);

// lateral PID controller
lemlib::ControllerSettings lateral_controller(10, // proportional gain (kP)
                                              0, // integral gain (kI)
                                              3, // derivative gain (kD)
                                              3, // anti windup
                                              1, // small error range, in inches
                                              100, // small error range timeout, in milliseconds
                                              3, // large error range, in inches
                                              500, // large error range timeout, in milliseconds
                                              20 // maximum acceleration (slew)
);

// angular PID controller
lemlib::ControllerSettings angular_controller(6, // proportional gain (kP)
                                              0, // integral gain (kI)
                                              10, // derivative gain (kD)
                                              0, // anti windup
                                              0, // small error range, in degrees
                                              0, // small error range timeout, in milliseconds
                                              0, // large error range, in degrees
                                              0, // large error range timeout, in milliseconds
                                              0 // maximum acceleration (slew)
);

// create the chassis
lemlib::Chassis chassis(drivetrain, // drivetrain settings
                        lateral_controller, // lateral PID settings
                        angular_controller, // angular PID settings
                        sensors // odometry sensors
);

void skills26pt()
{
	 // set position to x:0, y:0, heading:0
    chassis.setPose(0, 0, 0);
    // turn to face heading 90 with a very long timeout
    chassis.turnToHeading(90, 100000);
}

You have all of that code within a function labeled “skils26pt”. However, you never declare that to run in autonomous.

1 Like

that’s mildly infuriating to not have caught that. thanks!

1 Like