Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double motor_curve(double input) {
- //convert from -127 to 127 into -100 to 100
- input = (input * (127.0f / 100.0f));
- char toggle;
- if (input < 0) {
- toggle = -1;
- } else {
- toggle = 1;
- }
- //convert back and do final calculations
- return (100.0f / 127.0f) * (toggle * (std::exp((toggle * input) * 0.04615)));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement