void RobotDemo::toggleCompressor(){
	if(compressor->Enabled()){
		compressor->Stop();
	}
	else{
		compressor->Start();
	}
}
	void smartDashboardPrint()
	{ 
		oi->dashboard->PutNumber("Drive Linear Speed: ", drive->getLinVelocity());
		oi->dashboard->PutNumber("Drive Turn Speed: ", drive->getTurnSpeed());
		oi->dashboard->PutNumber("Timer: ", timer->Get());
		oi->dashboard->PutNumber("Pot Raw Value: ", manipulator->pot->GetVoltage());
		oi->dashboard->PutBoolean(" Wait (Motors Disabled)", isWait);
		oi->dashboard->PutBoolean(" Compressor", comp599->Enabled());
		oi->dashboard->PutString("Arm Position: ", manipulator->getArmPosition() ? "Intake" : "Stored");
		oi->dashboard->PutString("Shift State: ", drive->getShiftState() ? "High" : "Low");
		oi->dashboard->PutString("Launch State: ", launcher->launchState > 0 ? (launcher->launchState == 1 ? "HOLD" : (launcher->launchState == 2 ? "RESET" : (launcher->launchState == 3 ? "COCKED" : "FIRE"))) : "OFF");
		oi->dashboard->PutString("Camera Position: ", manipulator->getCameraPosition() > 0 ? ((manipulator->getCameraPosition() == 2) ? "Forward" : "Back") : "Inbetween");
		oi->dashboard->PutBoolean(" Ready to Fire", launcher->launchState == STATE_COCKED ? true : false);
	}	
Esempio n. 3
0
void tick_itf_pneumatic() {
	Concurrent::IPCMutex *mtx = Memory::shared_mutex()->pcm;
	for (int i = 0; i < 2; i++) {
		MTX_LOCK(mtx, i);
		Memory::Shared::IO::Pneumatics *pcm = Memory::shared()->pneumatics(i);
		if (pcm->get_init()) {
			Solenoid **sol = sols[i];
			int modid = pcm->get_pcm_can_id();
			if (!pcm->get_bootstrap()) {
				cmps[i] = new Compressor(modid);
				pcm->set_closed_loop(cmps[i]->GetClosedLoopControl());
				for (int j = 0; j < 8; j++) {
					sol[j] = new Solenoid(modid, j);
				}
				pcm->set_bootstrap(true);
			}

			Compressor *cmp = cmps[i];
			pcm->set_fault_comp_too_high(cmp->GetCompressorCurrentTooHighFault());
			pcm->set_fault_comp_not_conn_sticky(cmp->GetCompressorCurrentTooHighStickyFault());
			pcm->set_fault_comp_shorted(cmp->GetCompressorShortedFault());
			pcm->set_fault_comp_shorted_sticky(cmp->GetCompressorShortedStickyFault());
			pcm->set_fault_comp_not_conn(cmp->GetCompressorNotConnectedFault());
			pcm->set_fault_comp_not_conn_sticky(cmp->GetCompressorNotConnectedStickyFault());
			if (pcm->get_comp_sticky_clear_pending()) {
				cmp->ClearAllPCMStickyFaults();
				pcm->set_comp_sticky_clear_pending(false);
			}

			pcm->set_pressure_switch(cmp->GetPressureSwitchValue());
			if (pcm->get_closed_loop_mode_pending()) {
				cmp->SetClosedLoopControl(pcm->get_closed_loop());
				pcm->set_closed_loop_mode_pending(true);
			}
			pcm->set_is_enabled(cmp->Enabled());

			if (pcm->get_start_pending()) {
				cmp->Start();
				pcm->set_start_pending(false);
			}

			if (pcm->get_stop_pending()) {
				cmp->Stop();
				pcm->set_stop_pending(false);
			}

			for (int j = 0; j < 8; j++) {
				Solenoid *s = sol[j];
				s->Set(pcm->get_solenoid(j));
				pcm->set_solenoid_black(j, s->IsBlackListed());
			}

			Solenoid *s = sol[0];
			pcm->set_fault_sol_volt(s->GetPCMSolenoidVoltageFault(modid));
			pcm->set_fault_sol_volt_sticky(s->GetPCMSolenoidVoltageStickyFault(modid));
			if (pcm->get_sol_sticky_clear_pending()) {
				s->ClearAllPCMStickyFaults(modid);
				pcm->set_sol_sticky_clear_pending(true);
			}

			pcm->set_comp_current(cmp->GetCompressorCurrent());
		}
		MTX_UNLOCK(mtx, i);
	}
}