![]() |
reducing sensativity of joystick for precision?
Hi, we are using a joystick to act as a throttle. We realize that we don't need to move the joystick far to get the bot moving fast. I'm trying to reduce the sensativty of the joystick near the beginning of the swing for precise control. We could just scale the output down, but I would like to limit the max speed at the top of the swing. Does anyone have any suggestions? I heard of using a cubic equation, but I'm not sure how to impiment this in code. I was also think about using a sine or cos function to multiply to the throttle raw output, but then that would start getting floating point math involved in which i want to try to stay away from.
Thanks, windell |
Re: reducing sensativity of joystick for precision?
An easy way to stay away from the floating-point math is to do the calculations yourself, round to integers, and make a lookup table. There are way to accomplish these ideas in code though, through using bigger numbers to save precision while making calculations.
|
Re: reducing sensativity of joystick for precision?
The cubic equation is actually fairly easy to use. It looks something like this:
Code:
long temp; |
Re: reducing sensativity of joystick for precision?
Quote:
As long as you put all your division at the end of the line, everything will be integer operations and shouldn't take much longer than a LUT. |
Re: reducing sensativity of joystick for precision?
Thanks guys! I think ill use the cubic function since its startup time seems to be the lowest. Although I do like the lookup table idea as it is great for motor control! anyways thanks a lot! you're a life saver
windell |
Re: reducing sensativity of joystick for precision?
just write a prog to write out the table then copy paste into code its really easy to change.
|
Re: reducing sensativity of joystick for precision?
2 Attachment(s)
Attached is a EasyC program that has been used in various forms to build mapping tables for the robot in the past. You change the UserInclude.h to match the pwm/encoder pins you are using on the robot and then run the program with the robot up on chocks so the wheels are free to spin.
The program builds C rom data tables for unmapped, linear, two stage linear and a 4th user defined (whatever you want to add) mapping table. You capture the tables from hyperterminal and plug them back into your build environment. Yeah, this is done under no-load conditions, but it gets close enough. The code determines slowest speed at which the wheels reliably turn, max speed and then derates that to 90% and then tries to match left/right wheel to the current formula with the least difference between left/right and desired mapping point. The doc file shows uncompensated and linear mapping that results from the program. The program also generates a two step mapping with 80% of joystick travel covering 60% of the robot velocity. The mappings can be changed to whatever is desired. An example of how the map tables are used. Code:
<wheels.h - data from mapping program> |
Re: reducing sensativity of joystick for precision?
Actually, you can create the lookup table in excel in a matter of seconds and copy and paste it over into your code. There's no disadvantage to using a LUT over the formula, other than memory, and since the LUT should be placed in ROM that's not much of an issue either.
|
Re: reducing sensativity of joystick for precision?
PHP Code:
:eek: |
| All times are GMT -5. The time now is 00:54. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi