public Character(int id, IAccountManager accountManager, Lazy <IZoneManager> zoneManager, DockingBaseHelper dockingBaseHelper, RobotHelper robotHelper, ICharacterTransactionLogger transactionLogger, ICharacterExtensions characterExtensions, IExtensionReader extensionReader, ISocialService socialService, ICorporationManager corporationManager, ITechTreeService techTreeService, IGangManager gangManager, CharacterWalletHelper walletHelper) { _accountManager = accountManager; _zoneManager = zoneManager; _dockingBaseHelper = dockingBaseHelper; _robotHelper = robotHelper; _transactionLogger = transactionLogger; _characterExtensions = characterExtensions; _extensionReader = extensionReader; _socialService = socialService; _corporationManager = corporationManager; _techTreeService = techTreeService; _gangManager = gangManager; _walletHelper = walletHelper; if (id <= 0) { id = 0; } Id = id; }
/// <summary> /// Access a single bit of the input. /// </summary> /// <param name="bit">index of the bit to access [0..3]</param> /// <returns>TRUE if the bit is 1, FALSE if the bit is 0</returns> public virtual bool this[int bit] { get { return(RobotHelper.GetBitFromInteger(this.Data, bit)); } }
private void ProcessRedisQueue(RedisNode node) { using var span = _tracer?.NewSpan($"Alarm:{nameof(RedisMessageQueue)}"); // 所有队列 var list = RedisMessageQueue.FindAllByRedisId(node.Id); foreach (var queue in list) { var groupName = !queue.Category.IsNullOrEmpty() ? queue.Category : node.Category; var webhook = !queue.WebHook.IsNullOrEmpty() ? queue.WebHook : node.WebHook; // 判断告警 if (queue.Enable && queue.MaxMessages > 0 && queue.Messages >= queue.MaxMessages && RobotHelper.CanAlarm(groupName, webhook)) { // 一定时间内不要重复报错,除非错误翻倍 var error2 = _cache.Get <Int32>("alarm:RedisMessageQueue:" + queue.Id); if (error2 == 0 || queue.Messages > error2 * 2) { _cache.Set("alarm:RedisMessageQueue:" + queue.Id, queue.Messages, 5 * 60); var msg = GetMarkdown(node, queue, true); RobotHelper.SendAlarm(groupName, webhook, "消息队列告警", msg); } } } }
/// <summary> /// Run method of the background pulling thread to check the input port of the /// robot. The robot does not support interrupts (-.-), so a stupid polling is needed. /// </summary> private void Run() { int oldData = -1; int newData; run = true; while (run) { newData = this.Data; if (oldData != newData) { for (int i = 0; i < 4; i++) { bool oldBit = RobotHelper.GetBitFromInteger(oldData, i); bool newBit = RobotHelper.GetBitFromInteger(newData, i); if (oldBit != newBit) { this.OnDigitalInChanged(new SwitchEventArgs((Switches)i, newBit)); } } } oldData = newData; Thread.Sleep(50); } }
private async void DoWork(object state) { _timer?.Change(Timeout.Infinite, 0); _logger.LogDebug("服务开始工作……"); stopwatch.Restart(); await RobotHelper.Send(robotSetting, _logger); stopwatch.Stop(); _logger.LogDebug($"------------------总耗时:{(double)stopwatch.ElapsedMilliseconds/1000}秒---------------"); _timer?.Change(TimeSpan.FromMilliseconds(robotSetting.PollingTime), TimeSpan.Zero); }
/// <summary> /// Access a single bit of the output. /// </summary> /// /// <param name="bit">index of the bit to access [0..3]</param> /// <returns>TRUE if the bit is 1, FALSE if the bit is 0</returns> public virtual bool this[int bit] { get { return(RobotHelper.GetBitFromInteger(data, bit)); } set { this.Data = RobotHelper.SetBitOfInteger(data, bit, value); } }
private void PlayErrorSound() { if (InteractiveProgrammingManager.Instance.CurrentState == InteractiveProgrammingManager.ProgrammingManagerState.place_to_pose_learn || InteractiveProgrammingManager.Instance.CurrentState == InteractiveProgrammingManager.ProgrammingManagerState.place_to_pose_learn_followed) { if (object_attached && !RobotHelper.IsObjectWithinRobotArmRadius(Arm, world_anchor.transform.InverseTransformPoint(transform.position))) { UISoundManager.Instance.PlayError(); } } }
private void Update() { if (RobotHelper.IsObjectWithinRobotArmRadius(Arm, world_anchor.transform.InverseTransformPoint(transform.position)) && RobotHelper.IsObjectOnTable(world_anchor.transform.InverseTransformPoint(transform.position))) { material.SetColor("_Color", basic); } else { material.SetColor("_Color", red); } }
public void Visualize() { if (ProgramHelper.ItemLearned(programItemMsg)) { Debug.Log("Visualizing PICK_FROM_FEEDER"); //if (objectToPickUnmanipulatable != null) // Destroy(objectToPickUnmanipulatable); //convert ros coordinate system to unity coordinate system Vector3 robotArmPosition = ROSUnityCoordSystemTransformer.ConvertVector(programItemMsg.GetPose()[0].GetPose().GetPosition().GetPoint()); Quaternion robotArmRotation = ROSUnityCoordSystemTransformer.ConvertQuaternion(programItemMsg.GetPose()[0].GetPose().GetOrientation().GetQuaternion()); //show robot arm only if it's not grasping object if (!RobotHelper.HasArmGraspedObject(robotArmPosition.x > MainMenuManager.Instance.currentSetup.GetTableWidth() / 2f ? RobotHelper.RobotArmType.LEFT_ARM : RobotHelper.RobotArmType.RIGHT_ARM)) { robotArm.transform.localPosition = robotArmPosition; robotArm.transform.localRotation = robotArmRotation; robotArm.GetComponent <PR2GripperController>().SetArmActive(true); robotArm.GetComponent <PR2GripperController>().CloseGripperInstantly(); } Vector3 objectPosition = FakeFeederObjectsPositions.GetObjectPositionInFeeder(programItemMsg.GetObject()[0], (robotArmPosition.x > MainMenuManager.Instance.currentSetup.GetTableWidth() / 2f ? FakeFeederObjectsPositions.FeederType.right_feeder : FakeFeederObjectsPositions.FeederType.left_feeder)); Quaternion objectOrientation = FakeFeederObjectsPositions.GetObjectOrientationInFeeder(programItemMsg.GetObject()[0], (robotArmPosition.x > MainMenuManager.Instance.currentSetup.GetTableWidth() / 2f ? FakeFeederObjectsPositions.FeederType.right_feeder : FakeFeederObjectsPositions.FeederType.left_feeder)); Vector3 objectDims = ObjectsManager.Instance.GetObjectTypeDimensions(programItemMsg.GetObject()[0]); //objectToPickUnmanipulatable = Instantiate(BasicObjectUnmanipulatablePrefab, world_anchor.transform); //objectToPickUnmanipulatable.transform.localPosition = ROSUnityCoordSystemTransformer.ConvertVector(objectPosition); //objectToPickUnmanipulatable.transform.localRotation = ROSUnityCoordSystemTransformer.ConvertQuaternion(objectOrientation); //objectToPickUnmanipulatable.transform.GetChild(0).transform.localScale = objectDims; Debug.Log("BEFORE INSTANTIATING"); if (objectToPick == null || objectToPick.Equals(null)) { Debug.Log("INSTANTIATING"); objectToPick = Instantiate(BasicObjectManipulatablePrefab, world_anchor.transform); } objectToPick.GetComponent <ObjectManipulationEnabler>().DisableManipulation(); objectToPick.transform.localPosition = ROSUnityCoordSystemTransformer.ConvertVector(objectPosition); objectToPick.transform.localRotation = ROSUnityCoordSystemTransformer.ConvertQuaternion(objectOrientation); objectToPick.transform.GetChild(0).transform.localScale = objectDims; } }
public void IndicateRobotReachability(bool active) { if (active) { Vector3 arm_position_in_world = world_anchor.transform.InverseTransformPoint(robotArm.transform.position); //Debug.Log(arm_position_in_world); if (RobotHelper.IsArmAboveTable(arm_position_in_world)) { robotArm.GetComponent <PR2GripperController>().MaterialColorToGreen(); } else { robotArm.GetComponent <PR2GripperController>().MaterialColorToRed(); } } else { robotArm.GetComponent <PR2GripperController>().MaterialColorToDefault(); } }
private void ProcessAppTracer(AppTracer app) { // 应用是否需要告警 if (app == null || !app.Enable || app.AlarmThreshold <= 0) { return; } var appId = app.ID; if (!RobotHelper.CanAlarm(app.Category, app.AlarmRobot)) { return; } using var span = _tracer?.NewSpan($"Alarm:{nameof(AppTracer)}"); // 最近一段时间的5分钟级数据 var time = DateTime.Now; var minute = time.Date.AddHours(time.Hour).AddMinutes(time.Minute / 5 * 5); var st = AppMinuteStat.FindByAppIdAndTime(appId, minute); if (st == null) { return; } // 判断告警 if (st.Errors >= app.AlarmThreshold) { // 一定时间内不要重复报错,除非错误翻倍 var error2 = _cache.Get <Int32>("alarm:AppTracer:" + appId); if (error2 == 0 || st.Errors > error2 * 2) { _cache.Set("alarm:AppTracer:" + appId, st.Errors, 5 * 60); var msg = GetMarkdown(app, st, true); RobotHelper.SendAlarm(app.Category, app.AlarmRobot, "系统告警", msg); } } }
//called whenever user clicks on the table in order to place virtual object private void PlaceObject() { if (InteractiveProgrammingManager.Instance.CurrentState == InteractiveProgrammingManager.ProgrammingManagerState.place_to_pose_learn || InteractiveProgrammingManager.Instance.CurrentState == InteractiveProgrammingManager.ProgrammingManagerState.place_to_pose_learn_followed) { if (object_attached && RobotHelper.IsObjectWithinRobotArmRadius(Arm, world_anchor.transform.InverseTransformPoint(transform.position))) { UISoundManager.Instance.PlayPlace(); object_attached = false; //transform.parent = world_anchor.transform; transform.SetParent(world_anchor.transform, true); transform.GetChild(0).GetComponent <Collider>().enabled = true; transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, transform.GetChild(0).localScale.x / 2); EnableRotation(); } } }
public void RobotMoveTest() { var startPoint = new SimulationPoint(0.0, 0.0, -90.0); var geometry = new RobotGeometry(124.0, 66.4 / 2.0, 20); var m0 = RobotHelper.CalculateMovement(new SimulationPoint(0.0, 0.0, 0.0), 2.0, 2.0, geometry); var m1 = RobotHelper.CalculateMovement(new SimulationPoint(0.0, 0.0, 90.0), 2.0, 2.0, geometry); var m2 = RobotHelper.CalculateMovement(new SimulationPoint(0.0, 0.0, 180.0), 2.0, 2.0, geometry); var m3 = RobotHelper.CalculateMovement(new SimulationPoint(0.0, 0.0, 270.0), 2.0, 2.0, geometry); var m4 = RobotHelper.CalculateMovement(new SimulationPoint(0.0, 0.0, -90.0), 2.0, 2.0, geometry); var m5 = RobotHelper.CalculateMovement(new SimulationPoint(0.0, 0.0, -180.0), 2.0, 2.0, geometry); var m6 = RobotHelper.CalculateMovement(new SimulationPoint(0.0, 0.0, -270.0), 2.0, 2.0, geometry); var m7 = RobotHelper.CalculateMovement(new SimulationPoint(0.0, 0.0, 45.0), 2.0, 2.0, geometry); var m8 = RobotHelper.CalculateMovement(new SimulationPoint(0.0, 0.0, -45.0), 2.0, 2.0, geometry); var m9 = RobotHelper.CalculateMovement(new SimulationPoint(0.0, 0.0, -90.0), 0.0, 2.0, geometry); var movementEx1 = RobotHelper.CalculateMovement(startPoint, 2.0, 2.0, geometry); var movementEx2 = RobotHelper.CalculateMovement(startPoint, 1.999999, 2.0, geometry); var movementEx3 = RobotHelper.CalculateMovement(startPoint, 2.0, 1.999999, geometry); }
public ChangeAmmo(IEntityRepository entityRepository, RobotHelper robotHelper) { _entityRepository = entityRepository; _robotHelper = robotHelper; }
public new static void CallBack(ROSBridgeMsg msg) { TFSubscriptionActionFeedbackMsg TFmsg = (TFSubscriptionActionFeedbackMsg)msg; RobotHelper.SetTF2Feedback(TFmsg); }
public new static void CallBack(ROSBridgeMsg msg) { ObjInstanceMsg OImsg = (ObjInstanceMsg)msg; RobotHelper.SetRightArmGraspedObject(OImsg); }
private void SendAlarm(String kind, Node node, NodeData data, String title, String info = null) { var msg = GetMarkdown(kind, node, data, title, info); RobotHelper.SendAlarm(node.Category, node.WebHook, title, msg); }
public FittingPresetApply(IEntityRepository entityRepository, RobotHelper robotHelper) { _entityRepository = entityRepository; _robotHelper = robotHelper; }
public ChangeModule(RobotHelper robotHelper) { _robotHelper = robotHelper; }
public RemoveModule(IEntityRepository entityRepository, RobotHelper robotHelper) { _entityRepository = entityRepository; _robotHelper = robotHelper; }
public Paint(RobotHelper helper) { this._robotHelper = helper; }
private void ProcessRedisData(RedisNode node) { if (!RobotHelper.CanAlarm(node.Category, node.WebHook)) { return; } if (node.AlarmMemoryRate <= 0 || node.AlarmConnections == 0) { return; } // 最新数据 var data = RedisData.FindLast(node.Id); if (data == null) { return; } using var span = _tracer?.NewSpan($"Alarm:{nameof(RedisNode)}"); var actions = new List <Action <StringBuilder> >(); // 内存告警 var rate = data.UsedMemory * 100 / node.MaxMemory; if (rate >= node.AlarmMemoryRate) { // 一定时间内不要重复报错,除非错误翻倍 var error2 = _cache.Get <Int32>("alarm:RedisMemory:" + node.Id); if (error2 == 0 || rate > error2 * 2) { _cache.Set("alarm:RedisMemory:" + node.Id, rate, 5 * 60); actions.Add(sb => sb.AppendLine($">**内存告警:**<font color=\"info\">{rate / 100:p0} >= {node.AlarmMemoryRate / 100:p0}</font>")); } } // 连接数告警 var cs = data.ConnectedClients; if (node.AlarmConnections > 0 && cs >= node.AlarmConnections) { // 一定时间内不要重复报错,除非错误翻倍 var error2 = _cache.Get <Int32>("alarm:RedisConnections:" + node.Id); if (error2 == 0 || cs > error2 * 2) { _cache.Set("alarm:RedisConnections:" + node.Id, cs, 5 * 60); actions.Add(sb => sb.AppendLine($">**连接数告警:**<font color=\"info\">{cs:n0} >= {node.AlarmConnections:n0}</font>")); } } // 速度告警 var speed = data.Speed; if (node.AlarmSpeed > 0 && speed >= node.AlarmSpeed) { // 一定时间内不要重复报错,除非错误翻倍 var error2 = _cache.Get <Int32>("alarm:RedisSpeed:" + node.Id); if (error2 == 0 || speed > error2 * 2) { _cache.Set("alarm:RedisSpeed:" + node.Id, speed, 5 * 60); actions.Add(sb => sb.AppendLine($">**速度告警:**<font color=\"info\">{speed:n0} >= {node.AlarmSpeed:n0}</font>")); } } // 入流量告警 var input = data.InputKbps; if (node.AlarmInputKbps > 0 && input >= node.AlarmInputKbps) { // 一定时间内不要重复报错,除非错误翻倍 var error2 = _cache.Get <Int32>("alarm:RedisInputKbps:" + node.Id); if (error2 == 0 || input > error2 * 2) { _cache.Set("alarm:RedisInputKbps:" + node.Id, input, 5 * 60); actions.Add(sb => sb.AppendLine($">**入流量告警:**<font color=\"info\">{input:n0} >= {node.AlarmInputKbps:n0}</font>")); } } // 出流量告警 var output = data.OutputKbps; if (node.AlarmOutputKbps > 0 && output >= node.AlarmOutputKbps) { // 一定时间内不要重复报错,除非错误翻倍 var error2 = _cache.Get <Int32>("alarm:RedisOutputKbps:" + node.Id); if (error2 == 0 || output > error2 * 2) { _cache.Set("alarm:RedisOutputKbps:" + node.Id, output, 5 * 60); actions.Add(sb => sb.AppendLine($">**出流量告警:**<font color=\"info\">{output:n0} >= {node.AlarmOutputKbps:n0}</font>")); } } if (actions.Count > 0) { var msg = GetMarkdown(node, data, "Redis告警", actions); RobotHelper.SendAlarm(node.Category, node.WebHook, "Redis告警", msg); } }
public GetRobotInfo(IZoneManager zoneManager, RobotHelper robotHelper) { _zoneManager = zoneManager; _robotHelper = robotHelper; }
//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); //} }
public RobotBuilder WithHead() { _robot.Head = RobotHelper.CreadDefaultHead(); return(this); }
public RobotBuilder WithRightArm() { _robot.RightArm = RobotHelper.CreateDefaultArm(); return(this); }
// Update is called once per frame void Update() { if (ROSCommunicationManager.Instance.connectedToROS) { if (!languageCalled) { TextToSpeechManager.Instance.LoadLanguage(); languageCalled = true; } if (!ntpTimeSet) { ntpTimeSet = true; UnbiasedTime.Init(MainMenuManager.Instance.currentSetup.GetIP()); } //Load known object types from database if (!ObjectsManager.Instance.objectReloadInitiated) { ObjectsManager.Instance.ReloadObjectTypes(); ObjectsManager.Instance.objectReloadInitiated = true; } if (!ObjectsManager.Instance.objectTypesLoaded) { return; } //wait until time synchronizes with ntp if (!UnbiasedTime.Instance.TimeSynchronized) { //Debug.Log("TIME STILL NOT SYNCHRONIZED"); return; } //Load robot reach radius if (!robotRadiusCalled) { robotRadiusCalled = true; RobotHelper.LoadRobotRadius(); RobotHelper.LoadTableSize(); } if (!TextToSpeechManager.Instance.languageSet) { return; } #if UNITY_EDITOR if (!calibrated) { calibrated = true; //StartCoroutine(startFakeCalibration()); //GameObject super_root = new GameObject("super_root"); //super_root.transform.position = Vector3.zero; //worldAnchor.transform.parent = super_root.transform; //super_root.transform.eulerAngles = new Vector3(-90f, 0f, 0f); worldAnchor.transform.eulerAngles = new Vector3(-90f, 20f, 0f); //worldAnchor.transform.Rotate(180f, 0f, 0f, Space.Self); worldAnchorVisualizationCube.gameObject.SetActive(true); worldAnchorRecalibrationButton.gameObject.SetActive(true); if (OnSystemStarted != null) { OnSystemStarted(); } } #endif #if !UNITY_EDITOR if (!anchorLoaded && !calibrated && !calibration_launched && (WorldAnchorManager.Instance.AnchorStore != null)) { string[] ids = WorldAnchorManager.Instance.AnchorStore.GetAllIds(); //world anchor is present if (ids.Length == 1) { //attaching an existing anchor name will load it instead WorldAnchorManager.Instance.AttachAnchor(worldAnchor.gameObject, ids[0]); worldAnchorVisualizationCube.gameObject.SetActive(true); worldAnchorRecalibrationButton.gameObject.SetActive(true); //helpAnchorVisualizationCube.gameObject.SetActive(false); anchorLoaded = true; calibrated = true; if (OnSystemStarted != null) { OnSystemStarted(); } } else { StartCoroutine(startCalibration()); calibration_launched = true; } } #endif } }
private void ProcessNode(Node node) { if (node == null || !node.Enable || !RobotHelper.CanAlarm(node.Category, node.WebHook)) { return; } if (node.AlarmCpuRate <= 0 && node.AlarmMemoryRate <= 0 && node.AlarmDiskRate <= 0 && node.AlarmProcesses.IsNullOrEmpty()) { return; } using var span = _tracer?.NewSpan($"Alarm:{nameof(Node)}"); // 最新数据 var data = NodeData.FindLast(node.ID); if (data == null) { return; } // CPU告警 if (node.AlarmCpuRate > 0) { var rate = data.CpuRate * 100; if (rate >= node.AlarmCpuRate) { // 一定时间内不要重复报错,除非错误翻倍 var error2 = _cache.Get <Int32>("alarm:CpuRate:" + node.ID); if (error2 == 0 || rate > error2 * 2) { _cache.Set("alarm:CpuRate:" + node.ID, rate, 5 * 60); SendAlarm("cpu", node, data, $"[{node.Name}]CPU告警"); } } } // 内存告警 if (node.AlarmMemoryRate > 0 && node.Memory > 0) { var rate = (node.Memory - data.AvailableMemory) * 100d / node.Memory; if (rate >= node.AlarmMemoryRate) { // 一定时间内不要重复报错,除非错误翻倍 var error2 = _cache.Get <Int32>("alarm:MemoryRate:" + node.ID); if (error2 == 0 || rate > error2 * 2) { _cache.Set("alarm:MemoryRate:" + node.ID, rate, 5 * 60); SendAlarm("memory", node, data, $"[{node.Name}]内存告警"); } } } // 磁盘告警 if (node.AlarmDiskRate > 0 && node.TotalSize > 0) { var rate = (node.TotalSize - data.AvailableFreeSpace) * 100d / node.TotalSize; if (rate >= node.AlarmDiskRate) { // 一定时间内不要重复报错,除非错误翻倍 var error2 = _cache.Get <Int32>("alarm:DiskRate:" + node.ID); if (error2 == 0 || rate > error2 * 2) { _cache.Set("alarm:DiskRate:" + node.ID, rate, 5 * 60); SendAlarm("disk", node, data, $"[{node.Name}]磁盘告警"); } } } // TCP告警 if (node.AlarmTcp > 0) { var tcp = data.TcpConnections; if (tcp < data.TcpTimeWait) { tcp = data.TcpTimeWait; } if (tcp < data.TcpCloseWait) { tcp = data.TcpCloseWait; } if (tcp >= node.AlarmTcp) { // 一定时间内不要重复报错,除非错误翻倍 var error2 = _cache.Get <Int32>("alarm:Tcp:" + node.ID); if (error2 == 0 || tcp > error2 * 2) { _cache.Set("alarm:Tcp:" + node.ID, tcp, 5 * 60); SendAlarm("tcp", node, data, $"[{node.Name}]Tcp告警"); } } } // 进程告警 if (!node.AlarmProcesses.IsNullOrEmpty() && !data.Data.IsNullOrEmpty()) { var alarms = node.AlarmProcesses.Split(",", StringSplitOptions.RemoveEmptyEntries); var dic = JsonParser.Decode(data.Data); var ps = (dic["Processes"] as String)?.Split(",", StringSplitOptions.RemoveEmptyEntries); if (alarms != null && alarms.Length > 0 && ps != null && ps.Length > 0) { // 查找丢失的进程 var ps2 = alarms.Where(e => !ps.Contains(e)).ToList(); if (ps2.Count > 0) { // 一定时间内不要重复报错 var error2 = _cache.Get <Int32>("alarm:Process:" + node.ID); if (error2 == 0 || ps2.Count > error2) { _cache.Set("alarm:Process:" + node.ID, ps2.Count, 5 * 60); SendAlarm("process", node, data, $"[{node.Name}]进程守护告警", ps2.Join()); } } } } }
public EquipAmmo(IEntityRepository entityRepository, RobotHelper robotHelper) { _entityRepository = entityRepository; _robotHelper = robotHelper; }
public SelectActiveRobot(IEntityRepository entityRepository, RobotHelper robotHelper) { _entityRepository = entityRepository; _robotHelper = robotHelper; }