View Single Post
  #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