Go to Post Silly FIRST mentor -- actually spending brain power caring about a sporting event occuring during build season! - Aidan F. Browne [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 31-01-2011, 19:41
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
Make motors run the same speed using encoders

does anyone have any ideas on how to use encoders to make the motors run at the same speed when going straight? I'm currently working on a code to make the robot go the same direction as you press the joystick no matter which way it is facing and this seems to be the biggest problem since the robot will drift left or right. I'm having a hard time with this since the motors shouldn't be running at the exact same speed when pressing slightly left or right.

(We will be using arcade drive)

Any help would be appreciated
Robot Casserole - Team 1736

Last edited by siggy2xc : 31-01-2011 at 19:48.
Reply With Quote
  #2   Spotlight this post!  
Unread 02-02-2011, 12:55
IisMathwizard's Avatar
IisMathwizard IisMathwizard is offline
Programming Mentor
AKA: Mathwizard
FRC #1248 (Titanium Allies)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2009
Location: Berea-Midpark High school
Posts: 60
IisMathwizard is an unknown quantity at this point
Re: Make motors run the same speed using encoders

Im sorry but i don't think i understand your question well enough. From what i got it sounds like your having problems with making the robot go straight even if the joystick is tilted in an off direction. If this is your problem then you can make a case structure hook up to the button your going to use to initiate this coding (im assuming a button) and in the true wire the x axis input on arcade drive (yet again more assumtions) to a 0 constant in the case structure and for false have the x axis output go through the case structure to the x axis input. It MUST go through the case structure.
in boolean algebra it would look something like this:
a = button;
Xinput = axis input;
Xoutput = plugged into the arcade drive;
Name:  equation.bmp
Views: 273
Size:  58.7 KB
__________________

jRIO 2013 Project
Reply With Quote
  #3   Spotlight this post!  
Unread 02-02-2011, 14:22
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,355
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: Make motors run the same speed using encoders

Quote:
Originally Posted by siggy2xc View Post
does anyone have any ideas on how to use encoders to make the motors run at the same speed when going straight? I'm currently working on a code to make the robot go the same direction as you press the joystick no matter which way it is facing and this seems to be the biggest problem since the robot will drift left or right. I'm having a hard time with this since the motors shouldn't be running at the exact same speed when pressing slightly left or right.

(We will be using arcade drive)

Any help would be appreciated
Robot Casserole - Team 1736
If I understand what you are asking, you want to have the robot drive straight when a button is pressed, regardless of which direction the robot is facing. Is this correct?

Now, assuming it is correct....

According to your title, you have encoders connected to you drive train. Again assuming here, one on the left and one on the right.

Start with a case structure. Wire the Y channel bypass the structure. In the False state, the X will pass through the structure to the Arcade mode. When the "button" is pressed, switch the case structure. In the True state, the X channel will be replaced inside the case structure.

Here is where it gets a little complicated.

The first time through the loop after the button is pressed, initialize the counter for both encoders. From that point on, as long as the button remains pressed, the X value to the Arcade mode becomes the difference between the counts of the left and right encoders. You will need to "GAIN" this value to maintain smooth and not over responsive control. You will also need to limit the output to the Arcade mode to between -1 and +1. You might also need to invert the sign so that the code corrects in the right direction.

The bottom line is, the correction to direction is based on the difference between the counts of the encoders.
__________________
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

Last edited by billbo911 : 02-02-2011 at 15:12.
Reply With Quote
  #4   Spotlight this post!  
Unread 02-02-2011, 15:25
IisMathwizard's Avatar
IisMathwizard IisMathwizard is offline
Programming Mentor
AKA: Mathwizard
FRC #1248 (Titanium Allies)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2009
Location: Berea-Midpark High school
Posts: 60
IisMathwizard is an unknown quantity at this point
Re: Make motors run the same speed using encoders

Forget my idea, use Billbo's
I like the fact that it corrects itself
__________________

jRIO 2013 Project
Reply With Quote
  #5   Spotlight this post!  
Unread 02-02-2011, 16:04
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,065
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Make motors run the same speed using encoders

Quote:
Originally Posted by siggy2xc View Post
does anyone have any ideas on how to use encoders to make the motors run at the same speed when going straight? I'm currently working on a code to make the robot go the same direction as you press the joystick no matter which way it is facing and this seems to be the biggest problem since the robot will drift left or right. I'm having a hard time with this since the motors shouldn't be running at the exact same speed when pressing slightly left or right.

(We will be using arcade drive)

Any help would be appreciated
Robot Casserole - Team 1736
The approach discussed here uses a gyro instead of encoders. It might give you some additional ideas.



Reply With Quote
  #6   Spotlight this post!  
Unread 02-02-2011, 16:08
IisMathwizard's Avatar
IisMathwizard IisMathwizard is offline
Programming Mentor
AKA: Mathwizard
FRC #1248 (Titanium Allies)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2009
Location: Berea-Midpark High school
Posts: 60
IisMathwizard is an unknown quantity at this point
Re: Make motors run the same speed using encoders

ohhh... so you can use the change in x value in the gyro and make a simple algorithym that takes x value and creates a new x-value for the robot that would more than compensate for the new change in x-value from the gyro.
__________________

jRIO 2013 Project
Reply With Quote
  #7   Spotlight this post!  
Unread 14-02-2011, 14:56
mnwcsult's Avatar
mnwcsult mnwcsult is offline
Registered User
FRC #3558 (FBRbotz)
Team Role: Mentor
 
Join Date: Feb 2009
Rookie Year: 2008
Location: Bowie, MD
Posts: 2
mnwcsult is an unknown quantity at this point
Re: Make motors run the same speed using encoders

Billbo could you post a screen shot of the labview "code"?

I like your solution over mine however I don't quite have feel of coding in Labview to get this done quickly.

TIA


Quote:
Originally Posted by billbo911 View Post
If I understand what you are asking, you want to have the robot drive straight when a button is pressed, regardless of which direction the robot is facing. Is this correct?

Now, assuming it is correct....

According to your title, you have encoders connected to you drive train. Again assuming here, one on the left and one on the right.

Start with a case structure. Wire the Y channel bypass the structure. In the False state, the X will pass through the structure to the Arcade mode. When the "button" is pressed, switch the case structure. In the True state, the X channel will be replaced inside the case structure.

Here is where it gets a little complicated.

The first time through the loop after the button is pressed, initialize the counter for both encoders. From that point on, as long as the button remains pressed, the X value to the Arcade mode becomes the difference between the counts of the left and right encoders. You will need to "GAIN" this value to maintain smooth and not over responsive control. You will also need to limit the output to the Arcade mode to between -1 and +1. You might also need to invert the sign so that the code corrects in the right direction.

The bottom line is, the correction to direction is based on the difference between the counts of the encoders.
Reply With Quote
  #8   Spotlight this post!  
Unread 15-02-2011, 12:30
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,355
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: Make motors run the same speed using encoders

Quote:
Originally Posted by mnwcsult View Post
Billbo could you post a screen shot of the labview "code"?

I like your solution over mine however I don't quite have feel of coding in Labview to get this done quickly.

TIA
TIA,
WELCOME TO Chiefdelphi!
I would love nothing more than to help you out with this, but I have a problem.

This year I made a commitment to allow my team to do ALL of their own coding, without actually creating any myself. I help, advise, instruct but I don't actually code, no matter how tempted I may get. As part of this commitment, I have decided to not install LabView on any PC I have access to. It would be too much of a temptation for me.

So, without access to Labview, I can't show you how I would do it.
Hopefully someone else here on CD can help you out with your request. It really is quite simple and "should" only take a few minutes to create. Tuning the gain for straight driving might take 10 to 15 minutes, with lots of laughter as you see your robot swing wildly in odd directions until the gain is low enough. I would suggest a starting value of approximately .002. (Remember, with even a error of 1 bit difference, you would be giving a full range X value, therefore, the gain must be very low to get you close.)
__________________
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
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 10:14.

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