diff --git a/src/network/MissionControlProtocol.cpp b/src/network/MissionControlProtocol.cpp index 4ce140832..88c1e1f60 100644 --- a/src/network/MissionControlProtocol.cpp +++ b/src/network/MissionControlProtocol.cpp @@ -37,7 +37,7 @@ const std::chrono::milliseconds TELEM_REPORT_PERIOD = 100ms; constexpr const char* EMERGENCY_STOP_REQ_TYPE = "emergencyStopRequest"; constexpr const char* OPERATION_MODE_REQ_TYPE = "operationModeRequest"; constexpr const char* DRIVE_REQ_TYPE = "driveRequest"; -constexpr const char* ARM_IK_ENABLED_TYPE = "setArmIKEnabled"; +constexpr const char* ARM_IK_ENABLED_TYPE = "requestArmIKEnabled"; constexpr const char* MOTOR_POWER_REQ_TYPE = "motorPowerRequest"; constexpr const char* JOINT_POWER_REQ_TYPE = "jointPowerRequest"; constexpr const char* MOTOR_POSITION_REQ_TYPE = "motorPositionRequest"; @@ -128,7 +128,7 @@ void MissionControlProtocol::handleDriveRequest(const json& j) { this->setRequestedCmdVel(dtheta, dx); } -void MissionControlProtocol::handleSetArmIKEnabled(const json& j) { +void MissionControlProtocol::handleRequestArmIKEnabled(const json& j) { bool enabled = j["enabled"]; if (enabled) { Globals::armIKEnabled = false; @@ -140,6 +140,9 @@ void MissionControlProtocol::handleSetArmIKEnabled(const json& j) { // TODO: there should be a better way of handling invalid data than crashing. // It should somehow just not enable IK, but then it needs to communicate back to MC // that IK wasn't enabled? + // FIX: Change setArmIKOn to requestArmIkOn. + // Create new packet: confirmIKOn packet + // Rover responds with confirmIKOn after requestArmIKOn is processed assert(armJointPositions.isValid()); Globals::planarArmController.set_setpoint(armJointPositions.getData()); Globals::armIKEnabled = true; @@ -361,11 +364,11 @@ MissionControlProtocol::MissionControlProtocol(SingleClientWSServer& server) validateDriveRequest); this->addMessageHandler( ARM_IK_ENABLED_TYPE, - std::bind(&MissionControlProtocol::handleSetArmIKEnabled, this, _1), + std::bind(&MissionControlProtocol::handleRequestArmIKEnabled, this, _1), validateArmIKEnable); this->addMessageHandler( ARM_IK_ENABLED_TYPE, - std::bind(&MissionControlProtocol::handleSetArmIKEnabled, this, _1), + std::bind(&MissionControlProtocol::handleRequestArmIKEnabled, this, _1), validateArmIKEnable); this->addMessageHandler( JOINT_POWER_REQ_TYPE, diff --git a/src/network/MissionControlProtocol.h b/src/network/MissionControlProtocol.h index d9748a6e1..9f95c8444 100644 --- a/src/network/MissionControlProtocol.h +++ b/src/network/MissionControlProtocol.h @@ -63,7 +63,7 @@ class MissionControlProtocol : public WebSocketProtocol { // TODO: add documenta void handleCameraStreamCloseRequest(const json& j); void handleJointPowerRequest(const json& j); void handleDriveRequest(const json& j); - void handleSetArmIKEnabled(const json& j); + void handleRequestArmIKEnabled(const json& j); void sendCameraStreamReport(const CameraID& cam, const std::vector>& videoData); void sendJointPositionReport(const std::string& jointName, int32_t position);