Go to Post Is it weird that I was hoping we wouldn't have too many snow days so that graduation wouldn't run into Battlecry? - ScoutingNerd175 [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 23-01-2008, 13:14
bsbllpss's Avatar
bsbllpss bsbllpss is offline
[RockStar]
AKA: RJ
FRC #2044 (Big Red Robotics)
Team Role: Electrical
 
Join Date: Jan 2007
Rookie Year: 2007
Location: La Vista, NE
Posts: 14
bsbllpss is an unknown quantity at this point
Send a message via AIM to bsbllpss
steering wheel help FIRST Team 2044

I need help. I'm trying to take a steering wheel (w/o the pedals) and using a chicklet. I want the steering wheel to turn the robot 180 degrees left when the wheel is turned 180 degrees left. So for the right side. But not more than 180 degrees in any direction. The robot is a three-wheel design with two wheels being powered. I want the wheel to turn the robot in a tank form one wheel going one direction and the other going the other direction. Also I want to have a separate joystick next to the wheel to use only with the y-axis and control the forward and backward speed of the robot. I'm sorry if this may seem confusing but any insight on how to fix the problem will be greatly appreciated.
  #2   Spotlight this post!  
Unread 23-01-2008, 13:46
TubaMorg TubaMorg is offline
Programmermechanicalelect ricalcoach
AKA: Dan
FRC #1480 (Robatos Locos)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Houston
Posts: 450
TubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond repute
Re: steering wheel help FIRST Team 2044

There are a number of ways to work this. Here is one solution:

1. Install a gyro to give you heading.
2. Does your wheel really turn 180 degrees? No matter, moving it from neutral to full right or left will give you a value of 127 to 254, or 127 to 0. so you need to convert from the PWM value to degrees which will give a ratio of 127/180.
3. Now that your program knows what heading the steering wheel wants, put in a simple proportional control to turn to that heading (pseudo code):
error = (currentHeading - wheelHeading);
drive (RightSide-error/2, LeftSide+error/2);

As a first approximation this should work, but probably not very well. You wil have to fiddle with it and acount for gyro drift etc. to get it working well.
  #3   Spotlight this post!  
Unread 23-01-2008, 14:13
Steve_Alaniz Steve_Alaniz is offline
Registered User
FRC #2848 (All Sparks)
Team Role: Mentor
 
Join Date: Mar 2007
Rookie Year: 1997
Location: Dallas
Posts: 211
Steve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond reputeSteve_Alaniz has a reputation beyond repute
Re: steering wheel help FIRST Team 2044

Actually, your post IS a bit confusing, but starting with the last question first, Speed as in forward or backwards is simply a function of the p1y axis on port 1. a joystick plugged into port 1 will automatically take on this role when using the default code and PWM13 - 16. ( this sounds a lot like a throttle BTW)
The trick comes with the wheel part. A car wheel turns the car as long as it is turned and in a rate proportional to the amount of turn. If that's all you want, again, it's done with the default code. but if you want the wheel controlling the X direction and Y the joystick controlling the Y (forward/backward/speed) you need to have the User_routine.c remap the values you want here:
Code:
/*---------- 1 Joystick Drive ----------------------------------------------
  *--------------------------------------------------------------------------
  *  This code mixes the Y and X axis on Port 1 to allow one joystick drive. 
  *  Joystick forward  = Robot forward
  *  Joystick backward = Robot backward
  *  Joystick right    = Robot rotates right
  *  Joystick left     = Robot rotates left
  *  Connect the right drive motors to PWM13 and/or PWM14 on the RC.
  *  Connect the left  drive motors to PWM15 and/or PWM16 on the RC.
  */  
  p1_x = 255 - p1_y;
  p1_y = 255 - pwm05;

  pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127);
  pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127);
Where it says:
p1_x = 255 - p1_y;
p1_y = 255 - pwm05;



since:

Code:
  *   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;

If you plug the joystick in port1 and the wheel in port 2 then something like:

p1_x = 255 - p1_y;
p1_y = 255 - pwm06;

not sure this is what you're asking but hope it at least helps.

Steve
  #4   Spotlight this post!  
Unread 23-01-2008, 16:13
garyk garyk is offline
Programming Mentor: 668, 972, 2643
FRC #0668 (Apes of Wrath)
Team Role: Mentor
 
Join Date: Dec 2006
Rookie Year: 2005
Location: Santa Clara (Silicon Valley) Calif.
Posts: 93
garyk is a jewel in the roughgaryk is a jewel in the roughgaryk is a jewel in the roughgaryk is a jewel in the rough
Re: steering wheel help FIRST Team 2044

668 has used a couple of steering wheels, and neither returned the full 0-255 range, we had to scale the output accordingly. To see what your steering wheel returns, add this to your code:


Code:
static int debug0_count=0;


// print every ~25 loops to avoid drowning in output. Adjust the constant
// for whatever rate you want:

if (debug0_count++ >= 25)
{ printf("JS1 parms: %3d %3d %3d %3d %d %d %d %d\n",
       (int)p1_x,
       (int)p1_y,
       (int)p1_wheel,
       (int)p1_aux,
       (int)p1_sw_trig,
       (int)p1_sw_top,
       (int)p1_sw_aux1,
       (int)p1_sw_aux2);

  debug0_count=0;
}
This code fragment prints every parm you can get from a joystick port. Of course, if you don't have the wheel plugged into Port 1, change "p1_" accordingly.

You can find all the joystick parms listed in the file ifi_aliases.h.
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
steering wheel ??????? leobot_792 Programming 10 22-01-2008 13:01
Steering wheel radicalnerd Technical Discussion 30 31-05-2007 00:56
pic: Chantilly Academy's 4 Wheel Drive 4 Wheel Steering!!!! jskene Robot Showcase 25 18-02-2005 20:24
Steering wheel issues jgannon Programming 5 15-12-2004 10:14
need glp programing steering with a steering wheel Matchew Programming 2 10-02-2003 14:20


All times are GMT -5. The time now is 23:12.

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