View Single Post
  #2   Spotlight this post!  
Unread 07-02-2012, 14:31
jwakeman jwakeman is offline
Registered User
FRC #0063 (Red Barons)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: 16510
Posts: 182
jwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nicejwakeman is just really nice
Re: one sensor multiple subsystems

Also wasn't sure on the best way to structure this. Here is what we are doing:

- we have a drive subsystem and turret subystem (and others)
- gyro is part of our drive (chassis) subsystem
- we have a Command call SetTurretAngle
- SetTurretAngle requires the turret subystem
- SetTurretAngle does NOT require the drive subystem. I don't want it to prevent commands that require the drive subsystem from running. We are accessing the gyro thru the drive subsytem but we are not actuating anything within the drive so I feel that it is safe. I don't think there are multi-threading issues because I think the scheduler is a single thread.

This is what the implementation of the SetTurretAngle Command looks like:
Code:
void SetTurretAngleCommand::Execute() {
	turretSubsystem->SetTurretAngle(-1.0 * driveSubsystem->GetHeading());
}

In a similar vein. I wasn't sure where to put my Compressor object. I considered making a pneumatics subystem. The solenoid valves that actually actuate things will be part of their respective subsytem though. I decided the pneumatics are like the battery, just a source of energy that all the subystems could use. Ended up making the compressor a member CommandBase and will allocate the Solenoids to their respective subsystems.
Reply With Quote