Go to Post IMO, everyone should experience at least one Battlecry. - Dan Petrovic [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 27-03-2008, 20:40
andrew_4_life andrew_4_life is offline
Registered User
FRC #0919
 
Join Date: Jan 2006
Location: Toronto, Ontario
Posts: 9
andrew_4_life is an unknown quantity at this point
1 joystick controls not turning properly

When I load this code, the drive seems to mess up. Going forward and back is fine, but it won't turn to the correct side. When I turn "RIGHT" it turns "LEFT", when I turn "LEFT" it turns "RIGHT"
I've also tried switching the PWN cables but that just really messed up the controls because it was going backwards.


Code:
 
 /*---------- Analog Inputs (Joysticks) to PWM Outputs-----------------------
  *--------------------------------------------------------------------------
  *   This maps the joystick axes to specific PWM outputs.
  */
  //pwm01 = p1_y;
  //pwm02 = p2_y;   
  pwm03 = p3_y;   
  pwm04 = p4_y;   
  pwm05 = p1_x;  
  pwm06 = p2_x;   
  pwm07 = p3_x;   
  pwm08 = p4_x;   
  pwm09 = p1_wheel;
  pwm10 = p2_wheel;   
  pwm11 = p3_wheel;   
  pwm12 = p4_wheel;   
  
 /*---------- 1 Joystick Drive ---------------------------------------------
  p1_x = 255 - p1_y;
  p1_y = 255 - pwm05;

  pwm01 = Limit_Mix(2000 + p1_y + p1_x - 127);
  pwm02 = Limit_Mix(2000 + p1_y - p1_x + 127);
We also tried this: (reversing the signs
Code:
  
pwm01 = Limit_Mix(2000 + p1_y - p1_x +127);
  pwm02 = Limit_Mix(2000 + p1_y + p1_x - 127);
  #2   Spotlight this post!  
Unread 27-03-2008, 20:43
Bongle's Avatar
Bongle Bongle is offline
Registered User
FRC #2702 (REBotics)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Waterloo
Posts: 1,069
Bongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond repute
Send a message via MSN to Bongle
Re: 1 joystick controls not turning properly

before the 1 joystick drive portion, do this:

p1_x = 254 - p1_x

This will make the math controlling the 1-joystick drive believe that the joystick is facing the opposite direction than it is.
  #3   Spotlight this post!  
Unread 27-03-2008, 21:48
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: 1 joystick controls not turning properly

Quote:
Originally Posted by andrew_4_life View Post
When I load this code, the drive seems to mess up. Going forward and back is fine, but it won't turn to the correct side. When I turn "RIGHT" it turns "LEFT", when I turn "LEFT" it turns "RIGHT"
I've also tried switching the PWN cables but that just really messed up the controls because it was going backwards.
It sounds like you just need to redefine which direction is "forward" on your robot.

Seriously, Bongle has a suggestion that will work. You could also fix it in hardware by swapping the motor connections on the output of the speed controllers. That will make the motors run in the proper direction.
  #4   Spotlight this post!  
Unread 27-03-2008, 23:05
andrew_4_life andrew_4_life is offline
Registered User
FRC #0919
 
Join Date: Jan 2006
Location: Toronto, Ontario
Posts: 9
andrew_4_life is an unknown quantity at this point
Re: 1 joystick controls not turning properly

Quote:
Originally Posted by Alan Anderson View Post
It sounds like you just need to redefine which direction is "forward" on your robot.

Seriously, Bongle has a suggestion that will work. You could also fix it in hardware by swapping the motor connections on the output of the speed controllers. That will make the motors run in the proper direction.
I'll test out Bongle's suggestion tomorrow when I have access to the robot. But your suggestion of switching the motor connections on the output for the victors won't work because then it will drive backwards when I tell it to drive forwards. You suggestion can easily be done by swapping the PWM cables, but like I said, it makes everything backwards and still turns incorrectly though.
  #5   Spotlight this post!  
Unread 28-03-2008, 01:22
BigJ BigJ is offline
Registered User
AKA: Josh P.
FRC #1675 (Ultimate Protection Squad)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Milwaukee, WI
Posts: 947
BigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond repute
Re: 1 joystick controls not turning properly

This year, for some reason, every single one of our joysticks was giving us the wrong (opposite) 0-255 numbers on the x-axis. We had to flip it in code.
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
Converting Joystick controls over to switches Japper Programming 6 27-02-2007 09:50
To function properly? Pirate_Nelly354 Chit-Chat 22 18-08-2006 21:33
CMU Cam not Tracking Properly on Robot coastertux Programming 6 29-01-2006 00:02
Chain..... How you do it properly? JasJ002 Inventor 12 03-06-2005 08:49
Using non joystick controls with Operator Interface (Hacking Various Controllers) Astronouth7303 Control System 58 02-02-2005 15:56


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

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