Competition Language | ||
Bound | How to Use |
The bound function behaves very similarily to the mapping function. The only difference is what happens beyond the two fixed x values. Its code equivalent of it is constraining a mapped function to the two y values. This would be used for the very same reasons for using the mapping function, auto-correction, but it maxes out the values. So if you want a part of your robot to auto-correct, but never go too fast, this will keep it within those speeds.
The bound function works exaclty like the map function, besides the fact that it also constrains the output between the two y values. This is useful if you either want a motor never to be going faster than a certain speed while auto-correcting (for more precision), or you are using Natural Language to start your motors.