Hi, maybe someone can help me out here because I’m a bit stumped.
We have a Pot hooked up to a talon running motion magic on an arm. It works beautifully, but for some reason whenever the robot is powered on the Talon decides that wherever the pot is becomes the 0 value. This sort of defeats the purpose of us using the pot in the first place. Is there a way to have the Talon not zero at all? We just want 0v input to be our 0, at 5v to be our max, and wherever the pot is, is what we read.
Found nothing about it in the documentation, and everyone else seems to be using encoders so I can’t find topics on it. We do have the signal set up in the code as analog.
If you’re ensuring the sensor is not wrapping, I would configure it to not be continuous, look here and the API documentation here
In any case, the Talon shouldn’t be zero-ing the sensor on boot if it’s an analog sensor, I would check if you’re setting Sensor Position anywhere in your code, or if you have a limit switch configured to zero the sensor position.
Have you factory Defaulted the talon and done the sensor bring up? Have you performed a Self-Test to compare the raw analog value to the selected sensor position?
Only do this if you know the mechanism is not moving. There’s a slight lag when setting the selected sensor position, so what is set is what was read a few ms ago, causing an inaccuracy if the mechanism is moving.
Could you also post a screenshot of the config screen? Specifically with the advanced sensor and meas, closed loop, hardware limit switches, and home sensor tabs open like below? You can right-click collapse all and open just the ones we care about to make it easier.
In the case that you configFeedbackNotContinuous, it will ignore any software-set sensor position if using Analog or PWM and will rely solely on the raw sensor and the sensor phasing you set.
Based on this it sounds like Brandon was configuring the sensor to be not continuous at some point, but later un-configured it. That’s why I asked for the screenshot of the configs to confirm this.
I want to emphasize that on boot, an analog or pulse-width sensor will initialize to the absolute value being read from the Talon data port regardless of the FeedbackNotContinuous config. These sensor values do not initialize to 0 unless you explicitly set them to 0 in code.
If your absolute sensor value is being set to 0 when the physical setup/connection of your sensor is good, one of two things is happening:
SetSelectedSensorPosition(0) is being called OR
Talon is configured for clearPosOnLimR/LimF/Idx and your physical switch is being asserted.
Setting configFeedbackNotContinuous(true) isn’t intended to “solve” this problem, but it can be used as a workaround in the event the root cause for (1) or (2) above isn’t determined for whatever reason.
I cannot emphasize this enough - Using FeedbackNotContinuous(true) to solve a sensor zeroing problem is a workaround that masks the problem, NOT a solution to the root-cause. This may be acceptable for your use case, but I want to be clear about what’s causing the behavior you’re seeing.
If your mechanism stays within one rotation of the sensor during your movement, then wrapping/not wrapping doesn’t matter. The behavior is the same unless you’re explicitly zeroing the sensor as described above, which you should only be doing if that behavior is desired.
If your mechanism’s range of motion requires multiple rotations of the sensor, most of the time the desired behavior is to have a single range of sensor values for the entire range of motion (ie using an analog encoder, an infinite-turn potentiometer, pulse-width from a CTRE mag encoder, etc).
There are exceptions to this, such as absolute sensors with swerve module angles, but in that case you’re making a conscious decision to turn of wrap-counting.
Because if you are using an MA3 for continuous motion, like a drive-train, you want it false. I’m not sure how common this is now since CTRE Mag Encoder and changes in latest COTS gearboxes.
That settings also influences position-pulse-width-encoded signals in the same way. If you are using a pulse-width sensor for continuous motion, you also want it false.
I’m not against discussing it on a GitHub issue tracker, perhaps the default could change in 2020, but that has to be weighed against how it impacts teams that rely on it being default set to ‘false’ .