Go to Post lets get FIRST in every home around the world, and a robot in every school. - Rohith Surampudi [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 01-02-2004, 13:03
deltacoder1020's Avatar
deltacoder1020 deltacoder1020 is offline
Computer Guy
AKA: Dav
#1020 (The Indiana Prank Monkeys)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Muncie, Indiana
Posts: 340
deltacoder1020 has a spectacular aura aboutdeltacoder1020 has a spectacular aura about
Send a message via AIM to deltacoder1020
Re: Desensitizing Joysticks

Quote:
Originally Posted by KevinB
Looking back at my statement reminds me of why coding at midnight is bad.
hey, look at the post time on my reply
__________________
Team 1020, the Indiana Prank Monkeys (www.team1020.org)
  #17   Spotlight this post!  
Unread 01-02-2004, 13:07
WillyC's Avatar
WillyC WillyC is offline
"handy"
#1347
Team Role: Engineer
 
Join Date: Jan 2004
Location: Ottawa, Canada
Posts: 29
WillyC is on a distinguished road
Re: Desensitizing Joysticks

Quote:
Originally Posted by deltacoder1020
hey, look at the post time on my reply
My most productive coding hours are between midnight and 3am, and I can't explain why....yawn....why I'm so tired today...
  #18   Spotlight this post!  
Unread 01-02-2004, 13:21
thoughtful's Avatar
thoughtful thoughtful is offline
Registered User
FRC #1219 (Emery Iron Eagle)
Team Role: Alumni
 
Join Date: Nov 2003
Location: Toronto,Canada
Posts: 291
thoughtful is a splendid one to beholdthoughtful is a splendid one to beholdthoughtful is a splendid one to beholdthoughtful is a splendid one to beholdthoughtful is a splendid one to beholdthoughtful is a splendid one to beholdthoughtful is a splendid one to behold
Re: Desensitizing Joysticks

That is very helpful file.

What i was thinking is, have a max change function in real-time like you mentioned.

Basically you jus need a variable that holds the current joystick input. For example if your joystick was at 135 and you pushed it to 250 all of a sudden, You can check you current motor output which was 135 and then current joystick input which is 250, now you keep adding a certain number lets say 10 to the motor output untill it reaches 250.

This is one way to do it, the other way is to subtract 250-135, you get 115 devide it by a number lets say 10 so you get 11.5 , now ur max change is 11.5 , add that 10 times to your motor output or until it reaches desired position, this way you will have variable max change function.
__________________
.:Bringling Brains to Life:.

03,04,05-Team 1219 Captain
2003 Rookie all Start @ GTR
2005 Galileo Semi-Finalist & Alliance captain
06-Team 1219 Mentor
2006 Radio Shack Innovation in control @ Waterloo

Last edited by thoughtful : 01-02-2004 at 13:29.
  #19   Spotlight this post!  
Unread 01-02-2004, 14:02
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,600
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Desensitizing Joysticks

Quote:
Originally Posted by KenWittlief
I dont understand how putting a deadband around 127 will make the joystick less sensitive

in fact, your bot is going to lurch when the joystick is moved just outside the deadband
But, your robot doesn't move when you give it a small value, because of friction and other factors. In '99 we did some tests with our robot, and you had to give it something to the effect of 145 to get it to move from a stop. So, we programmed in a deadzone from 117-137, and then starting at 138, we scaled the values from 145 to 254.
  #20   Spotlight this post!  
Unread 01-02-2004, 14:18
WillyC's Avatar
WillyC WillyC is offline
"handy"
#1347
Team Role: Engineer
 
Join Date: Jan 2004
Location: Ottawa, Canada
Posts: 29
WillyC is on a distinguished road
Re: Desensitizing Joysticks

Quote:
Originally Posted by Joe Ross
But, your robot doesn't move when you give it a small value, because of friction and other factors. In '99 we did some tests with our robot, and you had to give it something to the effect of 145 to get it to move from a stop. So, we programmed in a deadzone from 117-137, and then starting at 138, we scaled the values from 145 to 254.
Ahhh, good point Joe. Note though, that the nonlinear function I gave essentially has that deadband built in (very low response to joystick inputs around neutral), but it's a smooth and continous transition to the "on" state, instead of being abrupt. I guess once the bot is built up and you're testing it to see how much motor output is needed to start moving, you could tailor the transfer function a little to get it to "turn on" at that motor output. The smooth nature of the function takes care of the scaling from that point up to the max.


Quote:
Originally Posted by thoughtful
This is one way to do it, the other way is to subtract 250-135, you get 115 devide it by a number lets say 10 so you get 11.5 , now ur max change is 11.5 , add that 10 times to your motor output or until it reaches desired position, this way you will have variable max change function.
This works too. But I think you should be careful about remembering values from loop to loop and using them to calculate motor output. Suppose you're in the middle of changing the motor output as you suggest, but then the driver suddenly moves the stick full the other way. Now your math might suggest that the max change to the motor is huge, and you might get a big drive current spike as the motor responds. If you're going to do this, just be careful about how you write the calculation so that you don't over-juice the motor.
  #21   Spotlight this post!  
Unread 02-02-2004, 01:30
Scooter's Avatar
Scooter Scooter is offline
Galactic Doughnut!!
#0418 (Purple Haze)
Team Role: Programmer
 
Join Date: Feb 2003
Location: Austin, Texas
Posts: 117
Scooter will become famous soon enoughScooter will become famous soon enough
Send a message via AIM to Scooter
Re: Desensitizing Joysticks

What we use is a exponenetial function. This simply shifts the power curve out some while still retaining full power at the edges. Instead of it being completely linear, it follows a curve (that looks suspiciously like a cubic function). At 50% joystick travel, you may only have 33% motor output, but at 100% joystick travel, you have 100% motor output.

Another technique that I learned from flying R/C Heli's is to grip the joystick at the bottom with just a few fingers....This helps to make movements less extreme....they only downside is that it is a little tuffer to get to the buttons...The advantage is that the movement comes from the fingers instead of the arm and wrists, and it affords you alot more accuracy.

Bill
__________________
"Those who think that they know everything are especially annoying to those of us who do."

Last edited by Scooter : 02-02-2004 at 01:33.
  #22   Spotlight this post!  
Unread 02-02-2004, 21:53
MichalSkiba MichalSkiba is offline
Low-Power BiCMOS Brain
#0854 (M.I.R.)
 
Join Date: Apr 2003
Location: TORONTO
Posts: 64
MichalSkiba will become famous soon enough
Re: Desensitizing Joysticks

This is what I came up with during our team's meeting today after school:

/*
pwm is a jostick value, 0-254
pwm_in is the pwm_out of the default code
pwm_out is the new value going to the joysticks
null_zone_swing_fraction is the amount you'd want the joystick to move without the motors kicking in.
*/

pwm_out = (pwm_in / (1-null_zone_swing_fraction)) - null_zone_swing_fraction(1 - null_zone_swing_fraction)

So. Its quite simply a y = mx + b "transfer" function. enjoy.
__________________
<<<theoldmanskiba>>>

2003 Canadian Regional Delphi Driving Tomorrow's Technology Award winners
  #23   Spotlight this post!  
Unread 02-02-2004, 21:56
MichalSkiba MichalSkiba is offline
Low-Power BiCMOS Brain
#0854 (M.I.R.)
 
Join Date: Apr 2003
Location: TORONTO
Posts: 64
MichalSkiba will become famous soon enough
Re: Desensitizing Joysticks

Exponential Function: simple sin(x) function:

amplitude = 2 * 127 (pwm max)
period = 4 * 127

make sure, as i forgot to in my previous post (above):

pwm = pwm - 127;

That way the origin is the middle of the null zone. makes for nice calculations.
__________________
<<<theoldmanskiba>>>

2003 Canadian Regional Delphi Driving Tomorrow's Technology Award winners
  #24   Spotlight this post!  
Unread 03-02-2004, 09:13
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,906
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Desensitizing Joysticks

Quote:
Originally Posted by Joe Ross
But, your robot doesn't move when you give it a small value, because of friction and other factors. In '99 we did some tests with our robot, and you had to give it something to the effect of 145 to get it to move from a stop. So, we programmed in a deadzone from 117-137, and then starting at 138, we scaled the values from 145 to 254.
The motors have gained more power since '99.
The new drills introduced last year have almost no delay at low power values.

The deadstick area is still nice, but you also need to scale the output rather than start at 138.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #25   Spotlight this post!  
Unread 03-02-2004, 09:20
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Desensitizing Joysticks

You could use low pass filter. I'm at school right now and don't have access to what I've written, but I'll try to post it when I get home.
__________________

  #26   Spotlight this post!  
Unread 03-02-2004, 09:47
WillyC's Avatar
WillyC WillyC is offline
"handy"
#1347
Team Role: Engineer
 
Join Date: Jan 2004
Location: Ottawa, Canada
Posts: 29
WillyC is on a distinguished road
Re: Desensitizing Joysticks

This is what I love about programming...there are so many different ways to solve the same problem. All of these are nest ideas. Good luck everyone!
  #27   Spotlight this post!  
Unread 03-02-2004, 14:47
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Desensitizing Joysticks

I've posted the low pass filter on the white pages. It's called low pass filter. (Duh! )

An example usage:
Code:
...
pwm01 = rampPWM(pwm01, where_we_want_it, 6, 5);
...
Basically, you call this function with what your current speed is, where you want it to be, how fast you want it to get there (higher numbers are faster), and how large you want the dead zone to be (i.e. if the joystick is at 129, you probably want to be at 127. You can set how far from 127 it will be corrected with this param.). It returns what value you should set the PWM to next.

By calling this function multiple times you get a nice gradual increase in output values, so if you move the joystick as fast as you can in circles, very little of that will be picked up. How sensitive it is to input is set by you. The exact equation for finding what to set sensitivity to:
255
-------------- = t
(1000/26.2)*s

t is time in this equation. deterimine what time (in seconds) you think is best for it to be able to go from full reverse to full forward and plug that equation. Solve and use that as your input to the function, ignoring any decimal portion. For instance, if t = 1 sec, then s = 6.

Note that the equation assumes it is being called every 26.2 ms.

Post again if you have any questions about the code or if you'd like to comment on it.

PS I had to re-write it because somebody took my disk that I had that on, so it hasn't been complied. It should be right, though.
__________________


Last edited by Ryan M. : 03-02-2004 at 14:56.
  #28   Spotlight this post!  
Unread 03-02-2004, 17:00
Chris Hibner's Avatar Unsung FIRST Hero
Chris Hibner Chris Hibner is offline
Eschewing Obfuscation Since 1990
AKA: Lars Kamen's Roadie
FRC #0051 (Wings of Fire)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1997
Location: Canton, MI
Posts: 1,488
Chris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond repute
Re: Desensitizing Joysticks

Beware of low pass filters. We used an LPF on the joystick once and we decided that we didn't like using it. Under acceleration, it's fine, but under stopping, it's not so good. To make the story short, it will cause you to overshoot (because it ramps down your input just like it ramps it up). You can try some funky "if increasing do this, if decreasing do that" logic, but I really don't think it's worth it.

Also, the deadbands that have been described here are discontinuous deadbands, which are generally considered "hack" deadbands in the controls world (due to their abrupt change at the deadzone point). For a continuous deadzone (more commonly used), do this:

DeadZone = 15; // Calibration parameter
if (Joy > (127-DeadZone) && Joy < (127+DeadZone)) Joy = 127;
else if (Joy <= (127-DeadZone)) Joy += DeadZone;
else Joy -= DeadZone;
__________________
-
An ounce of perception is worth a pound of obscure.

Last edited by Chris Hibner : 03-02-2004 at 17:04.
  #29   Spotlight this post!  
Unread 03-02-2004, 18:25
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Desensitizing Joysticks

Thanks for the warnings.
__________________

  #30   Spotlight this post!  
Unread 03-02-2004, 20:02
bob1million's Avatar
bob1million bob1million is offline
Registered User
#0825 (Swivvey-gus Maximus)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Pearisburg
Posts: 7
bob1million is an unknown quantity at this point
Re: Desensitizing Joysticks

Quote:
Originally Posted by WillyC
I've got to agree with Ken on this one. This deadband approach will make the joysticks more sensitive, because the motor output is proportional to the joystick deflection. If you ignore the stick input unless it's greater than 135 or less than 119, then as the stick moves out of the deadband and starts the motor moving, the motor's smallest non-zero speed is even faster than without the deadband. The result will be jerkiness as the bot starts moving.

Ken's solution sounds good, and is obviously more efficient than what I'm about to suggest here. I haven't tried my idea on the bot yet, and I'm a little sketchy about putting a lookup table of any size into the user routine because I don't want to slow it down too much. But here's the principle: make a slightly non-linear lookup table to de-emphasize the stick input near neutral, but not near the max/min. I've attached an example of the kind of curve I'm thinking of. Notice that near 127, it "dumbs down" the stick input to drive the motors slower and make the sticks less sensitive, but near the high or low end of the input it looks almost linear to make the driveability at high speeds feel pretty normal.

Try it out and let me know what you think! Like I said, I haven't tried this on the bot yet...

EDIT: I just changed the .xls to a zipped up .xls.
This works great on our bot, everyone from SWVGS Maximus thanks you.
We used a switch statement and it did not slow down anything. It is a big improvement from what we had.
__________________
"Death smiles at us all, all a robot can do is smile back."

Last edited by bob1million : 03-02-2004 at 20:13.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming joysticks NoRemorse Programming 29 24-02-2004 20:26
number of joysticks doy Rules/Strategy 5 01-02-2004 00:05
Team 524 has Team 362's spare joysticks from last year. archiver 2001 0 24-06-2002 02:36
Could use some help with joysticks . . . archiver 2001 5 23-06-2002 23:36
Calibrating speed controllers and joysticks thedillybar Technical Discussion 4 11-02-2002 13:24


All times are GMT -5. The time now is 03:11.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi