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.