Hello. My Team, Team 2559 is having some problems with coding. Specifically, our wheels are rapidly turning in random directions, with no thought about it. I am trying to figure out why. We have updated our encoders, motor controllers, PDB, and roborio. We believe it is a problem with the code. Does anyone know what values specifically might be causing this?
edit 2: we noticed one of our values for the angle sensor is increasing, and the turning function of the wheels is accelerating with it. The specific name for the value is AngleSensor::Getabsolutevalue position.value
Hi! I can’t say I have enough experience to know any general advice or common issues, but I imagine that it will be much easier for people to help if you provide a sample of the code you expect isn’t working. Or if it’s entirely made from example/template code, perhaps a link to that.
So the AngleSensor is not giving what you’d expect, right? Are you able to disable the motor attached to it (coast mode, not brake), move the axle in question, and see whether the values are similar to what you’d expect? If everything seems fine, also double-check that the positive rotation is the same direction as how the motor is defined.
If the encoder and motor have positive rotation defined oppositely, then any feedback loop will accelerate unstably in the same direction as any disturbance.