Problems with Autonomous - robot will not drive in negative direction

Having an issue with our auto code - we can make the robot drive in one direction, but not in the reverse direction.

Auto code here: https://github.com/rmeesters/2023-Robot/blob/master/src/main/java/frc/robot/autos/AutoDrive.java

If we pass the robot a command to drive forward, using positive X values, it works, (example below) but if we pass a negative value, the robot does not move.

Works:

private final Command m_autoOne = new SequentialCommandGroup(
//new AutoDrive(List.of((new Pose2d(0, 0, new Rotation2d(0))),(new Pose2d(1, 0, new Rotation2d(0))))),
//new adjustArm(85, 15.5, false, false, true),
//new adjustArm(Constants.ArmConstants.pivotBottomAngle+2,0,true,false,false),
new AutoDrive(List.of((new Pose2d(0, 0, new Rotation2d(0))),(new Pose2d(1, 0, new Rotation2d(0)))))
);

Fails:

new AutoDrive(List.of((new Pose2d(0, 0, new Rotation2d(0))),(new Pose2d(-1, 0, new Rotation2d(0))))));

Scratching head on this one so any help most appreciated.

So as an update, got it working by making the following changes (github code: https://github.com/rmeesters/2023-Robot/blob/master/src/main/java/frc/robot/autos/AutoDrive.java and https://github.com/rmeesters/2023-Robot/blob/master/src/main/java/frc/robot/RobotContainer.java )

Basically passing a boolean value to setReversed in the Trajectory Config allows me to set a negative X value in the trajectory. We are doing it as a boolean passed to the function so that we can use the same code to do both forward (positive X) and backward (negative X) commands from the same code base.

Not sure why this is required, but it appears to be working now.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.