Skip to content

4.8 알람 정보

개요

Alarm 모듈은 로봇 작동 중에 발생할 수 있는 비정상적인 상황을 모니터링하고 처리하는 데 사용되는 로봇 알람 정보에 대한 읽기, 재설정 및 쿼리 기능을 제공합니다.

핵심 기능

  • 알람 재설정
  • 모든 활성 알람 가져오기
  • 우선순위가 가장 높은 알람 받기

사용 사례

  • 로봇 작동 상태를 모니터링하고 적시에 이상 징후를 감지
  • 로봇 작동 중 오류 및 알람 처리
  • 로봇 알람 이력 기록 및 분석
  • 자동화된 경보 처리 워크플로 구현
  • 로봇 모니터링 시스템에 통합

4.8.1 최우선 순위 알람 받기

메서드 이름Alarm.GetTopAlarm()
설명현재 가장 높은 우선순위 경보를 가져옵니다.
요청 매개변수없음
반환 값string: 알람 정보 문자열
StatusCode: 연산 실행 결과
호환 로봇 소프트웨어 버전협업(Copper): v7.5.0.0+
산업용(Bronze): v7.5.0.0+

예제 코드

Alarm/GetTopAlarm.cs
cs
using Agilebot.IR;
using Agilebot.IR.Types;

public class GetTopAlarm
{
    public static StatusCode Run(string controllerIP, bool useLocalProxy = true)
    {
        // [ZH] 初始化捷勃特机器人
        // [EN] Initialize the Agilebot robot
        Arm controller = new Arm(controllerIP, useLocalProxy);

        // [ZH] 连接捷勃特机器人
        // [EN] Connect to the Agilebot robot
        StatusCode code = controller.ConnectSync();
        Console.WriteLine(code != StatusCode.OK ? code.GetDescription() : "连接成功/Successfully connected.");

        if (code != StatusCode.OK)
        {
            return code;
        }

        try
        {
            // [ZH] 获取最严重的一条报警
            // [EN] Get the most severe alarm
            string topError;
            (topError, code) = controller.Alarm.GetTopAlarm();
            if (code == StatusCode.OK)
            {
                Console.WriteLine("获取最严重报警成功/Get Top Alarm Success");
                if (string.IsNullOrEmpty(topError))
                {
                    Console.WriteLine("当前无报警/No current alarms");
                }
                else
                {
                    Console.WriteLine($"最严重报警/Most Severe Alarm: {topError}");
                }
            }
            else
            {
                Console.WriteLine($"获取最严重报警失败/Get Top Alarm Failed: {code.GetDescription()}");
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine($"执行过程中发生异常/Exception occurred during execution: {ex.Message}");
            code = StatusCode.OtherReason;
        }
        finally
        {
            // [ZH] 关闭连接
            // [EN] Close the connection
            StatusCode disconnectCode = controller.Disconnect();
            if (disconnectCode != StatusCode.OK)
            {
                Console.WriteLine(disconnectCode.GetDescription());
                if (code == StatusCode.OK)
                    code = disconnectCode;
            }
        }

        return code;
    }
}

4.8.2 모든 활성 경보 가져오기

메서드 이름Alarm.GetAllActiveAlarms()
설명현재 활성화된 모든 알람을 가져옵니다.
요청 매개변수없음
반환 값List<string>: 활성 알람 항목 목록
StatusCode: 작업 실행 결과
호환 로봇 소프트웨어 버전협업(Copper): v7.5.0.0+
산업용(Bronze): v7.5.0.0+

예제 코드

Alarm/GetAllActiveAlarms.cs
cs
using Agilebot.IR;
using Agilebot.IR.Types;

public class GetAllActiveAlarms
{
    public static StatusCode Run(string controllerIP, bool useLocalProxy = true)
    {
        // [ZH] 初始化捷勃特机器人
        // [EN] Initialize the Agilebot robot
        Arm controller = new Arm(controllerIP, useLocalProxy);

        // [ZH] 连接捷勃特机器人
        // [EN] Connect to the Agilebot robot
        StatusCode code = controller.ConnectSync();
        Console.WriteLine(code != StatusCode.OK ? code.GetDescription() : "连接成功/Successfully connected.");

        if (code != StatusCode.OK)
        {
            return code;
        }

        try
        {
            // [ZH] 获取所有的活动的报警
            // [EN] Get all active alarms
            List<string> errors;
            (errors, code) = controller.Alarm.GetAllActiveAlarms();
            if (code == StatusCode.OK)
            {
                Console.WriteLine("获取所有活动报警成功/Get All Active Alarm Success");
                Console.WriteLine($"活动报警数量/Active Alarm Count: {errors.Count}");

                if (errors.Count == 0)
                {
                    Console.WriteLine("当前无活动报警/No active alarms");
                }
                else
                {
                    Console.WriteLine("活动报警列表/Active Alarm List:");
                    for (int i = 0; i < errors.Count; i++)
                    {
                        Console.WriteLine($"  {i + 1}. {errors[i]}");
                    }
                }
            }
            else
            {
                Console.WriteLine($"获取所有活动报警失败/Get All Active Alarm Failed: {code.GetDescription()}");
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine($"执行过程中发生异常/Exception occurred during execution: {ex.Message}");
            code = StatusCode.OtherReason;
        }
        finally
        {
            // [ZH] 关闭连接
            // [EN] Close the connection
            StatusCode disconnectCode = controller.Disconnect();
            if (disconnectCode != StatusCode.OK)
            {
                Console.WriteLine(disconnectCode.GetDescription());
                if (code == StatusCode.OK)
                    code = disconnectCode;
            }
        }

        return code;
    }
}

4.8.3 알람 재설정

메서드 이름Alarm.ResetAlarms()
설명현재 오류를 재설정합니다./alarms.
요청 매개변수없음
반환 값StatusCode: 작업 실행 결과
호환 로봇 소프트웨어 버전협업(Copper): v7.5.0.0+
산업용(Bronze): v7.5.0.0+