|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
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! |
|
#2
|
||||
|
||||
|
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) Code:
AnalogChannel *channel = new AnalogChannel(1); Gyro *gyro = new Gyro(channel); float value = channel->GetVoltage(); float angle = gyro->GetAngle(); |
|
#3
|
|||
|
|||
|
Re: AnalogChannel as both an accumulator AND a normal input?
Quote:
Code:
return m_voltsPerDegreePerSecond*m_analog->GetVoltage(); |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |