Go to Post "He who seeks originality will often find novelty, but not great design." - IKE [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
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 18-03-2011, 21:40
siggy2xc siggy2xc is offline
Registered User
AKA: Tyler Siegrist
FRC #1756 (Argos)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2009
Location: peoria
Posts: 70
siggy2xc is an unknown quantity at this point
Perfect driving using encoders?

What would be the best way to make your robot drive perfectly straight using encoders while still being able to drive it with a joystick?
Reply With Quote
  #2   Spotlight this post!  
Unread 18-03-2011, 22:17
Jimmy the Kidd's Avatar
Jimmy the Kidd Jimmy the Kidd is offline
Programmer, Scouter, Tactician, etc
FRC #0364 (Team Fusion)
Team Role: Tactician
 
Join Date: May 2010
Rookie Year: 2010
Location: Gulfport MS
Posts: 71
Jimmy the Kidd is an unknown quantity at this point
Re: Perfect driving using encoders?

By encoders, are you referring to encoders on, say, Supershifters? You could set a gain running on the encoder voltage, use the joystick value, and somehow compare the two, possibly using a coerce, to keep it within a certain range.
__________________

The GDC needs to write the rules once and let the game be what the game is going to be. There's little that's fun about being told exactly how to play with your toys. - Madison
Reply With Quote
  #3   Spotlight this post!  
Unread 19-03-2011, 01:13
biojae's Avatar
biojae biojae is offline
Likes Omni drives :)
AKA: Justin Stocking
FTC #5011 (BOT SQUAD) && FTC#72(Garage bots)&& FRC#0399 (Eagle Robotics)
Team Role: College Student
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Lancaster
Posts: 276
biojae is a jewel in the roughbiojae is a jewel in the roughbiojae is a jewel in the rough
Re: Perfect driving using encoders?

You could interpret the joystick as a velocity command (rate).

If you are using one joystick (arcade) your code could look something like this:
(Sorry, I don't have labview on my computer)
Code:
double driveCmd = Joystick1.getY(); // Convert the Y axis value into a velocity relative to the robot's maximum speed 
double turnCmd  = Joystick1.getX() * MaxTurnRate; //Convert the X axis value into a turning velocity relative to the robot's maximum rotation speed

double turnRate = (leftEncoder.getRate() - rightEncoder.getRate()) / robotWidth; // Based on Kinematics of a differential (tank) driven vehicle
double turn = P * (turnCmd - turnRate); //Proportional control; Expand to PID if needed

RobotDrive.arcadeDrive(driveCmd, turn);
The only change needed for driving it with 2 joysticks (tank drive) is:
Code:
double driveCmd = (Joystick1.getY() + Joystick2.getY()) / 2.0; // Average the 2 sticks to get an overall Speed for the robot to drive  
double turnCmd  = ((Joystick1.getY() - Joystick2.getY()) / 2.0) * MaxTurnRate; // Convert the difference of the 2 sticks to get a turn velocity command
__________________
FTC Team 72 - No site
FRC Team 399 - http://www.team399.org
2010 Rockwell Collins Innovation in Control Award - (Use of the CAN bus, among other reasons) Phoenix, Arizona!
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


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

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