Pathweaver Trajectory Problem

Posting problem our programming team is having.
I am trying to run path weaver trajectories on our robot. However, when I run them they only result in the correct drive path about 10% of the time. The rest of the time, the robot just drives in an uncontrolled straight line when it should turn. I can also only run the command a few times before this occurs if it works at all. However, the number of times that I can run the command before it stops working varies each time. Then, I have to redeploy the program to the robot to fix the issue. However, this does not always work and sometimes result in the error during the first execution of the command. When it does work, it only runs through 75% of the path correctly before driving off in a straight line. I tried putting the command in the getAutonomous method but the same error occurred, so I doubt that that is the issue.

I suggest you take a look at this thread:

Here are some comments after looking at your code:

  1. Your DriveTrain subsystem is using the XBox controller input in the periodic method. This is a big one, you’re constantly overriding the trajectory with controller input. I suggest you don’t reference your XBox controller in your subsystem. Instead, offload this to a Command and make it the default command for your subsystem. This way, it will run when nothing else is running, but running your auto command will interrupt it.
  2. If you press the X button it will reset the encoders and gyro, but it does not reset your odometry. You’ll want to add a call to differentialDriveOdometry.resetPosition() (or just call your resetOdometry()method)
  3. You probably need to invert your gyro heading when you use it with odometry. Left/counter-clockwise should yield a larger heading value.
  4. Your tankDriveVolts method needs to feed the DifferentialDrive safety.
  5. You are only driving your Talon controllers in auto, the victors are not being driven. My suggestion would be to set your Victors to follow your Talons. Don’t use SpeedControllerGroup in you DifferentialDrive, instead, only pass in the Talon controllers and the Victors will follow.

We have a very similar setup to you. We have Talon SRX masters, Victor SPX slaves, and a navX gyro. You can look at our DrivetrainSubsystem if you’d like. We aren’t using PIDController, we offloaded this to the Talons. See this thread for details on that journey.

1 Like

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