My team was experimenting with the sparkmaxs and the neos, one side of our robot works and the other doesnt… I know the joystick is going through to the drive method because I have it being printed out to the console. CAN Ids are set correctly, all firmware up to date, inverted set appropriately. How am I able to flash the lights on the spark maxes like I can with talons?
There is an “blink” or “identify” button in the Rev Max set up program. Main config page is memory serves.
You can also flash the LEDs on the Network tab of the PC Client
@AfterTen and @Will_Toth beat me to it! This is what the Identify buttons look like:
That’s odd, I don’t have that. Maybe there is something wrong with the SparkMax’s.
You are most likely not on the latest version of the spark max client. Go to the help tab and see if your client version is 2.1.1. If not, download the latest release from the Rev website.
v2.1.1 of the Spark Max Client can be downloaded here.
The right side of the robot moves fine and the left side does not. Left side doesnt even get signal to motor controller. CAN is correct, ID is correct, code is the same for the two sides.
Check to see if the encoder wires are fully plugged in, and try just replugging in all the wiring in general, as the NEOs won’t run with bad encoder connections. My team had the same issue a couple of nights ago and we solved it by doing this. Additionally if it turns out that doesn’t fix anything try running just a WPILIB example project with just the drive code to confirm whether or not it’s a programming problem or something with electrical.
I’m assuming it wouldn’t be a programming problem because I can get the joystick value to the drive method(printed to console), all IDs are correct. I tried turning the motor straight from the SparkMAX software and it wouldn’t turn then. It may be the encoder, I’ll check that when I can get to the robot.
This sounds like an issue with your CAN wiring. If the status LED is working for that controller, does it not go solid when you try to run the motor? Is it showing an error blink code?
If the controller is on and receiving power, just not enabling when you ask it to run, then most likely there’s a break in the CAN chain that’s preventing signal from getting to that controller. Is it possible for you to post pictures of your wiring so we can help you further troubleshoot?
I can be in the robotics shop in about 2.5 hours from now, I’ll send photos then but no, they enable just like the other two motors controllers. Leading me to think it’s a problem in my code yet, joystick vals are going to the code and it’s mirrored to the code running on the other side.
Ah I see. When you say that they enable, you mean the LED goes solid, correct? Do they never change to red/green while the other side of the drivetrain does? Do they just stay solid light blue or purple?
Your code looks fine for the Spark Maxes but I think you mean this for your leftSideEnc
calculation:
leftSideEnc = leftFrontEnc.getPosition() + leftBackEnc.getPosition() / 2;
I would try running the Spark Max from the Client again but make sure that the roboRIO is powered off or disconnected from the CAN bus. If the roboRIO is on and in the CAN bus when you try to enable the Spark Maxes from the Client, the Spark Maxes will not run.
If you still cannot get the Spark Maxes to run from the Client, I would reach out to REV support to see if they can further help you troubleshoot an issue with the controllers.
Thanks for your help! I didn’t even catch that problem with the encoders, would’ve caused just a “little” issue. But as for the spark Max’s, I wasn’t aware of that. I’ll make sure to disconnect the CAN bus from the RIO when trying to test. Hopefully it was just a bad firmware flash and when I reset it all works well!
I see two issues in your code. First you create the drivetrain object twice, and then destroy one. You should just be able to remove new DriveTrain()
See here line 20 is where its created, and line 25 is where its destroyed:
The root cause of your issue is you are telling the leftFront
motor to follow the leftBack
motor, then trying to command the follower motor to drive. Instead you should have leftBack
follow leftFront
(or call leftBack.set()
). See here:
and here
That would be it, it’s supposed to be the back and I could’ve swore that I checked it!
It’s a good thing there is Chief Delphi, because there is no way I would have guessed that was a “blink” button, and a whole group of us in the lab tonight were scouring the pages of documentation to see if we could find something.
It’s an old post, but I’m guessing it’s still valid. (I don’t have a spark max with me to test.)
Yep! Still applies! If you have any other issues/questions regarding the spark Max’s feel free to ask!
All right. I will. Tonight we were troubleshooting. Two very weird things were happening.
It seemed like one of the motors was messed up, going the wrong direction. There were two problems. First, we changed from setInverted(true) to setInverted(false), and the motor didn’t change direction. We have four motors in our drive train, and all of the others changed direction after we sent the setInverted command. One of them stubbornly continued going in the same direction, regardless of whether we sent true or false to the setinverted method for that Spark Max.
Then there was the light. It was definitely flashing green while going backward. Is the color of the light supposed to reflect the actual direction of travel, or the numerical value of the input? In other words, if I say
mySparkMax.setInverted(true);
mySparkMax.set(0.5), should the light flash red or green?
I would think red, because it is being told to move backwards at half power. The value of 0.5 is “forward”, but because of setInverted, that ought to move the robot backward.
For three of the four motors, it seemed like it would reflect the actual direction of travel, but one of the motors seemed to behave differently.
(And of course “backward” doesn’t exist in a circle. I mean according to the right hand rule for non-inverted motors.)
At the top of the program, try stating .restoreFactoryDefaults(). Then set it as inverted.