|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Grabbing subsystem data to use in another subsystem in Command Based
Yes, you can access other subsystems to get information; depending on how strictly you want to adhere to the command based approach, this may be 'cheating' a little, but for read only access it doesn't do any harm.
The Robot class has static instances of all subsystems, so you can access them from anywhere that includes Robot.h (just as is done in commands). The syntax is as follows: Code:
bool ShooterPiston::Fire()
{
bool returnValue = false;
if ((Robot::shooterWheels->IsUpToSpeed() == true) &&
(Robot::shooterArm->IsOnTarget() == true) &&
....
{
firingSolenoid->Set(DoubleSolenoid::kReverse);
returnValue = true;
}
return returnValue;
}
|
|
#2
|
||||||
|
||||||
|
Re: Grabbing subsystem data to use in another subsystem in Command Based
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|