void Processor::sendRadioData() { Packet::RadioTx* tx = _state.logFrame->mutable_radio_tx(); tx->set_txmode(Packet::RadioTx::UNICAST); // Halt overrides normal motion control, but not joystick if (_state.gameState.halt()) { // Force all motor speeds to zero for (OurRobot* r : _state.self) { Packet::Control* control = r->control; control->set_xvelocity(0); control->set_yvelocity(0); control->set_avelocity(0); control->set_dvelocity(0); control->set_kcstrength(0); control->set_shootmode(Packet::Control::KICK); control->set_triggermode(Packet::Control::STAND_DOWN); control->set_song(Packet::Control::STOP); } } // Add RadioTx commands for visible robots and apply joystick input for (OurRobot* r : _state.self) { if (r->visible || _manualID == r->shell()) { Packet::Robot* txRobot = tx->add_robots(); // Copy motor commands. // Even if we are using the joystick, this sets robot_id and the // number of motors. txRobot->CopyFrom(r->robotPacket); if (r->shell() == _manualID) { const JoystickControlValues controlVals = getJoystickControlValues(); applyJoystickControls(controlVals, txRobot->mutable_control(), r); } } } if (_radio) { _radio->send(*_state.logFrame->mutable_radio_tx()); } }
/** * @brief start the robot playing a song * @param song */ void sing(Packet::Control::Song song = Packet::Control::FIGHT_SONG) { addText("GO TECH!", QColor(255, 0, 255), "Sing"); control->set_song(song); }