virtual void TeleopInit() { // This makes sure that the autonomous stops running when // teleop starts running. If you want the autonomous to // continue until interrupted by another command, remove // this line or comment it out. if (_autonomousCommand) { _autonomousCommand->Cancel(); } clearLCD(); _teleopCommand = (Command*)_teleopChooser->GetSelected(); // _teleopCommand = (Command*)_noOpCmd; printCommandToLCD(_teleopCommand->GetName()); // if (! CommandBase::azimuthSubsystem->IsCalibrated()) // { // CommandBase::azimuthSubsystem->CalibrateAzimuth(); // } _teleopCommand->Start(); // _testRobotCmd->Start(); // _cmd = new TestBridgeArmCmd(CommandBase::oi->driveTrigger); // _cmd->Start(); }
void SlavedLauncherPID::SendSD() { SmartDashboard::PutNumber(GetName() + "speed", ReturnPIDInput()); SmartDashboard::PutNumber(GetName() + "power", pidMotor.Get()); SmartDashboard::PutNumber(GetName() + "power2", pidMotor2.Get()); Command* comm = GetCurrentCommand(); if(comm) { SmartDashboard::PutString(GetName() + "command" , comm->GetName()); } }
void MFCBot::AutonomousInit() { visionControl->PutBoolean("disabled",false); Scheduler::GetInstance()->RemoveAll(); Command *cmd = ((Command*) chooser->GetSelected()); if (cmd!=NULL) { cmd->Start(); printf("Starting AUTO: %s\n", cmd->GetName().c_str()); } SmartDashboard::PutBoolean("HotGoal", false); Logger::log(Logger::kInfo, "Main", "Autonomous Init%s", DriverStation::GetInstance()->IsFMSAttached() ? ":FMS" : ""); }
virtual void AutonomousInit() { if (_teleopCommand) { _teleopCommand->Cancel(); } clearLCD(); _autonomousCommand = (Command*)_autoChooser->GetSelected(); // _autonomousCommand = (Command*) _autoFireCmd; printCommandToLCD(_autonomousCommand->GetName()); _autonomousCommand->Start(); }
void OnLog(Logger *logger) override { User *user = logger->GetUser(); ChanServ::Channel *channel = logger->GetCi(); Command *command = logger->GetCommand(); CommandSource *source = logger->GetSource(); if (logger->GetType() != LogType::COMMAND || user == nullptr || command == nullptr || channel == nullptr || !Me || !Me->IsSynced()) return; Channel *c = channel->GetChannel(); for (LogSetting *log : channel->GetRefs<LogSetting *>()) { /* wrong command */ if (log->GetServiceName() != command->GetName()) continue; /* if a command name is given check the service and the command */ if (!log->GetCommandName().empty()) { /* wrong service (only check if not a fantasy command, though) */ if (!source->c && log->GetCommandService() != source->service->nick) continue; if (!log->GetCommandName().equals_ci(source->GetCommand())) continue; } const Anope::string &buffer = logger->GetMaskedMessage(); if (log->GetMethod().equals_ci("MEMO") && memoserv && channel->WhoSends() != NULL) memoserv->Send(channel->WhoSends()->nick, channel->GetName(), buffer, true); else if (source->c) /* Sending a channel message or notice in response to a fantasy command */; else if (log->GetMethod().equals_ci("MESSAGE") && c) { IRCD->SendPrivmsg(channel->WhoSends(), log->GetExtra() + c->name, "{0}", buffer); #warning "fix idletimes" //l->ci->WhoSends()->lastmsg = Anope::CurTime; } else if (log->GetMethod().equals_ci("NOTICE") && c) IRCD->SendNotice(channel->WhoSends(), log->GetExtra() + c->name, "{0}", buffer); } }
/** * Update the network tables associated with the Scheduler object on the * SmartDashboard. */ void Scheduler::UpdateTable() { CommandSet::iterator commandIter; if (m_table != nullptr) { // Get the list of possible commands to cancel auto new_toCancel = m_table->GetValue("Cancel"); if (new_toCancel) toCancel = new_toCancel->GetDoubleArray(); else toCancel.resize(0); // m_table->RetrieveValue("Ids", *ids); // cancel commands that have had the cancel buttons pressed // on the SmartDashboad if (!toCancel.empty()) { for (commandIter = m_commands.begin(); commandIter != m_commands.end(); ++commandIter) { for (unsigned i = 0; i < toCancel.size(); i++) { Command* c = *commandIter; if (c->GetID() == toCancel[i]) { c->Cancel(); } } } toCancel.resize(0); m_table->PutValue("Cancel", nt::Value::MakeDoubleArray(toCancel)); } // Set the running commands if (m_runningCommandsChanged) { commands.resize(0); ids.resize(0); for (commandIter = m_commands.begin(); commandIter != m_commands.end(); ++commandIter) { Command* c = *commandIter; commands.push_back(c->GetName()); ids.push_back(c->GetID()); } m_table->PutValue("Names", nt::Value::MakeStringArray(commands)); m_table->PutValue("Ids", nt::Value::MakeDoubleArray(ids)); } } }
void MFCBot::WatchDog() { if (CommandBase::shooter != NULL) { int watching = 0; if (CommandBase::shooter->getWenchMotorSpeed() < 0 && CommandBase::shooter->getTurns() > SHOOTER_WENCH_POT_FULL_OUT) { CommandBase::shooter->setWenchMotor(0.0); watching = 1; if (watchdogTicks==0) Logger::log(Logger::kWarning, "Watchdog", "Shooter motor over released!"); } if (CommandBase::shooter->getWenchMotorSpeed() < 0 && CommandBase::shooter->getWLatch() == Shooter::kLatched) { CommandBase::shooter->setWenchMotor(0.0); watching = 1; if (watchdogTicks==0) Logger::log(Logger::kWarning, "Watchdog", "Shooter motor released without pawl disengaged!"); } if (CommandBase::shooter->getWenchMotorSpeed()> 0) { if (CommandBase::shooter->getTurns() < SHOOTER_WENCH_POT_BACK && (CommandBase::oi==NULL ||!CommandBase::oi->isShooterPotPullbackIgnored())) { CommandBase::shooter->setWenchMotor(0.0); watching = 1; if (watchdogTicks==0) Logger::log(Logger::kWarning, "Watchdog", "Shooter motor overdrawn sensed by potentiometer!"); } if (CommandBase::shooter->getTurns() < SHOOTER_WENCH_POT_REVERSE_ALLOW) { #if SHOOTER_LIMITSWITCH if (CommandBase::shooter->isLatchedByProximity()) { CommandBase::shooter->setWenchMotor(0.0); watching = 1; if (watchdogTicks==0) Logger::log(Logger::kWarning, "Watchdog", "Shooter motor overdrawn sensed by proximity switch!"); } #endif if (CommandBase::shooter->isLatchedByPattern()) { CommandBase::shooter->setWenchMotor(0.0); watching = 1; if (watchdogTicks==0) Logger::log(Logger::kWarning, "Watchdog", "Shooter motor overdrawn sensed by latch pattern!"); } } } if (!watching) { watchdogTicks=0; } else { if (watchdogTicks++>10) { watchdogTicks=0; } } if (CommandBase::shooter->isShooterMotorStalled() && CommandBase::shooter->getWenchMotorSpeed()>0 && CommandBase::shooter->getTurns() > 0.125 && CommandBase::shooter->getWLatch() != Shooter::kLatched) { Command *running = CommandBase::shooter->GetCurrentCommand(); if (running != NULL) { if (running->GetName().compare("WLatch_Latched") != 0) { printf( "Watchdog: Killed command %s due to shooter stall!\n", running->GetName().c_str()); Scheduler::GetInstance()->Remove(running); Scheduler::GetInstance()->AddCommand(new WLatch(Shooter::kLatched)); } } } } }