Go to Post Magic doesn't count as a support, sorry. Neither does simply constraining in CAD... - EricH [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
  #16   Spotlight this post!  
Unread 02-02-2013, 16:09
bvisness's Avatar
bvisness bvisness is offline
Programming Mentor, Former Driver
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Woodbury, MN
Posts: 181
bvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of light
Re: Move Robot a set angle

I'd recommend the gyro as well. We found the provided gyro sensors to be very responsive and accurate. Easy to program too!

Using a gyro, it would be pretty easy to set up a PID loop like in the attached image.
Attached Thumbnails
Click image for larger version

Name:	Capture.PNG
Views:	70
Size:	10.0 KB
ID:	13770  
  #17   Spotlight this post!  
Unread 02-02-2013, 18:05
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,097
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: Move Robot a set angle

Quote:
Originally Posted by bvisness View Post
Using a gyro, it would be pretty easy to set up a PID loop like in the attached image.
Unless the 2013 LabVIEW PID now has support for "continuous" process variables (2011 didn't), your diagram won't work.


  #18   Spotlight this post!  
Unread 02-02-2013, 18:11
bvisness's Avatar
bvisness bvisness is offline
Programming Mentor, Former Driver
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Woodbury, MN
Posts: 181
bvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of light
Re: Move Robot a set angle

What do you mean by "continuous" process variables? This should get the current gyro heading every time the loop runs and compare that to the setpoint. (And this is just a 2-minute example anyhow...)
  #19   Spotlight this post!  
Unread 02-02-2013, 18:16
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,097
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: Move Robot a set angle

Quote:
Originally Posted by bvisness View Post
What do you mean by "continuous" process variables? This should get the current gyro heading every time the loop runs and compare that to the setpoint. (And this is just a 2-minute example anyhow...)
What do you think that PID in your diagram will do if the gyro is reading 359 degrees and your driver is commanding zero degrees ?


  #20   Spotlight this post!  
Unread 02-02-2013, 18:22
bvisness's Avatar
bvisness bvisness is offline
Programming Mentor, Former Driver
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Woodbury, MN
Posts: 181
bvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of light
Re: Move Robot a set angle

Ah, I see what you mean. I didn't say this was a perfect example, I just wanted to quickly demonstrate how one could zero in on an angle using a gyro and PID.
  #21   Spotlight this post!  
Unread 02-02-2013, 18:24
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,097
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: Move Robot a set angle

Quote:
Originally Posted by bvisness View Post
Ah, I see what you mean. I didn't say this was a perfect example, I just wanted to quickly demonstrate how one could zero in on an angle using a gyro and PID.
If you had to make this work, how would you go about fixing this problem?


  #22   Spotlight this post!  
Unread 02-02-2013, 18:32
bvisness's Avatar
bvisness bvisness is offline
Programming Mentor, Former Driver
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Woodbury, MN
Posts: 181
bvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of light
Re: Move Robot a set angle

Quote:
Originally Posted by Ether View Post
If you had to make this work, how would you go about fixing this problem?


Well, for the thread-starter's situation, I would initialize the setpoint as current heading + desired change. Then it wouldn't matter if the variable was continuous or not. (Assuming I'm remembering correctly that the gyro heading does not reset to 0 when it makes a full rotation.)

On the other hand, if I wanted to turn the robot to an absolute heading, I would probably...you know what, I'm not sure. All my ideas thus far would eliminate the problem of whirling in circles when going from, say, 2520 degrees to 45. But all my ideas would not fix the problem of going from 359 to 0.
  #23   Spotlight this post!  
Unread 02-02-2013, 19:05
thephpdev's Avatar
thephpdev thephpdev is offline
Registered User
AKA: Josh Larson
FRC #2502 (Talon Robotics)
Team Role: Programmer
 
Join Date: Mar 2012
Rookie Year: 2012
Location: Eden Prairie, MN
Posts: 16
thephpdev is an unknown quantity at this point
Re: Move Robot a set angle

You could use a PID loop with the x-offset in pixels as the input of the image, and have the output move the wheels.
  #24   Spotlight this post!  
Unread 02-02-2013, 19:26
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,097
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: Move Robot a set angle

Quote:
Originally Posted by thephpdev View Post
You could use a PID loop with the x-offset in pixels as the input of the image, and have the output move the wheels.
How fast can your vision processing compute that image pixel offset ?


  #25   Spotlight this post!  
Unread 03-02-2013, 09:53
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,752
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Move Robot a set angle

Quote:
On the other hand, if I wanted to turn the robot to an absolute heading, I would probably...you know what, I'm not sure. All my ideas thus far would eliminate the problem of whirling in circles when going from, say, 2520 degrees to 45. But all my ideas would not fix the problem of going from 359 to 0.
Circular coordinate systems have many values that encode the same angle.
Mod or Quotient and Remainder will collapse them into those represented in a single circle. As you noted, there are still two useful solutions to your 359 move to 0. You can move 359 degrees one direction or 1 degree the other.

You usually want to select the movement with the smaller absolute value. So you need mod, and you need to consider both the positive movement and negative movement. For crab systems or turrets, there is usually a further restriction that may invalidate one of the solutions -- cables only stretch and twist by so much.

I'd highly recommend you develop your input filter as a separate VI and test it for the full range of values it is to deal with. Often it is useful to plot the output versus input and sweep across the range of values at some resolution.

Greg McKaskle
  #26   Spotlight this post!  
Unread 03-02-2013, 16:31
bvisness's Avatar
bvisness bvisness is offline
Programming Mentor, Former Driver
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Woodbury, MN
Posts: 181
bvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of light
Re: Move Robot a set angle

Thanks for the advice! Granted, I'm not the one who started the thread, but I hope the info is useful to people who are attempting to do this.
  #27   Spotlight this post!  
Unread 03-02-2013, 18:16
bvisness's Avatar
bvisness bvisness is offline
Programming Mentor, Former Driver
FRC #2175 (The Fighting Calculators)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Woodbury, MN
Posts: 181
bvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of lightbvisness is a glorious beacon of light
Re: Move Robot a set angle

Well, compwiztobe saves the day again with this awesome VI. I worked with him to get this written up; it takes a "continuous" gyro input and computes the appropriate setpoint to use in a PID loop. I've attached the VI and an example image.
Attached Thumbnails
Click image for larger version

Name:	Capture.PNG
Views:	55
Size:	9.2 KB
ID:	13778  
Attached Files
File Type: vi Get Gyro Setpoint.vi (21.1 KB, 13 views)
  #28   Spotlight this post!  
Unread 03-02-2013, 23:33
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,097
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: Move Robot a set angle

Quote:
Originally Posted by bvisness View Post
Well, compwiztobe saves the day again with this awesome VI. I worked with him to get this written up; it takes a "continuous" gyro input and computes the appropriate setpoint to use in a PID loop. I've attached the VI and an example image.
Please post a PNG or GIF screenshot of the vi, for those of us who don't have LabVIEW installed (yet). Thanks.


  #29   Spotlight this post!  
Unread 03-02-2013, 23:41
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Move Robot a set angle

To add to Ether's recommendation.

I was teaching how to use encoders and applying geometry and trigonometry. One of the tasks I had them figure out is to make the robot turn a certain angle using left and right encoders.

They were successful, but due to the slip-n-slide nature of your drive train, it really is by chance (aka lottery and moon phase). It was within about 10˚ of where it should have been.

Of course, a better solution (as also mentioned) would be to use the included gyro. It's easy to wire (have a spare PWM Cable?), easy to program (They have an example on how to use it), and easy to use (output is already in degrees).
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
  #30   Spotlight this post!  
Unread 04-02-2013, 05:38
sloteera's Avatar
sloteera sloteera is offline
Registered User
AKA: Rafa
FRC #1860 (Cephatron)
Team Role: Coach
 
Join Date: Mar 2007
Rookie Year: 2004
Location: Brazil
Posts: 190
sloteera has much to be proud ofsloteera has much to be proud ofsloteera has much to be proud ofsloteera has much to be proud ofsloteera has much to be proud ofsloteera has much to be proud ofsloteera has much to be proud ofsloteera has much to be proud ofsloteera has much to be proud ofsloteera has much to be proud of
Re: Move Robot a set angle

Quote:
Originally Posted by Ether View Post
It's a skid-steer vehicle, so it depends on the phase of the moon and yesterday's lottery numbers.

But seriously, you could use a gyro (as the previous poster suggested), or you could do some simple experiments and measure how much vehicle rotation you get vs how much the wheels turned. Do that under various conditions (like turning speed) and either fit a model to the data or prepare a lookup table. Make sure you use the same carpet as competition when running these tests, and with the competition weight.


You right Ether, I need to agree with you.
I've got little confused before. Now I understood why what I proposed wouldn't work.

Sorry.
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


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

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