Hey PROS Users,
Just started trying to use PROS and I’m having an odd issue.
So for my auton test, this code works fine.
auto drive = ChassisControllerFactory::create(
{20, 13}, {-19, -12},
AbstractMotor::gearset::green,
{4_in, 15_in}
);
void autonomous() {
drive.moveDistance(3_ft);
drive.turnAngle(360_deg);
}
So I know that okapi namespace is working. However, when I try and run opcontrol… I don’t get anything. I’ve confirmed that this method is at least called by include drive.moveDistance() call within opcontrol… and it does get called. So I feel as though its a problem with the controller. Aditionally, I can initialize the Controller from the pros namespace and can get it to work with the okapi tank method. Firmware is the latest for everything and tried 2 different remotes. I’m sure it’s something I’m doing wrong. Any ideas?
void opcontrol() {
// Joystick to read analog values for tank or arcade control
// Master controller by default
Controller controller;
auto chassis = ChassisControllerFactory::create(
{20, 13}, {-19, -12},
AbstractMotor::gearset::green,
{4_in,14_in}
);
// Arm related objects
ControllerButton capFlipperUpButton(ControllerDigital::A);
ControllerButton capFlipperDownButton(ControllerDigital::B);
ControllerButton intakeInButton(ControllerDigital::R1);
ControllerButton intakeOutButton(ControllerDigital::R2);
Motor intakeMotor = 18_rmtr;
Motor capFlipperMotor = 8_mtr;
while (true) {
// Tank drive with left and right sticks and deadband of 0
chassis.tank(controller.getAnalog(ControllerAnalog::leftY),controller.getAnalog(ControllerAnalog::rightY));
if (capFlipperUpButton.isPressed()) {
intakeMotor.move_voltage(-127);
} else if (capFlipperDownButton.isPressed()) {
intakeMotor.move_voltage(127);
} else {
intakeMotor.move_voltage(0);
}
if (intakeInButton.isPressed()) {
intakeMotor.move_voltage(-127);
} else if (intakeOutButton.isPressed()) {
intakeMotor.move_voltage(127);
} else {
intakeMotor.move_voltage(0);
}
pros::Task::delay(10);
}
}