bool Gripper::handlePickUp(gripper::PickUp::Request &req, gripper::PickUp::Response &res) { handlePickup(req.fully); res.succeeded = (unsigned char) true; return true; }
bool Gripper::initialise() { glue.init(); return false; RX.setMotorName("/tilt_controller/", 15E-3, 1); RX.initCompleted(); RX.setMultiplier(2.0); handlePickup(true); ros::Rate sleep(5); for (int i = 0; i < 10; ++i) { sleep.sleep(); loopOnce(); while(!RX.hasCompleted()) { loopOnce(); } } MX.setMotorName("/pan_controller/", 3E-02, 2); MX.runIntoLimit(); while(!MX.hasCompleted()) { loopOnce(); } for (int i = 0; i < 10; ++i) { sleep.sleep(); loopOnce(); while(!RX.hasCompleted() | !MX.hasCompleted()) { loopOnce(); } } spindle.initialise(); spindle.intialiseExternal(); spindle.isInitialised(); while(!spindle.isInitialised()) { loopOnce(); } initialised = true; return true; }
void GameHandler::processMessage(NetComputer *computer, MessageIn &message) { GameClient &client = *static_cast<GameClient *>(computer); if (client.status == CLIENT_LOGIN) { if (message.getId() != PGMSG_CONNECT) return; std::string magic_token = message.readString(MAGIC_TOKEN_LENGTH); client.status = CLIENT_QUEUED; // Before the addPendingClient mTokenCollector.addPendingClient(magic_token, &client); return; } else if (client.status != CLIENT_CONNECTED) { return; } switch (message.getId()) { case PGMSG_SAY: handleSay(client, message); break; case PGMSG_NPC_TALK: case PGMSG_NPC_TALK_NEXT: case PGMSG_NPC_SELECT: case PGMSG_NPC_NUMBER: case PGMSG_NPC_STRING: handleNpc(client, message); break; case PGMSG_PICKUP: handlePickup(client, message); break; case PGMSG_USE_ITEM: handleUseItem(client, message); break; case PGMSG_DROP: handleDrop(client, message); break; case PGMSG_WALK: handleWalk(client, message); break; case PGMSG_EQUIP: handleEquip(client, message); break; case PGMSG_UNEQUIP: handleUnequip(client, message); break; case PGMSG_MOVE_ITEM: handleMoveItem(client, message); break; case PGMSG_ATTACK: handleAttack(client, message); break; case PGMSG_USE_SPECIAL_ON_BEING: handleUseSpecialOnBeing(client, message); break; case PGMSG_USE_SPECIAL_ON_POINT: handleUseSpecialOnPoint(client, message); break; case PGMSG_ACTION_CHANGE: handleActionChange(client, message); break; case PGMSG_DIRECTION_CHANGE: handleDirectionChange(client, message); break; case PGMSG_DISCONNECT: handleDisconnect(client, message); break; case PGMSG_TRADE_REQUEST: handleTradeRequest(client, message); break; case PGMSG_TRADE_CANCEL: case PGMSG_TRADE_AGREED: case PGMSG_TRADE_CONFIRM: case PGMSG_TRADE_ADD_ITEM: case PGMSG_TRADE_SET_MONEY: handleTrade(client, message); break; case PGMSG_NPC_BUYSELL: handleNpcBuySell(client, message); break; case PGMSG_RAISE_ATTRIBUTE: handleRaiseAttribute(client, message); break; case PGMSG_LOWER_ATTRIBUTE: handleLowerAttribute(client, message); break; case PGMSG_RESPAWN: // plausibility check is done by character class client.character->respawn(); break; case PGMSG_NPC_POST_SEND: handleNpcPostSend(client, message); break; case PGMSG_PARTY_INVITE: handlePartyInvite(client, message); break; case PGMSG_BEING_EMOTE: handleTriggerEmoticon(client, message); break; default: LOG_WARN("Invalid message type"); client.send(MessageOut(XXMSG_INVALID)); break; } }