Go to Post A programmer's job is to write documentation that happens to compile.... :) - buddy.smith [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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 01-31-2013, 08:54 PM
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Gyro Absolute Angle

Hello! Programming this year has been going pretty well, but one problem is bugging us. We would like to use the gyro to return the angle of our (alleged) Frisbee launcher and can't exactly figure out how get the absolute angle from the gyro. I read in the 2009 C++ Getting Started Guide that the gyro is good for getting the relative angle, but not the absolute angle, and the accelerometer is good for directional acceleration and absolute angle (but is "easily confused while moving"). Does anyone happen to know the best way? Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 01-31-2013, 08:56 PM
Team3266Spencer's Avatar
Team3266Spencer Team3266Spencer is offline
Team Captain and Lead Programmer
AKA: Spencer Lanman
FRC #3266 (Robots-R-US)
Team Role: Programmer
 
Join Date: Oct 2011
Rookie Year: 2012
Location: Richmond, Indiana
Posts: 280
Team3266Spencer is an unknown quantity at this point
Re: Gyro Absolute Angle

The rotation of a turret your shooter is mounted on?
__________________
2012: Buckeye Regional, Queen City Regional, Human Player
2013: Queen City Regional, Buckeye Regional, Crossroads Regional
Shooter Operator
2014: Crossroads Regional, Queen City Regional
Catapult Operator
2015: Georgia Southern Classic Regional (Winner), Queen City Regional
Chainsaw Operator
Want to talk? TeamSpeak: team3266.noip.me
Reply With Quote
  #3   Spotlight this post!  
Unread 01-31-2013, 09:17 PM
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Re: Gyro Absolute Angle

We'll be using it for the pitch. We'll be aligning the entire robot for the yaw either manually or using the axis camera.
Reply With Quote
  #4   Spotlight this post!  
Unread 01-31-2013, 11:22 PM
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Gyro Absolute Angle

The yaw rate sensor "gyro" doesn't give you absolute angle. An accelerometer can be used to measure the component of gravity pulling in a specific direction, and from that compute tilt angle.

I believe a better solution would be an absolute angular sensor that turns with your pitch angle. A potentiometer can work, or a US Digital MA3, or an Austria Micro noncontact magnetic angular sensor.
Reply With Quote
  #5   Spotlight this post!  
Unread 02-01-2013, 12:35 AM
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Re: Gyro Absolute Angle

That looks a lot more reliable. Any idea how they are programmed?
Reply With Quote
  #6   Spotlight this post!  
Unread 02-01-2013, 10:13 AM
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Gyro Absolute Angle

Most absolute angle sensors produce an analog voltage. Read it using an analog input. Either use the voltage value directly, or scale it to something which represents a value that makes sense for your application.
Reply With Quote
  #7   Spotlight this post!  
Unread 02-04-2013, 11:42 PM
ekapalka's Avatar
ekapalka ekapalka is offline
Registered User
FRC #3216
 
Join Date: Dec 2012
Location: Bermuda
Posts: 277
ekapalka has a spectacular aura aboutekapalka has a spectacular aura about
Re: Gyro Absolute Angle

Quote:
Originally Posted by Alan Anderson View Post
I believe a better solution would be an absolute angular sensor that turns with your pitch angle. A potentiometer can work, or a US Digital MA3, or an Austria Micro noncontact magnetic angular sensor.
Sold. Any programming suggestions while we're waiting for shipping? (We chose the analog version). We're intending to mount it in the pivot point on our launcher (we'll lathe a hole in the rod to get an exact fit). Thanks, by the way!
Reply With Quote
  #8   Spotlight this post!  
Unread 02-06-2013, 04:34 PM
BradAMiller BradAMiller is offline
Registered User
AKA: Brad
#0190 ( Gompei and the Herd)
Team Role: Mentor
 
Join Date: Mar 2004
Location: Worcester, MA
Posts: 587
BradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant futureBradAMiller has a brilliant future
Re: Gyro Absolute Angle

You can use a PIDController class or a PIDSubsystem (for command-based programs). The input is the potentiometer and the output is the speed controller. You need to choose PID values that scale the inputs (0-5V) to match the required motor value outputs (-1 to 1).

You can see the pot values using the SmartDashboard in test mode to help you come up with the correct values. You can also put the PIDController to the SmartDashboard so that you can tune the PID loop from the computer.

http://wpilib.screenstepslive.com/s/...smartdashboard

Brad
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
Reply With Quote
  #9   Spotlight this post!  
Unread 02-06-2013, 05:57 PM
Jefferson Jefferson is offline
Registered User
AKA: Jeff Clements
FRC #0016 (Bomb Squad)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Mountain Home, AR
Posts: 257
Jefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant futureJefferson has a brilliant future
Re: Gyro Absolute Angle

Quote:
Originally Posted by BradAMiller View Post
The input is the potentiometer and the output is the speed controller. You need to choose PID values that scale the inputs (0-5V) to match the required motor value outputs (-1 to 1).
We've found that analog channels use averagevalue (0-1024), not averagevoltage (0-5V), in the PID loop. Your setpoints will need to be in the 0-1024 range.

Just a heads-up about the hardware: We've used a LOT of these over the years (probably 6 on this year's bot) and have broken our share of shafts in the process. Be sure to protect them from side loads across the shaft. For our swerve modules, this meant using flexible mounts for the body, and coupling the shaft with flexible tubing

Good luck.
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:55 AM.

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