We are having a problem in our C++ code which we have not experienced in the past. The motors on the robot are not reacting to any code within the autonomousPeriodic function. The same code was run within testInit and testPeriodic, and the motors worked perfectly. We also used cout statement to test if the code inside the function was running. Our results were mixed: The cout statements were printing to the console, but the motors were not running, despite both commands being in the same function. The drive code we were using also worked in test and teleop.
Any help would be greatly appreciated.
The code below is a basic example of the code we are having issues with:
frc::ADXRS450_Gyro *gyro = new frc::ADXRS450_Gyro();
WPI_TalonSRX *left = new WPI_TalonSRX(0);
WPI_TalonSRX *right = new WPI_TalonSRX(3);
frc::DifferentialDrive *drive = new frc::DifferentialDrive(*left, *right);
frc::Joystick *joy = new frc::Joystick(0);
void AutonomousInit () {
gyro->Reset();
}
void AutonomousPeriodic() {
drive->ArcadeDrive(joy->GetY(), -joy->GetX(), true);
}