YAGSL Having Erratic Motion and Many Errors

We are having an issue where upon enable, all modules begin rotating back and forth rapidly and the drive motors spin at a ~medium speed. After doing this for a bit, it will stop but if any control is inputted then it will start again. There is a constant stream of “CANCoder magnetic field is less than ideal.” and “CANCoder reading was faulty.” messages (The CANCoders themselves show that everything is fine). After a few minutes the robot code stops running, seemingly in a crash loop judging by the graphs, and a little while later we loose comms.

The configuration is ThrifySwerve (NEO + NEO550 + CANCoder) with NavX running a program that is fundamentally the YAGSL example with different configuration JSONs and two unrelated subsystems. (https://github.com/Delmar-Robotics-Engineers-At-MADE/ChumChucker3/tree/053191bc8ce6a453d20ff89afc51c45ec18571fc/src/main)

I would expect the modules to snap to random positions as the offset is not configured yet, however, back and forth rotation combined with running drive motors is not expected.

When the line setting the default command is commented out, the movement does stop, meaning that one of the commands there was causing it.

I have to assume that something is wrong in either config files because everything else is copied but am not sure what.

Are your azimuth motors’ inverted value set correctly. As in if they are set as inverted, does your config json reflect that?

Another question would be if the PID is properly tuned for your azimuth motor.

Given that they were oscillating, not just spinning in one direction, I am not sure if the inverted setting was correct or not.

I have not tuned the PID at all. Not sure if my memory is correct but the azimuth rotations did not seem in line with they typical untuned PID characteristic of going to approximately the correct position and making overcorrections. They were probably around 70 to 90 degrees.

First ensure your inversion is right. The CANCoder reading error is a response to a less than ideal CANBus utilization and it failed to read what position the CANCoder was at. The Magnetic strength means that your magnetic strength from the magnet to encoder isn’t ‘great’ or if it’s that bad it may be because the magnetic field strength is so bad it’s unusable. Here is the snippet for your issue. If your encoder reading is that bad YAGSL will fall back to the relative encoder’s (integrated into motor) reading.

I will try inverting the azimuth the next time I have access to the robot.

The CANCoders were updated to Phoenix 6. Is this causing any issue?

It shouldn’t, the CANCoder issue is purely physical. Check the HW docs, they should be green when on and not red.

We are getting the same issue with the CANCoders. All four of our CANcoders say “CANCoder magnetic field is less than ideal.” Wondering if anyone had any thoughts? Thanks.

Are you running phoenix 6 at all? Downgrading to v5 seemed to make that issue go away.

Ok. Thanks. Appreciate it. I will try that when I am back in on Wed.

I will be upgrading YAGSL to Pheonix 6 sometime this week hopefully just so you are aware.

Oh. Ok. Great thanks. Appreciate you letting us know. I will be in Wed. and check out the Phoenix we are using. Any thoughts on why our Rio Com light would be red, but the drive station Com is green. Drive station says “No Code”. Our code was running, but wheels were not aligning with each other. And we were getting “CANcoder magnetic field is less than ideal.” Now we are getting the red com rio/and no code driver. Thanks.

Reformat your rio, or just redoploy your code, the “No code” light appears when the program isn’t running on the roboRIO as if it crashed. The rio comms light is also tied to the user program if it is running. (I think i have to look the latter up)

From what happened to us, this is most likely a crash loop caused by the sheer number of error messages. You can check the driverstation graphs to be sure.

Purely out of curiosity, does it seem to start fine and get progressively slower/worse until you lose comms?

Tried reformatting rio. But now cannot get our team number applied. Keep getting this:

Try the RoboRIO Team Number Setter tool (distributed by WPILib).

Ok. Thanks. Used the number setter. That worked. Same issue. This is the graph from the driver station: Cycles out at about 5 seconds. Then restarts at zero with the same graph.
image

Hello again. Just deployed BaseFalconSwerve as a trial, and it did run code/coms on the driver station. So would that indicate the issue is too many code errors?

O.K. Found that two encoder ids were beyond the 0-31 range. So changed them. Updated the CANcoders back to version 5. Now the 3512 code runs. The swerve unit wheels are not aligned and every 2-3 seconds they make a random adjustment. But never aligned. Wondering if anyone had any thoughts at this point?

I don’t know if 3512’s code has this but that sounds like synchronization. Try inverting your angle/steering motors.

Thanks. Tried switching it here. Does that make sense?