Advertisement
Trainlover08

Motor Curve Class

May 16th, 2024 (edited)
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.33 KB | None | 0 0
  1. double motor_curve(double input) {
  2.     //convert from -127 to 127 into -100 to 100
  3.     input = (input * (127.0f / 100.0f));
  4.     char toggle;
  5.     if (input < 0) {
  6.         toggle = -1;
  7.     } else {
  8.         toggle = 1;
  9.     }
  10.     //convert back and do final calculations
  11.     return (100.0f / 127.0f) * (toggle * (std::exp((toggle * input) * 0.04615)));
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement