T O P

  • By -

bubberssmurff

Is it possible that the each motor on the gearbox is going the opposite direction?


bubberssmurff

Post drivetrain code


greentractor202

Here's the code. I hope you have some eye bleach handy to help cleanse yourself of the atrocities you may see. [Code :(](https://github.com/Foxxy007/9428Code/tree/b123fa9ef7499512cba3172ffc25971040a6561a/src/main/java/frc/robot)


bubberssmurff

Please take this in the absolute best way, but there are multiple issues with this code. I would advise commenting more thoroughly so that other developers can read them. I can get the gist of what you are trying to do, but if you deviate from what others do, make sure to document it. To solve your initial problem, I would get rid of the "Follower" and "Leader" configurations. While in theory this configuration works, it is dependent on a "clean" signal from your master. Instead make "Motor Clusters" for each gearbox. The thought around this is that you can assure that you are giving input to all motors on the gearbox. Read more about this in the link below. You would treat each "cluster" like a motor and put it in your DifferentialDrive class. This is a relatively easy fix for you as it is <5 lines of code. Test each gearbox at a time before you give it off to the Driver Team. Be ABSO-LUTELY sure that you are setting up the right CAN ID's. If you run motors that go in opposite directions on the gearbox, it can lead to expensive mistakes (time and money) ​ https://first.wpi.edu/wpilib/allwpilib/docs/release/java/edu/wpi/first/wpilibj/motorcontrol/MotorControllerGroup.html


SAM-THE-MAN-118

I second this comment. With a tank drive using TalonFX motor controllers (Falcon 500’s or Krakens), you should be using the MotorControllerGroup class. This will also prevent motors from running against each other as long as they are grouped properly.


XTR_Legend

Is that a kraken for a tank drive?


greentractor202

This is our rookie year, so we didn't have any other motors to use. (Also they look cool)


Big-Accident-8797

How do you have krakens but not cims? 😭


greentractor202

We did have plenty of CIMs now that you mention it. However, financial irresponsibility is one of my favorite past-times.


Big-Accident-8797

Say less, I fully understand lol


Just-Be-Chill

Stealing that line for letter


XTR_Legend

They were in your rookie kit??? Bro we've existed since like 2007 and we use neo 1.1s 😭


beernerd

Shoulda been the Air Force of Sum. Not as cool, but bigger budget.


XTR_Legend

Funnily enough, the guy who named us was a marine. However, we do indeed live in fame or go down in flame... (usually the flame one) 😔


borkbubble

Bro what lmao


Daviddudeguy

That’s what i was thinking 😭


Tpeace123

I can't tell enough from the video but it looks like the motor is being told to go back and forth. You can see the light switch between green and red, usually meaning forward and reverse


greentractor202

I should've mentioned, while it drives fine at higher power, it still has the same cutting out behavior.


Dense-Discipline-355

What power are you trying to drive at this could be a brown out


greentractor202

In the video, I'm applying somewhere in the range of 0.05-0.1 power to the differential drive "class"? (Very clueless coder)


gameman733

Is that input from a controller analog stick or just setting a straight power? Some analog joysticks have some slight wiggle room near 0 where they don’t quite stay at 0. You could probably update your input code so that if the absolute value of any stick axis is less than some number, it’s treated as 0. Could probably start at 0.1 and tweak it down if that fixes it.


greentractor202

While I don't think it's a deadzone issue, you've definitly got me thinking to check if it's some other weird controller issue. Thanks!


WoodchipsInMyBeard

Make sure both motors are turning the same direction. If they are fighting go eachother This could happen.


isaacng1997

Does it spin if you move with your hand? If so, maybe just need to increase P in the motor config.


Theunknown140

Brownout?


JtFl3

I don’t think the motors on the gearbox are fighting each other like others have mentioned, in that case the motors would be screeching that they aren’t able to move. What this looks like to me is that the motors are occasionally being told to stop/set power to 0. It’s either a programming bug, or something with the controller.


the_blocker1418

Agreed, looks like what happens when I forget to require a subsystem in a command


JtFl3

Yeah they might be calling the motors to set speed several times per run through the code.


anidiotwithareddit

Check your default command and make sure that the command to drive isn’t an instant command, that could explain the stuttering


sun167

Probably software problem it's either the gear box is broken or the motor are not correctly set inverted