//callback which calls when service is received public static void ServiceCallBack(string service, string yaml) { Debug.Log("SERVICE CALLBACK " + service); if (service.Equals(programGetService)) { JSONNode node = JSONNode.Parse(yaml); ProgramMsg programMsg = new ProgramMsg(node["program"]); //Debug.Log(programMsg.ToYAMLString()); ProgramManager.Instance.SetProgramMsgFromROS(programMsg); ProgramHelper.SetProgramMsgFromROS(programMsg); } //1. moznost jak ziskat velikosti objektu .. asi se nebude pouzivat if (service.Equals(objectGetService)) { JSONNode node = JSONNode.Parse(yaml); ObjectTypeMsg objectTypeMsg = new ObjectTypeMsg(node["object_type"]); ObjectsManager.Instance.SetObjectTypeMsgFromROS(objectTypeMsg); //Debug.Log(objectTypeMsg.ToYAMLString()); } if (service.Equals(getAllObjectTypesService)) { JSONNode node = JSONNode.Parse(yaml); ObjectsManager.Instance.SetObjectTypesFromROS(node); } if (service.Equals(rosparamGetService)) { JSONNode node = JSONNode.Parse(yaml); try { JSONNode parsed = JSONNode.Parse(node["message"]); Debug.Log(parsed); if (parsed["arms"] != null) { RobotHelper.SetRobotRadiusParam(parsed["arms"]); } if (parsed["locale"] != null) { TextToSpeechManager.Instance.SetLanguage(parsed["locale"]); Debug.Log(parsed["locale"]); } } catch (NullReferenceException e) { Debug.Log(e); } } //if (service.Equals(addCollisionPrimitiveService)) { // JSONNode node = JSONNode.Parse(yaml); // //Debug.Log(node); //} //if(service.Equals(deleteCollisionPrimitiveService)) { // JSONNode node = JSONNode.Parse(yaml); // //Debug.Log(node); //} //if (service.Equals(saveAllCollisionPrimitiveService)) { // JSONNode node = JSONNode.Parse(yaml); // //Debug.Log(node); //} //if (service.Equals(clearAllCollisionPrimitiveService)) { // JSONNode node = JSONNode.Parse(yaml); // //Debug.Log(node); //} //if (service.Equals(reloadAllCollisionPrimitiveService)) { // JSONNode node = JSONNode.Parse(yaml); // //Debug.Log(node); //} //if (service.Equals(robotLookAtLeftFeederService)) { // JSONNode node = JSONNode.Parse(yaml); // //Debug.Log(node); //} //if (service.Equals(robotLookAtRightFeederService)) { // JSONNode node = JSONNode.Parse(yaml); // //Debug.Log(node); //} }