Go to Post FIRST isn't for wimps. It never has been. - JaneYoung [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 Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 23-01-2015, 22:04
Joshua Sicz Joshua Sicz is offline
Registered User
FRC #2403
 
Join Date: Jan 2014
Location: Mesa, Arizona
Posts: 29
Joshua Sicz is an unknown quantity at this point
Realistic Velocity Calculation

I have been helping out our student programmers on our team and we haven't found a good why to calculate velocity. We have a accelerometer that gives us reading in g's. So we just convert it to ft/s^2 and then take the timedifference between that last time the code was ran to calculate velocity. But what we are finding is the accelerometer doesn't give us consistent values.

Does any team have experience in this? Anything would help thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 23-01-2015, 22:15
Ideal_Nerd's Avatar
Ideal_Nerd Ideal_Nerd is offline
Team Caption
FRC #3591 (Wild Warbots)
Team Role: Driver
 
Join Date: Jan 2013
Rookie Year: 2008
Location: United States
Posts: 37
Ideal_Nerd has a spectacular aura aboutIdeal_Nerd has a spectacular aura about
Re: Realistic Velocity Calculation

You could use a encoder on the wheels to calculate the speed of your robot and use the gyro/accelerometer to determine the direction.
__________________
Evan

Team Captain, CAD leader FRC team #3591.
Westerville Ohio.
Reply With Quote
  #3   Spotlight this post!  
Unread 23-01-2015, 22:27
asid61's Avatar
asid61 asid61 is offline
Registered User
AKA: Anand Rajamani
FRC #0115 (MVRT)
Team Role: Mechanical
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Cupertino, CA
Posts: 2,222
asid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond reputeasid61 has a reputation beyond repute
Re: Realistic Velocity Calculation

Quote:
Originally Posted by Ideal_Nerd View Post
You could use a encoder on the wheels to calculate the speed of your robot and use the gyro/accelerometer to determine the direction.
I believe many tems use an encoder for speeds. We do.
Reply With Quote
  #4   Spotlight this post!  
Unread 23-01-2015, 23:42
Joshua Sicz Joshua Sicz is offline
Registered User
FRC #2403
 
Join Date: Jan 2014
Location: Mesa, Arizona
Posts: 29
Joshua Sicz is an unknown quantity at this point
Re: Realistic Velocity Calculation

Quote:
Originally Posted by Ideal_Nerd View Post
You could use a encoder on the wheels to calculate the speed of your robot and use the gyro/accelerometer to determine the direction.
Yea we have encoders but what may happen is you could be stuck and your wheels turning with you actually going anywhere.
Reply With Quote
  #5   Spotlight this post!  
Unread 24-01-2015, 00:12
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,605
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Realistic Velocity Calculation

Quote:
Originally Posted by Joshua Sicz View Post
Yea we have encoders but what may happen is you could be stuck and your wheels turning with you actually going anywhere.
HMMM.. I wonder if anyone has ever implemented an optical mouse solution applied to the carpet beneath an FRC robot...you'd need to use two of them in different locations to also measure rotation, but it'd be a great way to know if you lost traction. Oh, well - not my problem this year; shove it into the "off-season projects" folder, er, file cabinet.
Reply With Quote
  #6   Spotlight this post!  
Unread 24-01-2015, 00:21
Caleb Sykes's Avatar
Caleb Sykes Caleb Sykes is offline
Registered User
FRC #4536 (MinuteBots)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2009
Location: St. Paul, Minnesota
Posts: 1,053
Caleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond repute
Re: Realistic Velocity Calculation

Quote:
Originally Posted by GeeTwo View Post
HMMM.. I wonder if anyone has ever implemented an optical mouse solution applied to the carpet beneath an FRC robot...you'd need to use two of them in different locations to also measure rotation, but it'd be a great way to know if you lost traction. Oh, well - not my problem this year; shove it into the "off-season projects" folder, er, file cabinet.
Not quite an optical mouse, but I know that a couple of teams have mounted unpowered omni wheels beneath their robot that are connected to encoders in order to measure distance. Syncing the data with this with an angular measurement could then determine velocity and position. I think I remember 111 doing something like this last year, but I am unable to find the thread describing it.
Reply With Quote
  #7   Spotlight this post!  
Unread 24-01-2015, 00:34
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,605
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Realistic Velocity Calculation

Quote:
Originally Posted by Caleb Sykes View Post
Not quite an optical mouse, but I know that a couple of teams have mounted unpowered omni wheels beneath their robot that are connected to encoders in order to measure distance. Syncing the data with this with an angular measurement could then determine velocity and position. I think I remember 111 doing something like this last year, but I am unable to find the thread describing it.
And if you arranged them in a triangle with all the axes pointing towards the same point, you'd have a kiwi speedometer!
Reply With Quote
  #8   Spotlight this post!  
Unread 24-01-2015, 01:16
Joshua Sicz Joshua Sicz is offline
Registered User
FRC #2403
 
Join Date: Jan 2014
Location: Mesa, Arizona
Posts: 29
Joshua Sicz is an unknown quantity at this point
Re: Realistic Velocity Calculation

Quote:
Originally Posted by GeeTwo View Post
And if you arranged them in a triangle with all the axes pointing towards the same point, you'd have a kiwi speedometer!
All of this is quite interesting. I will have to try a mouse on the carpet.
Reply With Quote
  #9   Spotlight this post!  
Unread 24-01-2015, 02:00
Spoam's Avatar
Spoam Spoam is offline
Registered User
AKA: Pedro M.
FRC #0955 (CV Robotics)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2012
Location: Corvallis
Posts: 54
Spoam is a jewel in the roughSpoam is a jewel in the roughSpoam is a jewel in the roughSpoam is a jewel in the rough
Re: Realistic Velocity Calculation

You can find the velocity by numerically integrating the acceleration values (e.g. trapezoid sum them, or continuously add the acc value*time step). This is probably very imprecise though, so I would test it empirically and not have anything vital depend on those values.
__________________
2015 PNW District Champions (955, 1983, 2930)





Co-Creator of 955 OPR

Last edited by Spoam : 24-01-2015 at 02:05.
Reply With Quote
  #10   Spotlight this post!  
Unread 24-01-2015, 08:19
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,751
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: Realistic Velocity Calculation

Integrating the acceleration to get velocity is theoretically correct and simple, but won't yield good results unless you can handle lots of pesky details.

The biggest problem is that the accelerometer is operating in the earth's gravity field. You have a big force that just doesn't go away. You can sit still and calibrate it out, but if you tilt just a tiny bit, gravity's "down" vector starts to show up in your other orthogonal dimensions you really care about. And since you are accumulating, it adds up quick and appears that your robot has been accelerating and is now traveling across the field. My understanding is that good IMUs also contain a good inclinometer ( a specialized gyro) so that they measure the tilt and correct for it.

If this were straightforward, you'd also see tons of phone apps that not only counted steps, but told you how fast you were walking/driving and didn't need GPS and cell triangulation to know your location. Cars wouldn't measure wheel speed either. They would use the same technique.

So the concept is a good one to discuss and experiment with, but a little bit of additional analysis will show the need to cancel gravity for matches in order for this to work well enough.

Greg McKaskle
Reply With Quote
  #11   Spotlight this post!  
Unread 24-01-2015, 14:16
slibert slibert is offline
Software Mentor
AKA: Scott Libert
FRC #2465 (Kauaibots)
Team Role: Mentor
 
Join Date: Oct 2011
Rookie Year: 2005
Location: Kauai, Hawaii
Posts: 348
slibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud ofslibert has much to be proud of
Re: Realistic Velocity Calculation

Quote:
Originally Posted by Greg McKaskle View Post
Integrating the acceleration to get velocity is theoretically correct and simple, but won't yield good results unless you can handle lots of pesky details.

The biggest problem is that the accelerometer is operating in the earth's gravity field. You have a big force that just doesn't go away. You can sit still and calibrate it out, but if you tilt just a tiny bit, gravity's "down" vector starts to show up in your other orthogonal dimensions you really care about. And since you are accumulating, it adds up quick and appears that your robot has been accelerating and is now traveling across the field. My understanding is that good IMUs also contain a good inclinometer ( a specialized gyro) so that they measure the tilt and correct for it.

If this were straightforward, you'd also see tons of phone apps that not only counted steps, but told you how fast you were walking/driving and didn't need GPS and cell triangulation to know your location. Cars wouldn't measure wheel speed either. They would use the same technique.

So the concept is a good one to discuss and experiment with, but a little bit of additional analysis will show the need to cancel gravity for matches in order for this to work well enough.

Greg McKaskle
Just wanted to amplify Greg's point. It's complicated, so will take some focused effort and time, and understanding of the physics and related math.

The process is (a) the gravity vector has to be calculated, and to be done accurately, (b) the gyro and accelerometer data must be fused and filtered. Then (c), that vector is subtracted from calibrated accelerometer data to yield linear acceleration, (d)
rotated to be in "world" coordinates (overcoming pitch/roll effects and rotation), then (e) double-integrated to yield distance-traveled vectors in x and y axes.

In case you're interested, the navX MXP does parts (a-d). Here's a link to some Java code that does the calculations for (b-d) [step a is done in hardware on the navX MXP] so you'll get a feel for the process. In this code (see the setQuaternion() function), the gravity vector is derived from a quaternion (a representation of the orientation of the body which has fused the gyro and accelerometer data). This is then subtracted from the calibrated accelerometer, yielding linear acceleration.

The navX MXP provides this information to the RoboRio, and there are teams discussing on Chiefdelphi using the navX MXP and attempting to do step (e), what you are describing. The standard caveat is that this requires a double-integration (acceleration->velecity->distance) and small amounts of noise and error will quickly compound, so that actual distance that this will be accurate for is something still to be determined.

The next step after that would seem to be (f) fuse the encoder data w/the estimated distance vector, which if done well could potentially increase the quality of the estimate of the distance vector.
Reply With Quote
  #12   Spotlight this post!  
Unread 25-01-2015, 00:45
Joshua Sicz Joshua Sicz is offline
Registered User
FRC #2403
 
Join Date: Jan 2014
Location: Mesa, Arizona
Posts: 29
Joshua Sicz is an unknown quantity at this point
Re: Realistic Velocity Calculation

Quote:
Originally Posted by slibert View Post
Just wanted to amplify Greg's point. It's complicated, so will take some focused effort and time, and understanding of the physics and related math.

The process is (a) the gravity vector has to be calculated, and to be done accurately, (b) the gyro and accelerometer data must be fused and filtered. Then (c), that vector is subtracted from calibrated accelerometer data to yield linear acceleration, (d)
rotated to be in "world" coordinates (overcoming pitch/roll effects and rotation), then (e) double-integrated to yield distance-traveled vectors in x and y axes.

In case you're interested, the navX MXP does parts (a-d). Here's a link to some Java code that does the calculations for (b-d) [step a is done in hardware on the navX MXP] so you'll get a feel for the process. In this code (see the setQuaternion() function), the gravity vector is derived from a quaternion (a representation of the orientation of the body which has fused the gyro and accelerometer data). This is then subtracted from the calibrated accelerometer, yielding linear acceleration.

The navX MXP provides this information to the RoboRio, and there are teams discussing on Chiefdelphi using the navX MXP and attempting to do step (e), what you are describing. The standard caveat is that this requires a double-integration (acceleration->velecity->distance) and small amounts of noise and error will quickly compound, so that actual distance that this will be accurate for is something still to be determined.

The next step after that would seem to be (f) fuse the encoder data w/the estimated distance vector, which if done well could potentially increase the quality of the estimate of the distance vector.
Yes, since the beginning of the season our team has been looking for the NavX board but it has been sold out at andymark every time we check. I would love to get one to play around to do what you are saying. Thank you so much for those link they will be very helpful.
Reply With Quote
  #13   Spotlight this post!  
Unread 25-01-2015, 00:40
Joshua Sicz Joshua Sicz is offline
Registered User
FRC #2403
 
Join Date: Jan 2014
Location: Mesa, Arizona
Posts: 29
Joshua Sicz is an unknown quantity at this point
Re: Realistic Velocity Calculation

Quote:
Originally Posted by Greg McKaskle View Post
Integrating the acceleration to get velocity is theoretically correct and simple, but won't yield good results unless you can handle lots of pesky details.

The biggest problem is that the accelerometer is operating in the earth's gravity field. You have a big force that just doesn't go away. You can sit still and calibrate it out, but if you tilt just a tiny bit, gravity's "down" vector starts to show up in your other orthogonal dimensions you really care about. And since you are accumulating, it adds up quick and appears that your robot has been accelerating and is now traveling across the field. My understanding is that good IMUs also contain a good inclinometer ( a specialized gyro) so that they measure the tilt and correct for it.

If this were straightforward, you'd also see tons of phone apps that not only counted steps, but told you how fast you were walking/driving and didn't need GPS and cell triangulation to know your location. Cars wouldn't measure wheel speed either. They would use the same technique.

So the concept is a good one to discuss and experiment with, but a little bit of additional analysis will show the need to cancel gravity for matches in order for this to work well enough.

Greg McKaskle
Wow, this is one great explanation. This explains so much of why the accelerometer was giving us all of those weird values. And it makes since why they wouldn't do it this way. Over the summer I am going to arrange a project for this to see if you can get something out of the data we are getting.

Thank you so much, it was very helpful!
Reply With Quote
  #14   Spotlight this post!  
Unread 06-02-2015, 00:33
duane's Avatar
duane duane is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2003
Location: Vacaville
Posts: 98
duane is an unknown quantity at this point
Send a message via AIM to duane
Re: Realistic Velocity Calculation

We have been trying to use the built-in accelerometer to convert to velocity to convert to distance. The biggest problem I am seeing is the random values from the accelerometer to begin with. The noise seems to be quite high (I should add some numbers, but I don't have them right now).

However, from the reading of this thread, it seems like we are not going to be successful at this attempt.

What else would the accelerometer be used for on the RoboRio if not for velocity/distance? Seems odd to spend the money on a device that has limited functionality.

What am I missing?
__________________
Duane Murphy
Mentor - Software
Vanden Vikings FIRST Team 701
http://www.vandenrobotics.com
Reply With Quote
  #15   Spotlight this post!  
Unread 06-02-2015, 00:43
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,605
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Realistic Velocity Calculation

Quote:
Originally Posted by duane View Post
We have been trying to use the built-in accelerometer to convert to velocity to convert to distance. The biggest problem I am seeing is the random values from the accelerometer to begin with. The noise seems to be quite high (I should add some numbers, but I don't have them right now).

However, from the reading of this thread, it seems like we are not going to be successful at this attempt.

What else would the accelerometer be used for on the RoboRio if not for velocity/distance? Seems odd to spend the money on a device that has limited functionality.

What am I missing?
  • They are rather good at telling what your tilt angle is when you aren't moving - many teams used them to find the balance points on the bridges in Rebound Rumble. We were considering using them to find the edges of the scoring platform this year - drive up relatively slowly and you know you're there when you begin to tilt. We dropped this in favor of a "curb feeler" approach.
  • They also make decent collision sensors - if you're accelerating more than 2g's, you probably hit something.
  • When combined with wheel encoders, they could also be used to determine if you have lost traction.
  • If you have stability issues (e.g. fall over in a sharp turn), they could be part of a solution to stay upright.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
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 09:28.

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