Robot motors jittering while moving reverse or left

Hello!
We recently decided to move from differential movement to mecanum movement. Our old differential drive code works perfectly fine with the robot. The new code with mecanum drive code causes extreme jittering and motor spasms while moving the joystick in reverse or left direction. The motors move fine while moving the joystick upwards or to the right. Everything is up to date. It’s probably a coding issue but we don’t know what the issue is.

Attached github link is the quickly uploaded code

Any help is appreciated

My team tried mecanum once for the competitive season. I’ll try not to be harsh about that robot. Make sure you have the best, new batteries that money can buy. Be sure not to abandon your tried and true old drive for competitions. For your mecanum experimentation make sure the angled wheels are aligned correctly.

One thing I notice is that your argument order is messed up.

    // RobotContainer.RobotContainer()
    m_robotDrive.setDefaultCommand(
      new DefaultDrive(
        m_robotDrive,
        () -> -m_driverController.getLeftY(),
        () -> -m_driverController.getRightX()*-1,
        () -> -m_driverController.getLeftX()));

  // DefaultDrive.DefaultDrive
  public DefaultDrive(DriveSubsystem subsystem, 
    DoubleSupplier xSpeed, DoubleSupplier ySpeed, DoubleSupplier rotation) {

    // DefaultDrive.execute()
    m_drive.driveCartesian(m_xSpeed.getAsDouble(), m_rotation.getAsDouble(), m_ySpeed.getAsDouble());

Also, you don’t mention whether you’re using 2022 or 2023, which makes a difference, because they changed the WPILIB co-ordinate conventions to make everything consistent.

2002

MecanumDrive.driveCartesian(ySpeed, double xSpeed, double zRotation)

Angles are measured clockwise from the positive X axis. The robot’s speed is independent from its angle or rotation rate.

Parameters:

  • ySpeed - The robot’s speed along the Y axis [-1.0…1.0]. Forward is positive.
  • xSpeed - The robot’s speed along the X axis [-1.0…1.0]. Right is positive.
  • zRotation - The robot’s rotation rate around the Z axis [-1.0…1.0]. Clockwise is positive.

2023

 MecanumDrive.driveCartesian​(double xSpeed, double ySpeed, double zRotation)

Drive method for Mecanum platform.

Angles are measured counterclockwise from the positive X axis. The robot’s speed is independent from its angle or rotation rate.

Parameters:

  • xSpeed - The robot’s speed along the X axis [-1.0…1.0]. Forward is positive.
  • ySpeed - The robot’s speed along the Y axis [-1.0…1.0]. Left is positive.
  • zRotation - The robot’s rotation rate around the Z axis [-1.0…1.0]. Counterclockwise is positive.

Hello! I just fixed the argument order, thanks for pointing that out. We were using the 2022 version but just updated the WPILIB to 2023, but when deploying the code we get an error saying that our robot rio image is out of date. We just did a fresh install of FRC game tools but still get the error. We have searched for the compatible version but we can’t find anything.
Thanks for the feedback!

Are you in the beta program? Do you have access to the 2023 game tools? After installing, did you reimage the RIO?

We are using the beta program 2023. After doing the fresh install of FRC game tools we did reimage the RIO but still got the error. Maybe we used the 2022 version of the FRC game tools, but I can’t find the install for the 2023 version.

You should have been given access to the 2023 Game Tools when you joined the beta program.

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