Go to Post Mentors may not be the direct focus of FIRST, but they are just as involved as students are. They play a pivotal role in the success of FIRST and of the success of every team. - Dan Petrovic [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 28-01-2009, 21:52
Jared Russell's Avatar
Jared Russell Jared Russell is online now
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,071
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
AnalogChannel as both an accumulator AND a normal input?

Can this be done?

In other words, the Gyro class uses an accumulator channel and does not give me a public method to get the instantaneous reading from the sensor. Is this because an input can be either an instantaneous read OR an accumulator, or is it just a WPILib design issue?

Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 29-01-2009, 02:29
MattD's Avatar
MattD MattD is offline
Registered User
AKA: Matthew Douglas
FRC #0228 (GUS Robotics)
Team Role: Alumni
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Indianapolis, IN
Posts: 185
MattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to behold
Send a message via AIM to MattD
Re: AnalogChannel as both an accumulator AND a normal input?

You should be able to do this. The Gyro class has a constructor that accepts an existing AnalogChannel object.

Code:
/**
 * Gyro constructor with a precreated analog channel object.
 * Use this constructor when the analog channel needs to be shared. There
 * is no reference counting when an AnalogChannel is passed to the gyro.
 * @param channel The AnalogChannel object that the gyro is connected to.
 */
Gyro::Gyro(AnalogChannel *channel)
You can create an AnalogChannel and use the standard methods on it, while using the accumulator information via the Gyro class at the same time.

Code:
AnalogChannel *channel = new AnalogChannel(1);
Gyro *gyro = new Gyro(channel);

float value = channel->GetVoltage();
float angle = gyro->GetAngle();
Alternatively, you could modify the Gyro class to provide access to this information.
__________________
GUS Robotics Team 228

2010 WPI Engineering Inspiration Award
2010 WPI Regional Champions (Thanks 230 & 20!)
2010 CT VEX Champions
2010 CT VEX Innovate Award
2009 QCC VEX Champions
2009 CT Motorola Quality Award
2007 CT J&J Sportsmanship Award
2006 CT Best Website Award
Reply With Quote
  #3   Spotlight this post!  
Unread 31-01-2009, 10:14
jbobj jbobj is offline
Registered User
AKA: Jacob Hays
FRC #0768
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2003
Location: Columbia MD
Posts: 3
jbobj is an unknown quantity at this point
Re: AnalogChannel as both an accumulator AND a normal input?

Quote:
Originally Posted by MattD View Post
You can create an AnalogChannel and use the standard methods on it, while using the accumulator information via the Gyro class at the same time.

Code:
AnalogChannel *channel = new AnalogChannel(1);
Gyro *gyro = new Gyro(channel);

float value = channel->GetVoltage();
float angle = gyro->GetAngle();
Alternatively, you could modify the Gyro class to provide access to this information.
If this is so, and I want to get the Degrees per Second from the Gyro, does this line of code within the Gyro class do that? m_analog is the AnalogChannel within the Gyro class, and voltsPerDegreePerSecond is a constant I see in there.

Code:
return m_voltsPerDegreePerSecond*m_analog->GetVoltage();
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
<R06> normal wear and tear Darkcrosbone Rules/Strategy 54 27-01-2009 18:03
Hobbies, normal and unusual Jill1022 Chit-Chat 61 29-04-2005 08:33
Well, is it normal for me not to be in FIRST Robotics and post here? JKis6622 Chit-Chat 3 13-03-2004 15:46
physics and engineering are both cool charlie_grr Math and Science 2 03-06-2003 21:46
Both Lighter and Smaller... Jim Meyer OCCRA 2 18-09-2002 18:12


All times are GMT -5. The time now is 02:31.

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