Go to Post Please drill responsibly! - IKE [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #31   Spotlight this post!  
Unread 24-01-2013, 14:10
nathannfm's Avatar
nathannfm nathannfm is offline
Registered User
AKA: Nathan
FRC #3940
Team Role: Mentor
 
Join Date: Jun 2010
Rookie Year: 2005
Location: Kokomo, IN
Posts: 331
nathannfm has a brilliant futurenathannfm has a brilliant futurenathannfm has a brilliant futurenathannfm has a brilliant futurenathannfm has a brilliant futurenathannfm has a brilliant futurenathannfm has a brilliant futurenathannfm has a brilliant futurenathannfm has a brilliant futurenathannfm has a brilliant futurenathannfm has a brilliant future
Re: Disc Lauching Velocity

Quote:
Originally Posted by Orion.DeYoe View Post
You'll never get 53,000 RPM (free load speed of a CIM) out of a CIM attached to anything.
Ummmm...

*5,300 RPM
__________________

[2016-20??]: Mentor: FRC Team 3940"CyberTooth"
[2013-2016]: Mentor: FRC Team 365 "MOE"
[2012-2013]: Mentor: FRC Team 3929 "Atomic Dragons"
[2011-2012]: Mentor: FRC Team 365 "MOE"
[2008-2011]: Student: FRC Team 365 "MOE"
[2007-2008]: Student: FTC Team 365 "MOE"
[2005-2007]: Student: FLL Team "The MOEstangs"
Reply With Quote
  #32   Spotlight this post!  
Unread 24-01-2013, 14:28
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,098
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: Disc Lauching Velocity

Quote:
Originally Posted by billbo911 View Post
...
Thanks for the detailed answer.

I was wondering if you could achieve a similar result using only one sensor instead of two by interrupting on both rising and falling edges of that sensor (using the diameter of the frisbee as the distance).


Reply With Quote
  #33   Spotlight this post!  
Unread 24-01-2013, 14:33
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,368
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: Disc Lauching Velocity

Quote:
Originally Posted by Ether View Post
Thanks for the detailed answer.

I was wondering if you could achieve a similar result using only one sensor instead of two by setting up one pin to interrupt on both rising and falling edges. Or doesn't the hardware support that?


I'm sure it is possible, here is a quote from the Arduino Interrupt Reference page.

Quote:

attachInterrupt(interrupt, function, mode)....

...
mode
:
defines when the interrupt should be triggered. Four constants are predefined as valid values:

LOW to trigger the interrupt whenever the pin is low,
CHANGE to trigger the interrupt whenever the pin changes value
RISING to trigger when the pin goes from low to high,
FALLING for when the pin goes from high to low.
The Due board allows also:
HIGH to trigger the interrupt whenever the pin is high.
(Arduino Due only)
You would have to craft the ISR carefully, but it should be possible using the CHANGE mode. My only concern is that the second interrupt would occur before the processing of the first interrupt had completed.
Although, given the timing measurements we are seeing for this year's challenge, that should not be too much of an issue.
__________________
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
  #34   Spotlight this post!  
Unread 24-01-2013, 14:36
Orion.DeYoe Orion.DeYoe is offline
Registered User
FRC #5413 (Stellar Robotics)
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2011
Location: North Fairfield, OH
Posts: 206
Orion.DeYoe is a splendid one to beholdOrion.DeYoe is a splendid one to beholdOrion.DeYoe is a splendid one to beholdOrion.DeYoe is a splendid one to beholdOrion.DeYoe is a splendid one to beholdOrion.DeYoe is a splendid one to beholdOrion.DeYoe is a splendid one to beholdOrion.DeYoe is a splendid one to behold
Re: Disc Lauching Velocity

Quote:
Originally Posted by nathannfm View Post
Ummmm...

*5,300 RPM
Lol yes, if you look I have corrected the post. That was a typo (a pretty major one I might add).
Reply With Quote
  #35   Spotlight this post!  
Unread 24-01-2013, 14:55
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,098
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: Disc Lauching Velocity

Quote:
Originally Posted by billbo911 View Post
My only concern is that the second interrupt would occur before the processing of the first interrupt had completed
If your two sensors are only 12" apart, you'd have the same concern, since that distance is roughly the same as the single-sensor approach (wherein the distance is the diameter of the frisbee).

So as you said, since the frisbee speed is plenty slow, it's not a concern.

The reason I brought this up is, using the single-sensor approach it might be easier to set up to measure the speed of the frisbee as it is passing thru the shooter at various locations. This might produce some very revealing data about slippage.


Reply With Quote
  #36   Spotlight this post!  
Unread 24-01-2013, 15:12
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,368
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: Disc Lauching Velocity

Quote:
Originally Posted by Ether View Post
...
The reason I brought this up is, using the single-sensor approach it might be easier to set up to measure the speed of the frisbee as it is passing thru the shooter at various locations. This might produce some very revealing data about slippage.


Excellent idea!!
I'm not certain it would give any useful information that the off board Chronograph couldn't supply, but it would always be present and available for measurement. Real time feedback during a shot may not be possible, but by no means impossible.

We plan on using our free standing unit to profile our system. We will also make it available at the Sacramento Regional to any team that would like to test with it.

Now, you have piqued interest. I just HAVE to write the code for a single sensor Chronograph!!
Stay tuned for code.
__________________
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
  #37   Spotlight this post!  
Unread 24-01-2013, 15:45
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,368
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: Disc Lauching Velocity

Quote:
Originally Posted by billbo911 View Post
[size="4"]...

Now, you have piqued interest. I just HAVE to write the code for a single sensor Chronograph!!
Stay tuned for code.
As promised...
This "should" work for a single sensor It is untested, but based off a working two sensor version. I left the original code in place but commented out.
BTW. it is already set up to print it's data to an I2C connected LCD. Modifying it to send data to the cRio would be quite simple.

Code:
/*******************************************************************************************
* This Sketch is for a Chronograph that uses the "micros" function to capture two points in*
* time and determines how much time has elapsed between them in microseconds. By knowing   *
* the distance between the to sensors, the velocity of the object can be determined.       *
* Bill Kendall, Jan. 15, 2013                                                              *
* I2C LCD Display function added 01/18/13                                                  *
* Modified for single sensor 01/24/13                                                      *
*******************************************************************************************/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,20,4); //Create object "lcd" at address 0x30, 20 X 4 display

//float SENSOR_DIST = 12;  //This value is the distance between the sensors in inches
float DISK_DIAMETER = 11.0;  // Diameter of Frisbee in inches.
float distance;
unsigned long event1 = 0; // value in 'micros" at the time of this first trigger
unsigned long event2 = 0; // value in 'micros" at the time of this second trigger
int firstint = 0;  //Set to 1 if Interrupt 0 has occurred
int calculate = 0;  // If set to 1, a calculation and display of the velocity will occur
unsigned long duration = 0; // Amount of elapsed time between events
float velocity = 0;
int sample = 0;
int flasher = 13; //LED attached to pin 13

void setup (void)
{
attachInterrupt (0, ISR0, CHANGE);  // Interupt 0 (pin 2) calls "ISR0" Thie is the first trigger
//attachInterrupt (1, ISR1, RISING);  // Interupt 1 (pin 3) calls "ISR1" This is the second trigger
//distance = (SENSOR_DIST/12.0); // Convert sensor spacing to feet
distance = (DISK_DIAMETER/12.0); // Convert disk diameter to feet

pinMode(flasher, OUTPUT);
Serial.begin(115200); // connect to the serial port

lcd.init();                      // initialize the lcd 

  // Print our characters on the LCD
  lcd.backlight();  //Backlight ON if under program control
  lcd.setCursor(3,1); //Start at character 3 on line 1
  lcd.print("2073 Cronograph");
  delay(2000);
  lcd.clear();
  //lcd.setCursor(2,1);
  //lcd.print("From YourDuino");
  //delay(1000);  
  lcd.setCursor(8,0);
  lcd.print("2013");
  lcd.setCursor(3,1);
  lcd.print("Ultimate Ascent");
  lcd.setCursor(2,3);
  delay(1000);   
  lcd.print("PGHSRobotics.com");


}

void ISR0 (void)
{
  if (firstint == 0)
  {
  event1 = micros(); // record the microseconds counter
  firstint = 1;
  }
  else
  {
  event2 = micros(); // record the microseconds counter
  firstint = 0;   // reset firstint
  calculate = 1;
  }
}


/*void ISR0 (void)
{
  event1 = micros(); // record the microseconds counter
  firstint = 1;
}


void ISR1 (void)
{
  event2 = micros(); // record the microseconds counter
  calculate = 1;
}*/


void loop (void)
{
  if (calculate == 1)
  {
    RunMath ();    
  }
  delay (500);
}

void RunMath (void)
{
  digitalWrite(flasher, HIGH);
  delay(250);
  digitalWrite(flasher, LOW);
  duration = (event2 - event1); // elapsed time between triggers in u seconds
  velocity = (((distance)*1000000)/(duration));  // Calculate velocity in feet per second
 sample ++;
  lcd.clear();
  lcd.setCursor(1,0);
  lcd.print("Frisbee velocity is");
  lcd.setCursor(3,1);
  lcd.print (velocity,2);
  lcd.print(" ft./sec.");
  lcd.setCursor(9,3);
  lcd.print("Sample #");
  lcd.print(sample);  // Prints # of samples since reset
 /* Serial.print("The Frisbee is moving at ");
  Serial.print (velocity,2);
  Serial.println(" ft./sec.");*/
  calculate = 0;
  firstint = 0;
 }
__________________
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
  #38   Spotlight this post!  
Unread 30-01-2013, 16:45
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,368
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: Disc Lauching Velocity

Quote:
Originally Posted by billbo911 View Post
As promised...
This "should" work for a single sensor It is untested, but based off a working two sensor version. I left the original code in place but commented out.
BTW. it is already set up to print it's data to an I2C connected LCD. Modifying it to send data to the cRio would be quite simple.

Code:
/*******************************************************************************************
* This Sketch is for a Chronograph that uses the "micros" function to capture two points in*
* time and determines how much time has elapsed between them in microseconds. By knowing   *
* the distance between the to sensors, the velocity of the object can be determined.       *
* Bill Kendall, Jan. 15, 2013                                                              *
* I2C LCD Display function added 01/18/13                                                  *
* Modified for single sensor 01/24/13                                                      *
*******************************************************************************************/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,20,4); //Create object "lcd" at address 0x30, 20 X 4 display

//float SENSOR_DIST = 12;  //This value is the distance between the sensors in inches
float DISK_DIAMETER = 11.0;  // Diameter of Frisbee in inches.
float distance;
unsigned long event1 = 0; // value in 'micros" at the time of this first trigger
unsigned long event2 = 0; // value in 'micros" at the time of this second trigger
int firstint = 0;  //Set to 1 if Interrupt 0 has occurred
int calculate = 0;  // If set to 1, a calculation and display of the velocity will occur
unsigned long duration = 0; // Amount of elapsed time between events
float velocity = 0;
int sample = 0;
int flasher = 13; //LED attached to pin 13

void setup (void)
{
attachInterrupt (0, ISR0, CHANGE);  // Interupt 0 (pin 2) calls "ISR0" Thie is the first trigger
//attachInterrupt (1, ISR1, RISING);  // Interupt 1 (pin 3) calls "ISR1" This is the second trigger
//distance = (SENSOR_DIST/12.0); // Convert sensor spacing to feet
distance = (DISK_DIAMETER/12.0); // Convert disk diameter to feet

pinMode(flasher, OUTPUT);
Serial.begin(115200); // connect to the serial port

lcd.init();                      // initialize the lcd 

  // Print our characters on the LCD
  lcd.backlight();  //Backlight ON if under program control
  lcd.setCursor(3,1); //Start at character 3 on line 1
  lcd.print("2073 Cronograph");
  delay(2000);
  lcd.clear();
  //lcd.setCursor(2,1);
  //lcd.print("From YourDuino");
  //delay(1000);  
  lcd.setCursor(8,0);
  lcd.print("2013");
  lcd.setCursor(3,1);
  lcd.print("Ultimate Ascent");
  lcd.setCursor(2,3);
  delay(1000);   
  lcd.print("PGHSRobotics.com");


}

void ISR0 (void)
{
  if (firstint == 0)
  {
  event1 = micros(); // record the microseconds counter
  firstint = 1;
  }
  else
  {
  event2 = micros(); // record the microseconds counter
  firstint = 0;   // reset firstint
  calculate = 1;
  }
}


/*void ISR0 (void)
{
  event1 = micros(); // record the microseconds counter
  firstint = 1;
}


void ISR1 (void)
{
  event2 = micros(); // record the microseconds counter
  calculate = 1;
}*/


void loop (void)
{
  if (calculate == 1)
  {
    RunMath ();    
  }
  delay (500);
}

void RunMath (void)
{
  digitalWrite(flasher, HIGH);
  delay(250);
  digitalWrite(flasher, LOW);
  duration = (event2 - event1); // elapsed time between triggers in u seconds
  velocity = (((distance)*1000000)/(duration));  // Calculate velocity in feet per second
 sample ++;
  lcd.clear();
  lcd.setCursor(1,0);
  lcd.print("Frisbee velocity is");
  lcd.setCursor(3,1);
  lcd.print (velocity,2);
  lcd.print(" ft./sec.");
  lcd.setCursor(9,3);
  lcd.print("Sample #");
  lcd.print(sample);  // Prints # of samples since reset
 /* Serial.print("The Frisbee is moving at ");
  Serial.print (velocity,2);
  Serial.println(" ft./sec.");*/
  calculate = 0;
  firstint = 0;
 }
I have verified the above code works quite well as long as the sensor is aligned with the center of the Frisbee as it passes by.

If this alignment is not possible, or convenient, a simple modification to "DISK_DIAMETER" is required. Just enter the chord length of the Frisbee where the sample will be taken. Two digit precision is all that is needed.
__________________
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
  #39   Spotlight this post!  
Unread 30-01-2013, 17:00
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,098
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: Disc Lauching Velocity

Quote:
Originally Posted by billbo911 View Post
I have verified the above code works quite well
Very cool! Thanks for posting that update

You've inspired me. For teams on a really tight budget that can't afford an Arduino, I wrote a small app that will run on any Pentium-based laptop or PC1 with a parallel port. It uses that port's status pins2 to get the elapsed time between rising and falling edges of a single sensor, or between the rising edges of two separate sensors, with +/- 2 μs accuracy.

If there's enough interest3, I'll clean it up and post a white paper.

1especially on the old junker ones with 133MHz Pentium
2these are pulled up to +3.3 volts on most parallel ports and need only be grounded to generate a signal.
3PM me if you'd be interested.


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 20:44.

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