4.8 Alarm Information
Overview
The Alarm module provides reading, reset, and query capabilities for robot alarm information, used for monitoring and handling abnormal situations that may occur during robot operation.
Core Features
- Reset alarms
- Get all active alarms
- Get highest-priority alarm
Use Cases
- Monitor robot operating status and detect abnormalities in a timely manner
- Handle errors and alarms during robot operation
- Record and analyze robot alarm history
- Implement automated alarm processing workflows
- Integrate into robot monitoring systems
4.8.1 Getting the Highest Priority Alarm
| Method Name | Alarm.GetTopAlarm() |
|---|---|
| Description | Gets the current highest priority alarm. |
| Request Parameters | None |
| Return Value | string: Alarm information string StatusCode: Operation execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
Example Code
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 Getting All Active Alarms
| Method Name | Alarm.GetAllActiveAlarms() |
|---|---|
| Description | Gets all currently active alarms. |
| Request Parameters | None |
| Return Value | List<string>: Active alarm entry list StatusCode: Operation execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |
Example Code
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 Resetting Alarms
| Method Name | Alarm.ResetAlarms() |
|---|---|
| Description | Resets current errors/alarms. |
| Request Parameters | None |
| Return Value | StatusCode: Operation execution result |
| Compatible robot software version | Collaborative (Copper): v7.5.0.0+ Industrial (Bronze): v7.5.0.0+ |