We often desire to scale the driver's joystick input to a more appropriate driver command. This is to enhance the controlability of the robot. We should implement a library that transforms joystick values into appropriate driver commands. This will be a stateless transform of joystick value to driver command, with both the input and output in the range -1 to 1 inclusive.
Three primary issues should be overcome:
Joysticks do not always return to exact center when released. There should be a configurable deadband on joystick input where, if the magnitude of the input is too small, it is assumed the driver is commanding zero motion.
Once a driver starts to move the joystick outside this deadband, motion is desired as soon as possible. Most motor-driven mechanisms (like drivetrains or arms) have a minimum command needed to get motion to occur (overcome static friction). Commands lower than this will simply cause the mechanism to hum and heat up, but not move (and are therefore not useful). To get around this, an inverse deadband should be implemented such that as soon as the driver's command gets outside the deadband range, a configurable minimum command is output.
Drivers often need fine-tune control at low speeds, but not at high speeds. In other words, they want the first half of the joystick range to control the first quarter (or less) of the command range. Since the ranges of input and output are -1 to 1, this is most easily done by raising the magnitude of the joystick value to a power (configurable), and preserving sign from input to output.
At the end of the day, the library should be a single class with a public "scale" method that takes one input of type double (the joystick value) and returns a single value of type double (the transformed command). The three parameters (deadband, inverse deadband, and exponential power) should also be publicly available to set.
We often desire to scale the driver's joystick input to a more appropriate driver command. This is to enhance the controlability of the robot. We should implement a library that transforms joystick values into appropriate driver commands. This will be a stateless transform of joystick value to driver command, with both the input and output in the range -1 to 1 inclusive.
Three primary issues should be overcome:
Joysticks do not always return to exact center when released. There should be a configurable deadband on joystick input where, if the magnitude of the input is too small, it is assumed the driver is commanding zero motion.
Once a driver starts to move the joystick outside this deadband, motion is desired as soon as possible. Most motor-driven mechanisms (like drivetrains or arms) have a minimum command needed to get motion to occur (overcome static friction). Commands lower than this will simply cause the mechanism to hum and heat up, but not move (and are therefore not useful). To get around this, an inverse deadband should be implemented such that as soon as the driver's command gets outside the deadband range, a configurable minimum command is output.
Drivers often need fine-tune control at low speeds, but not at high speeds. In other words, they want the first half of the joystick range to control the first quarter (or less) of the command range. Since the ranges of input and output are -1 to 1, this is most easily done by raising the magnitude of the joystick value to a power (configurable), and preserving sign from input to output.
Some of the math and graphs for this work are laid out in this ChiefDelphi paper
At the end of the day, the library should be a single class with a public "scale" method that takes one input of type double (the joystick value) and returns a single value of type double (the transformed command). The three parameters (deadband, inverse deadband, and exponential power) should also be publicly available to set.