hytech-racing / MCU

https://hytech-racing.github.io/MCU/index.html
GNU General Public License v3.0
1 stars 0 forks source link

Power, torque, and negative speedpoint limit #73

Closed walkermburns closed 6 months ago

walkermburns commented 7 months ago

This PR replaces and completes the limiting functions that were present in the torque controllers.

These have been placed in the TCMUX since they should be applied to all controllers and all drivetrain requests.

The Power limit is a simple powerlimit akin to the one run on HT07. When calculated mechanical power is above the predetermined 63kw mechanical power limit it will scale down all motor torques to be below the 63kw limit while preserving ratios as determined by the torque controllers.

The torque limit works in a similar manner but takes the average torque value across all motors. This will effectively limit the torque output of our motors so that the average torque of all motors at any point in time is the same as the dashboard/ecu torque limit.

The negative speedtest limit function just takes the max of speed setpoint values above 0, preventing the car from commanding backwards motion

closes #66 closes #71

walkermburns commented 7 months ago

Eric has also looked over this in person. This can be merged as soon as we get to test it on the car.

walkermburns commented 6 months ago

Tested this last night and discovered/fixed problems with the power calculation. Still to test: