public void OnReceiveRosMessage(RosBridge.handyman.HandymanMsg handymanMsg) { if (this.receivedMessageMap.ContainsKey(handymanMsg.message)) { // Check message order if (handymanMsg.message == MsgIamReady) { if (this.step != ModeratorStep.WaitForIamReady) { SIGVerseLogger.Warn("Illegal timing. message : " + handymanMsg.message + ", step=" + this.step); return; } } if (handymanMsg.message == MsgRoomReached) { if (this.step != ModeratorStep.WaitForRoomReached) { SIGVerseLogger.Warn("Illegal timing. message : " + handymanMsg.message + ", step=" + this.step); return; } } if (handymanMsg.message == MsgDoesNotExist) { if (this.step != ModeratorStep.WaitForDoesNotExist && this.step != ModeratorStep.WaitForObjectGrasped) { SIGVerseLogger.Warn("Illegal timing. message : " + handymanMsg.message + ", step=" + this.step); return; } } if (handymanMsg.message == MsgObjectGrasped) { if (this.step != ModeratorStep.WaitForDoesNotExist && this.step != ModeratorStep.WaitForObjectGrasped) { SIGVerseLogger.Warn("Illegal timing. message : " + handymanMsg.message + ", step=" + this.step); return; } } if (handymanMsg.message == MsgTaskFinished) { if (this.step != ModeratorStep.WaitForTaskFinished) { SIGVerseLogger.Warn("Illegal timing. message : " + handymanMsg.message + ", step=" + this.step); return; } } if (handymanMsg.message == MsgGiveUp) { this.OnGiveUp(); } this.receivedMessageMap[handymanMsg.message] = true; } else { SIGVerseLogger.Warn("Received Illegal message : " + handymanMsg.message); } }
//To receive message from ros public void OnReceiveRosMessage(RosBridge.handyman.HandymanMsg handymanMsg) { //SIGVerseLogger.Info ("MESSAGE RECEIVED" + handymanMsg.message); if (handymanMsg.message == MsgIamReady) { this.step = PlacingStep.SetUpScene; } if (handymanMsg.message == MsgImagesCaptured) { tool.setTargetObject(); this.step = PlacingStep.ExcecutePlacing; } if (handymanMsg.message == MsgObjectPlaced) { this.step = PlacingStep.CalculateScore; } if (handymanMsg.message == MsgScoreSaved) { tool.disapearTarget(); this.step = PlacingStep.WaitForIamReady; } //Debug.Log ("Change " + this.step); }