In my driver station, I keep getting a CAN Spark Max Timed out errors as well as DIfferential Drive not updated enough. I am not sure whether its an issue with my code or with the CAN Id’s.
https://github.com/djpgamer7/FRC4012-Infinite-Recharge
In your drivetrain class, you create a DifferentialDrive
object but to actually drive the robot, you use the manualDrive
method that directly sets your motor speeds instead of using the DifferentialDrive
. The DifferentialDrive
object needs to be continuously updated or it will throw a timeout. You see this time out behavior since you’re not using the DifferentialDrive
to actually drive the motors.
Ok, that issue is fixed but now what about the CAN Spark Max errors?
Are they all timing out? Even though the differential drive is no longer timing out?
Yes, im getting a CAN Spark max timed out periodic 0. After the change still getting the differential drive error as well.
Does the robot currently drive at all? Also have you double checked the CAN IDs of the SPARK MAXs you are using? Is there anyway you could post the driverstation log file as well?
It looks like you are instantiating the DriveTrain
object multiple times, which in turn creates a new CANSparkMax
instance.
You are doing that here:
here:
and here:
You should only instantiate the object one time. After doing that, does your problem go away?
Yes because it’s used in several commands. Should it not be? Unlike old command based it needs to be in each command.
No there should only ever be a single instance of the DriveTrain
because motor objects cannot be created twice.
I think it would work if you just avoided recreating the drive train from TankDrive
and LockTarget
. i.e. remove the = new DriveTrain()
part from the line.
That makes sense… I didn’t think about the fact that I’m parsing in the drivetrain to the command through the RobotContainer🙃
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.