Go to Post We're 30 pounds over LOL. I probably shouldn't be lol'ing, but it is 11:52PM, I just got home from a 15 hour build session, and I find the word 'potato' funny. - ZakuAce [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
  #1   Spotlight this post!  
Unread 26-01-2006, 14:38
sacr3denigma sacr3denigma is offline
Registered User
None #0280
 
Join Date: Jan 2006
Location: Taylor
Posts: 1
sacr3denigma is an unknown quantity at this point
Need help with our deadspace.

This is what we are using for our deadspace. Only problem with it is that it jumps from being 127 to say 142 without slowly getting up to speed. We would like to make this much smooth. I am fairly new at robot language but have c++ experience if that helps any. Please reply if you can help thankyou.
temp2 = (unsigned int)p2_y;

if (temp2 > (127 + DEADSPACE))
{
pwm02 = 255 - (unsigned char)(((temp2 - (127 + DEADSPACE)) * (127 / (127 - DEADSPACE))) + 127);
}
else if (temp2 < (127 - DEADSPACE))
{
pwm02 = 255 - (unsigned char)(temp2 * 127 / (127 - DEADSPACE));
}
else
{
pwm02 = 127;
}
  #2   Spotlight this post!  
Unread 26-01-2006, 14:57
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,372
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Need help with our deadspace.

Quote:
Originally Posted by sacr3denigma
This is what we are using for our deadspace. Only problem with it is that it jumps from being 127 to say 142 without slowly getting up to speed. We would like to make this much smooth. I am fairly new at robot language but have c++ experience if that helps any. Please reply if you can help thankyou.
temp2 = (unsigned int)p2_y;

if (temp2 > (127 + DEADSPACE))
{
pwm02 = 255 - (unsigned char)(((temp2 - (127 + DEADSPACE)) * (127 / (127 - DEADSPACE))) + 127);
}
else if (temp2 < (127 - DEADSPACE))
{
pwm02 = 255 - (unsigned char)(temp2 * 127 / (127 - DEADSPACE));
}
else
{
pwm02 = 127;
}
I believe what you are seeing is the Dead band built into the Victors themselves. This window, approx. 117 to 137, is to allow for the fact that most Joysticks don't always return to 127 at dead center, there is some variability. So, IFI designed this window to accommodate this variability. My suggestion: Calibrate the Victor to the input being used.

Other users here may suggest alternatives to this. Programming that will apply the standard slope equation, Y=MX+B, is one of them. I find that calibrating the Victor is a little easier, but by no means is it "The Best" way to do it.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
  #3   Spotlight this post!  
Unread 26-01-2006, 18:09
gnormhurst's Avatar
gnormhurst gnormhurst is offline
Norm Hurst
AKA: gnorm
#0381 (The Tornadoes)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Trenton, NJ
Posts: 138
gnormhurst will become famous soon enoughgnormhurst will become famous soon enough
Re: Need help with our deadspace.

Quote:
Originally Posted by billbo911
I believe what you are seeing is the Dead band built into the Victors themselves. This window, approx. 117 to 137, is to allow for the fact that most Joysticks don't always return to 127 at dead center, there is some variability. So, IFI designed this window to accommodate this variability. My suggestion: Calibrate the Victor to the input being used.

Other users here may suggest alternatives to this. Programming that will apply the standard slope equation, Y=MX+B, is one of them. I find that calibrating the Victor is a little easier, but by no means is it "The Best" way to do it.
I spent many hours developing a drive system that was less sensitive at slow speeds. Here is a thread that includes the code.

I also got around the fact that the Victor controllers see a value within about +/-7 units of 127 and just call it zero. If the value you want to send is less than 127, subtract an additional 7. If it is more than 127, add an additional 7:

if ( val > 127 )
val += 7;
if ( val < 127 )
val -= 7;

The Victors have a calibration procedure designed to match them to your joystick, but I like to calibrate them to specific values, so I wrote some code that would produce 127s, then 0s when I pushed one button, then 255s when I pushed another (like I was swinging the joystick through its range). I used that while I calibrated the Victors. The Victor calibration procedure is explained in the Victor data sheet.
__________________
Trenton Tornadoes 381
2004 Philadelphia Regional Winners
2006 Xerox Creativity Award
---
My corner of the USPTO.
My favorite error message from gcc: main is usually a function
My favorite error message from Windows: There is not enough disk space available to delete this file.
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


All times are GMT -5. The time now is 22:34.

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