Motors not working in AutonomousPeriodic

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 () {
void AutonomousPeriodic() {
drive->ArcadeDrive(joy->GetY(), -joy->GetX(), true);

I believe you don’t get joystick inputs during autonomous (last year was the exception due to the Sandstorm replacing the traditional autonomous period). In autonomous you would send predefined values to the motors.


I am sorry I didn’t include this earlier, we had the values as presets (drive->ArcadeDrive(0.25, 0, true); and it still didn’t work

It would be much easier to help if you could provide your entire codebase

Your posted code is still using joy->GetY() and joy->GetX() (line 170), which will always return 0 in autonomous mode. If you tried using fixed values, please upload that version of the code.

This squares the inputs, so your command of 0.25 only causes 0.0625 to be sent to the motors. This probably isn’t enough to make the robot move.