Hi guys, mi name is Armando and I’m software leader on my team. I’m trying to make our robot follow a pathplanner path. And at the beginning it follows it correctly and like after 2 seconds, the robot goes crazy and does whatever it wants. Here is a link to the code in case you need it. PLEASE HELPP!!!
Thank you very very much
I notice that you’re not updating odometry in
chasisSubsistema.periodic(). That’s going to confuse the Ramsete command.
Ohhh shoott, I accindentally commented it, first thing tomorrow I’ll try it and I’ll let you know. Do you happen to notice any other thing that could went wrong on the code? And thank you very very much for your help
Well that’s a little open-ended, but some observations:
RobotContainer.configureButtonBindings, it’s a little odd that all of your triggers use
onFalse. This means that they activate when the button is released. It’s more common to see
onTrue (for instant commands) and
whileTrue. (See this article.)
- It’s a little odd that
comandoChasis is not set as a default command, but I understand that you did it this way because you want to be able to switch between arcade drive and tank drive. I would probably have connected that using a boolean supplier. If your joystick has a “throttle” axis, that’s a popular way to set a drive mode boolean. (See this example.) Alternatively, you could have a method on
chasisSubsistema that sets the mode, called with an instant command from a trigger.
subsistemaShooter, you should not be calling
Timer.delay(), especially within methods that are going to be called from a command’s
execute method. This will cause loop overruns. You would be better to move this logic into a
SequentialCommandGroup and use
So I tried updating the odometry in chasisSubsistema.periodic() and it got worse, now even since the beggining of the autonomous, it starts going crazy again, and now I get a warning that says “differential drive… output not updated enough”, do you know what that is?
It doesn’t look like I have access to look at your code right now.
This message means that you have created a
DifferentialDrive, but there’s a period of time when you’re not calling any drive method on it. This is probably because your autonomous routine is driving the motors directly and not using the
You can suppress it by calling (something like)
chasisSubsistema.periodic(), but you should understand why this is happening and whether it’s intentional on your part.
Sorry, here it is again:
OHH okok I get it, thank you. So also I saw and that the warning didn’t cause any trouble, so I kept testing the pathplanner, and I also saw that when the robot went crazy, one of my spark max was getting a current of 90A and i tried it like 3 times and the fuse of the spark, blows, so I got into the same issue of the robot going crazy and I don’t know what to do.
OK. Good call on putting
chasisVoltje. The other thing that might cause this error is loop overruns; see my earlier note about
I think you need to take some steps to diagnose the problem. Some suggestions:
chasisVoltje, write the two voltages to
SmartDashboard. Graph the voltages. See if they’re what you expect.
- Write a test command that just sends a fixed voltage to
chasisVoltje while you hold a button down, and see what the robot does.
- Graph the position and speed and see if they correspond to what the robot is doing. You may want to take a video of the robot to compare.
Some other notes:
- You’re setting the idle mode on
motorDerAdelante four times. I have a recommendation for coast vs brake on the drive train.
- You are creating motor controller groups and also setting follow mode. These are alternative approaches, and I’m not sure what happens when you do both.
- I see you have a
getInstance method on
chasisSubsistema (to implement the singleton pattern), but you create an instance directly in
RobotContainer. I don’t see that you are calling
getInstance anywhere, but it will lead to trouble if you do as you will then have two instances. (Normally the singleton pattern also requires you to make the constructor private for exactly this reason.)
- You have a class member
chasisSubsistema.getPose which is apparently unused. I suggest you remove it as it is likely to be confused with instance method
This diagram might clarify what I mean by suggesting
onTrue instead of
I like this chart. Maybe you can make a PR to the docs project with it so it shows in the online documentation.
Thanks. Maybe I will. I’ve been building my own commands cheatsheet, not only for in-house training, but also so I have something to hand out as CSA.
OKOK, but when you say graph the position of the robot, do you mean on the shuffle board, or how? Cause I don’t know how to do that
Yes. Send the relevant values to Shuffleboard, either in a periodic method, or in
chasisVoltje. Set Shuffleboard to show as graph. Screenshot the result. Predict what the graph will look like. Look at the graph and predict what the robot will do. Video the robot and see what it actually does. If you can’t account for the differences, share them with us and we’ll help.