CrossTheRoadElec / Phoenix-api

CTRE Phoenix language API (targets FIRST Robotics Competition, Linux, RaspPi, Windows)
Other
39 stars 28 forks source link

Soft Limits Don't Work #19

Closed rgreenblatt closed 6 years ago

rgreenblatt commented 6 years ago

After trying and failing to get soft limits to work on a mechanism controlled with positional PID, we tried setting the forward and reverse limits to 0 (with soft limits enabled, using the web dash). The motor's movement was still completely unrestricted. We were using a CTRE_MagEncoder_Absolute with PulseWidthEncodedPosition = 8.

ozrien commented 6 years ago

Make sure in robot-code you have not overridden-OFF the soft limits. Pass true to OverrideSoftLimitsEnable() if you are using this function.

Also be sure to Config the Threshold and Enable for the sides you care about...

These are the relevent functions... ConfigForwardSoftLimitThreshold (int forwardSensorLimit, int timeoutMs)  ConfigReverseSoftLimitThreshold (int reverseSensorLimit, int timeoutMs)  ConfigForwardSoftLimitEnable (bool enable, int timeoutMs)  ConfigReverseSoftLimitEnable (bool enable, int timeoutMs)  OverrideSoftLimitsEnable (bool enable) C++ API

Also use the web-based config to confirm the checkbox and thresholds for soft-limit.

Make sure the sensor is in phase, once you've done that ,you can SetInverted() to choose what you want to be "forward" and "reverse". If the sensor is not in phase, the feature will not function correctly.

ozrien commented 6 years ago

Sounds like the issue was resolved based on an offline conversation. So closing issue.