Go to Post Fear the power of the custodians! - Fixen [more]
Home
Go Back   Chief Delphi > Other > FIRST Tech Challenge
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 03-11-2010, 21:30
JohnFogarty's Avatar
JohnFogarty JohnFogarty is offline
Trapped under a pile of MECANUMS :P
AKA: @doctorfogarty
FTC #11444 (Garnet Squadron) & FRC#1102 (M'Aiken Magic)
Team Role: Mentor
 
Join Date: Aug 2009
Rookie Year: 2006
Location: SC
Posts: 1,580
JohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond repute
[FTC]: Deadbands (axis/motor power restrictions)

Hello fellow programmers!
I am currently working on finding a solution to a probable bug which in being a programmer for the last 2 years never occurred. The base joystick to motor control has a bug in it.

4wd
Code:
motor[motorD]=joystick.joy1_y1;
motor[motorE]=joystick.joy1_y2;
motor[motorF]=joystick.joy1_y2;
motor[motorG]=joystick.joy1_y1;
It preforms the funtion, but one wheel always continues to spin even when the joystick may only be giving a output of 1 or 2. How do you implement dead bands on your analog sticks to control the motor power output.
__________________
John Fogarty
2010 FTC World Championship Winner & 2013-2014 FRC Orlando Regional Winner
Mentor FRC Team 1102 M'Aiken Magic
"Head Bot Coach" FTC Team 11444 Garnet Squadron
Former Student & Mentor FLL 1102, FTC 1102 & FTC 3864, FRC 1772, FRC 5632
2013 FTC World Championship Guest Speaker
Reply With Quote
  #2   Spotlight this post!  
Unread 04-11-2010, 12:56
RCXRM RCXRM is offline
Registered User
FTC #0245
 
Join Date: Nov 2010
Rookie Year: 2007
Location: Sunshine Coast, BC Canada
Posts: 1
RCXRM is an unknown quantity at this point
Re: [FTC]: Deadbands (axis/motor power restrictions)

Here is the code we've used to create deadbands:

Code:
if((joystick.joy1_y1 < 5) && (joystick.joy1_y1 > -5)) joystick.joy1_y1 = 0;
motor[motorD]=joystick.joy1_y1;
Reply With Quote
  #3   Spotlight this post!  
Unread 04-11-2010, 13:40
NalaTI NalaTI is offline
Registered User
AKA: Alan
FTC #2848 (Techno Guards)
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2005
Location: California
Posts: 106
NalaTI is just really niceNalaTI is just really niceNalaTI is just really niceNalaTI is just really nice
Re: [FTC]: Deadbands (axis/motor power restrictions)

I dont have it right here, but ours is something like:

Code:
// since joysticks return -127 to 127 values, and since motors react in a 
// rance of -100 to 100, this function adds a midpoint deadband and 
// adjusts the speed to be within the expected range.

int deadband(int invalue)
{
   // if the value is between -27 and 27 then use
   // that as the deadband and return 0

   if (abs(invalue) < 27) return 0;
   

   // if the value is negative, add 27 to bring the (-27 to -127) to (0 to -100)
   if (invalue < 0) return invalue + 27;

   // if the value is not > 27 then it already exited, so - 27 and return
 
   return invalue - 27;

}

task main()
{
   motor[motorA] = deadband(joystick.joy1_y1);
   motor[motorB] = deadband(joystick.joy1_x1);
   motor[motorC] = deadband(joystick.joy1_y2);
   motor[motorD] = deadband(joystick.joy1_x2);

}
__________________
Reply With Quote
  #4   Spotlight this post!  
Unread 04-11-2010, 17:23
JohnFogarty's Avatar
JohnFogarty JohnFogarty is offline
Trapped under a pile of MECANUMS :P
AKA: @doctorfogarty
FTC #11444 (Garnet Squadron) & FRC#1102 (M'Aiken Magic)
Team Role: Mentor
 
Join Date: Aug 2009
Rookie Year: 2006
Location: SC
Posts: 1,580
JohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond repute
Re: [FTC]: Deadbands (axis/motor power restrictions)

Quote:
Originally Posted by RCXRM View Post
Here is the code we've used to create deadbands:

Code:
if((joystick.joy1_y1 < 5) && (joystick.joy1_y1 > -5)) joystick.joy1_y1 = 0;
motor[motorD]=joystick.joy1_y1;
haha that looks exactly like what I am trying today thanks
I'll just see what works best I may end up going with the other idea too but thank you for your help.
John Fogarty
GForce 3864
__________________
John Fogarty
2010 FTC World Championship Winner & 2013-2014 FRC Orlando Regional Winner
Mentor FRC Team 1102 M'Aiken Magic
"Head Bot Coach" FTC Team 11444 Garnet Squadron
Former Student & Mentor FLL 1102, FTC 1102 & FTC 3864, FRC 1772, FRC 5632
2013 FTC World Championship Guest Speaker
Reply With Quote
  #5   Spotlight this post!  
Unread 04-11-2010, 19:03
coollog's Avatar
coollog coollog is offline
Q
AKA: Qingyang Chen
FTC #5485 (PRO)
Team Role: Programmer
 
Join Date: Sep 2010
Rookie Year: 2007
Location: US
Posts: 9
coollog is an unknown quantity at this point
Re: [FTC]: Deadbands (axis/motor power restrictions)

Another way to do it is

Code:
int threshold = 12;

motor[motorD] = (abs(joystick.joy1_y1) >= threshold) * joystick.joy1_y1;
...
This basically just zeroes any joystick value that is within a threshold of 0.

Last edited by coollog : 04-11-2010 at 19:09.
Reply With Quote
Reply


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
Will a 1/3 horse power sump pump motor burn up at half power? Weird Al/ Tony Motors 46 09-04-2010 21:11
Axis Camera Power polarity hurtzmyhead Electrical 4 03-02-2010 09:21
Axis 206 Camera Power Supply EricWilliams FRC Control System 1 02-02-2010 17:18
Axis Camera 206 Power Connection Matt2081 Electrical 7 24-01-2010 15:51
axis camera power cable falling out.. dani190 Electrical 7 19-02-2009 13:55


All times are GMT -5. The time now is 13:01.

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