Hello, I’ve been getting this error and I have no idea how to fix it. It would be much appreciated if someone could help me. Thanks.
Please post your code. That is required to really give you advice. A git website like github would be most convenient.
Here is our teams git repository.
Thanks for posting that. Maybe I am missing something, but I do not see something immediately wrong. This warning can sometimes be ignored, but best to get to the bottom of it.
Basically, your code is taking too long to update the values of your motor controllers. This can happen due to a slowdown somewhere else or an interruption of main loop of code. See here for more info.
When does this error occur? (ie all the time, on teleop first being started, autonomous only, etc.)
I don’t seem to be able to use any of the listed functions on my motor controllers.
.setSafetyEnabled(true)
.setExpiration(.1);
.feed()
That feed()
really doesn’t need to be called. It should be working without that code. I wish I could be more helpful.
Drive the robot on blocks and ensure it listens to the joysticks, if it does than it probably can be ignored. If the message is only happening once in a long time, it really shouldn’t be too bad of an issue. If it is being spammed, that is a different case altogether.
Yeah, it’s pretty much just being spammed.
I also didn’t see anything immediately obviously wrong in the code, so I decided to run it in simulation. However, when running, it I didn’t see a spam of motor safety errors, only one on start-up.
My original theory was that for some reason the default command wasn’t being called, so I added a few debug things with SmartDashboard. In RobotContainer, I added SmartDashboard.putData(driveTrain);
to the constructor, so you can see what command is being run on the driveTrain subystem. In the drivetrain subsytem, I added SmartDashboard.putData(driveTrain);
to the constructor, so you can see values being output in the differential drive object.
In simulation, it shows the runCommand being run when in teleop, and also shows values being sent to the differential drive. You can run Glass after loading the code, as smart dashboard doesn’t have a differential drive widget. Or you can add the following to the drive method to output the data to SmartDashboard.
SmartDashboard.putNumber("leftSpeed", leftSpeed);
SmartDashboard.putNumber("rightSpeed", rightSpeed);
My new theory is that the code you’re downloading to the robot doesn’t match what’s on github.
I don’t believe I’ve changed anything since pushing to github.
I was wrong. I just updated the repository.
public void RobotContainer() {
This is a method called RobotContainer
in the object RobotContainer
. It is not being run. Instead, you need to have this (like it was prior to your latest commit).
public RobotContainer() {
This is the constructor which is called in Robot.java:16
. So this addition of void
results in configureButtonBindings
not being called, and the code failing to set a default command for subDriveTrain
.
Yes, that’s the issue. In fact, VS Code has a warning This method has a constructor name
on that line pointing to the problem.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.