SJSURoboticsTeam / urc-central-2021

Track progress and information for the URC 2021 competition
MIT License
1 stars 0 forks source link

Implement max/min angles & speed for arm system #204

Closed naterpotatoers closed 2 years ago

naterpotatoers commented 2 years ago

Now that we have logic for SetAngle and SetSpeed we need to consider minimum and maximums. For example there is no max or minimum speed for speed so someone could theoretically set the arm speed to 9999999999999 and kill our robot or something. For angle we do have max and min defined however the logic for containing it is a bit hard to follow e.g. calibrated_angle = units::math::min( units::math::max(calibrated_angle, minimum_angle), maximum_angle); Ideally we should use std::clamp() as it is how it is done in Wheel.hpp. It looks a lot cleaner and would keep our code consistent. Once that is implemented consider writing unit tests verifying that setting the angle beyond max & min works as intended.

Andrew-Ingerman commented 2 years ago

I noticed that speed is measured in RPM, is there away to send percentages to the motor? Or is there a max/min RPM you have in mind

naterpotatoers commented 2 years ago

Not sure about percentages, but for min/max maybe we can start out with +/-100rpm ? We can always change it later

naterpotatoers commented 2 years ago

done