4.6 Register Information
Overview
The Registers class provides a unified entry for host-side register access on the controller, supporting operations for multiple register types.
Core Features
- Read/write numeric registers (R)
- Read/write motion registers (MR)
- Read/write string registers (SR)
- Read/write pose registers (PR)
- Read/write Modbus registers (MH holding, MI input)
Use Cases
- Runtime parameter passing
- Robot state synchronization
- Configuration sharing with external systems
- Host-device interaction control
4.6.1 R Numeric Register Operations
4.6.1.1 Reading the Value of an R Register
| Method Name | Registers.Read_R(int index ) |
|---|---|
| Description | Reads the value of an R numeric register. |
| Request Parameters | index : int R register number to read |
| Return Value | double: Register value StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.6.0.1 Industrial robot: 7.6.0.0 |
4.6.1.2 Reading the Value of an R Register (with Metadata)
| Method Name | Registers.Read_R(int index , bool withMeta ) |
|---|---|
| Description | Reads the value of an R numeric register, with optional metadata (name/comment). |
| Request Parameters | index : int Register number to read withMeta : bool Whether to return metadata (returns register object when true) |
| Return Value | Register: Register object (id/name/comment/value) StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.7.0.0+ Industrial robot: 7.7.0.0+ |
4.6.1.3 Writing the Value of an R Register
| Method Name | Registers.Write_R(int index , double value ) |
|---|---|
| Description | Writes the value of an R numeric register. |
| Request Parameters | index : int Register number to write value : double Register numeric value to write |
| Return Value | StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.6.0.1 Industrial robot: 7.6.0.0 |
4.6.1.4 Writing an R Register with Metadata
| Method Name | Registers.Write_R(Register register ) |
|---|---|
| Description | Writes an R register using a Register object, including name and comment. |
| Request Parameters | register : Register object (id/name/comment/value) |
| Return Value | StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.7.0.0+ Industrial robot: 7.7.0.0+ |
4.6.1.5 Deleting an R Register
| Method Name | Registers.Delete_R(int index ) |
|---|---|
| Description | Deletes the specified R numeric register. |
| Request Parameters | index : int R register number to delete |
| Return Value | 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 RRegisterOperations
{
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] Set register index and value
int index = 1;
double value = 9.9;
// [ZH] 写入R寄存器
// [EN] Write R register
code = controller.Registers.Write_R(index, value);
if (code == StatusCode.OK)
{
Console.WriteLine("写入R寄存器成功/Write R Register Success");
}
else
{
Console.WriteLine($"写入R寄存器失败/Write R Register Failed: {code.GetDescription()}");
}
// [ZH] 读取R寄存器
// [EN] Read R register
double readValue;
(readValue, code) = controller.Registers.Read_R(index);
if (code == StatusCode.OK)
{
Console.WriteLine($"读取R寄存器成功/Read R Register Success: 值/Value = {readValue}");
}
else
{
Console.WriteLine($"读取R寄存器失败/Read R Register Failed: {code.GetDescription()}");
}
// [ZH] 删除R寄存器
// [EN] Delete R register
code = controller.Registers.Delete_R(index);
if (code == StatusCode.OK)
{
Console.WriteLine("删除R寄存器成功/Delete R Register Success");
}
else
{
Console.WriteLine($"删除R寄存器失败/Delete R Register 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.6.2 MR Motion Register Operations
4.6.2.1 Reading the Value of an MR Register
| Method Name | Registers.Read_MR(int index ) |
|---|---|
| Description | Reads the value of an MR motion register. |
| Request Parameters | index : int MR register number to read |
| Return Value | int: Register value StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.6.0.1 Industrial robot: 7.6.0.0 |
4.6.2.2 Reading the Value of an MR Register (with Metadata)
| Method Name | Registers.Read_MR(int index , bool withMeta ) |
|---|---|
| Description | Reads the value of an MR motion register, with optional metadata (name/comment). |
| Request Parameters | index : int Register number to read withMeta : bool Whether to return metadata (returns register object when true) |
| Return Value | MotionRegister: Register object (id/name/comment/value) StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.7.0.0+ Industrial robot: 7.7.0.0+ |
4.6.2.3 Writing the Value of an MR Register
| Method Name | Registers.Write_MR(int index , int value ) |
|---|---|
| Description | Writes the value of an MR motion register. |
| Request Parameters | index : int Register number to write value : int Register numeric value to write |
| Return Value | StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.6.0.1 Industrial robot: 7.6.0.0 |
4.6.2.4 Writing an MR Register with Metadata
| Method Name | Registers.Write_MR(MotionRegister register ) |
|---|---|
| Description | Writes an MR register using a MotionRegister object, including name and comment. |
| Request Parameters | register : MotionRegister object (id/name/comment/value) |
| Return Value | StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.7.0.0+ Industrial robot: 7.7.0.0+ |
4.6.2.5 Deleting an MR Register
| Method Name | Registers.Delete_MR(int index ) |
|---|---|
| Description | Deletes the specified MR motion register. |
| Request Parameters | index : int MR register number to delete |
| Return Value | 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 MRRegisterOperations
{
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] Set register index and value
int index = 1;
int value = 9;
// [ZH] 写入MR寄存器
// [EN] Write MR register
code = controller.Registers.Write_MR(index, value);
if (code == StatusCode.OK)
{
Console.WriteLine("写入MR寄存器成功/Write MR Register Success");
}
else
{
Console.WriteLine($"写入MR寄存器失败/Write MR Register Failed: {code.GetDescription()}");
}
// [ZH] 读取MR寄存器
// [EN] Read MR register
int readValue;
(readValue, code) = controller.Registers.Read_MR(index);
if (code == StatusCode.OK)
{
Console.WriteLine($"读取MR寄存器成功/Read MR Register Success: 值/Value = {readValue}");
}
else
{
Console.WriteLine($"读取MR寄存器失败/Read MR Register Failed: {code.GetDescription()}");
}
// [ZH] 删除MR寄存器
// [EN] Delete MR register
code = controller.Registers.Delete_MR(index);
if (code == StatusCode.OK)
{
Console.WriteLine("删除MR寄存器成功/Delete MR Register Success");
}
else
{
Console.WriteLine($"删除MR寄存器失败/Delete MR Register 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.6.3 SR String Register Operations
4.6.3.1 Reading the Value of an SR Register
| Method Name | Registers.Read_SR(int index ) |
|---|---|
| Description | Reads the value of an SR string register. |
| Request Parameters | index : int SR register number to read |
| Return Value | string: Register string value StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.6.0.1 Industrial robot: 7.6.0.0 |
4.6.3.2 Reading the Value of an SR Register (with Metadata)
| Method Name | Registers.Read_SR(int index , bool withMeta ) |
|---|---|
| Description | Reads the value of an SR string register, with optional metadata (name/comment). |
| Request Parameters | index : int Register number to read withMeta : bool Whether to return metadata (returns register object when true) |
| Return Value | StringRegister: Register object (id/name/comment/value) StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.7.0.0+ Industrial robot: 7.7.0.0+ |
4.6.3.3 Writing the Value of an SR Register
| Method Name | Registers.Write_SR(int index , string value ) |
|---|---|
| Description | Writes the value of an SR string register. |
| Request Parameters | index : int Register number to write value : string Register string value to write |
| Return Value | StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.6.0.1 Industrial robot: 7.6.0.0 |
4.6.3.4 Writing an SR Register with Metadata
| Method Name | Registers.Write_SR(StringRegister register ) |
|---|---|
| Description | Writes an SR register using a StringRegister object, including name and comment. |
| Request Parameters | register : StringRegister object (id/name/comment/value) |
| Return Value | StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.7.0.0+ Industrial robot: 7.7.0.0+ |
4.6.3.5 Deleting an SR Register
| Method Name | Registers.Delete_SR(int index ) |
|---|---|
| Description | Deletes the specified SR string register. |
| Request Parameters | index : int SR register number to delete |
| Return Value | 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 SRRegisterOperations
{
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] Set register index and value
int index = 1;
string value = "test";
// [ZH] 写入SR寄存器
// [EN] Write SR register
code = controller.Registers.Write_SR(index, value);
if (code == StatusCode.OK)
{
Console.WriteLine("写入SR寄存器成功/Write SR Register Success");
}
else
{
Console.WriteLine($"写入SR寄存器失败/Write SR Register Failed: {code.GetDescription()}");
}
// [ZH] 读取SR寄存器
// [EN] Read SR register
string readValue;
(readValue, code) = controller.Registers.Read_SR(index);
if (code == StatusCode.OK)
{
Console.WriteLine($"读取SR寄存器成功/Read SR Register Success: 值/Value = {readValue}");
}
else
{
Console.WriteLine($"读取SR寄存器失败/Read SR Register Failed: {code.GetDescription()}");
}
// [ZH] 删除SR寄存器
// [EN] Delete SR register
code = controller.Registers.Delete_SR(index);
if (code == StatusCode.OK)
{
Console.WriteLine("删除SR寄存器成功/Delete SR Register Success");
}
else
{
Console.WriteLine($"删除SR寄存器失败/Delete SR Register 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.6.4 PR Pose Register Operations
4.6.4.1 Reading the Value of a PR Register
| Method Name | Registers.Read_PR(int index ) |
|---|---|
| Description | Reads the value of a PR pose register. |
| Request Parameters | index : int PR register number to read |
| Return Value | PoseRegister: Pose data StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.6.0.1 Industrial robot: 7.6.0.0 |
4.6.4.2 Reading the Value of a PR Register (with Metadata)
| Method Name | Registers.Read_PR(int index , bool withMeta ) |
|---|---|
| Description | Reads the value of a PR pose register, with optional metadata (name/comment). |
| Request Parameters | index : int Register number to read withMeta : bool Whether to return metadata (includes name/comment when true) |
| Return Value | PoseRegister: Pose data (includes name/comment when withMeta=true) StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.7.0.0+ Industrial robot: 7.7.0.0+ |
4.6.4.3 Writing the Value of a PR Register
| Method Name | Registers.Write_PR(PoseRegister pose ) |
|---|---|
| Description | Writes the value of a PR pose register. |
| Request Parameters | pose : PoseRegister Pose data to write |
| Return Value | StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.6.0.1 Industrial robot: 7.6.0.0 |
4.6.4.4 Writing a PR Register with Metadata
| Method Name | Registers.Write_PR(PoseRegister pose , bool withMeta ) |
|---|---|
| Description | Writes the value of a PR pose register, with control over whether to write metadata (name/comment). |
| Request Parameters | pose : PoseRegister Pose data to write withMeta : bool Whether to write metadata (writes name/comment when true) |
| Return Value | StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.7.0.0+ Industrial robot: 7.7.0.0+ |
4.6.4.5 Deleting a PR Register
| Method Name | Registers.Delete_PR(int index ) |
|---|---|
| Description | Deletes the specified PR pose register. |
| Request Parameters | index : int PR register number to delete |
| Return Value | 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.Registers;
using Agilebot.IR.Types;
public class PRRegisterOperations
{
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] Set register index
int index = 1;
// [ZH] 生成位姿寄存器
// [EN] Generate pose register
var pose = new PoseRegister
{
Id = 1,
Name = "Test",
Comment = "Test",
PoseRegisterData = new PoseRegisterData
{
Pt = PoseType.Joint,
Joint = new Joint
{
J1 = 6.6,
J2 = 6.6,
J3 = 6.6,
J4 = 6.6,
J5 = 6.6,
J6 = 6.6,
},
CartData = null,
},
};
// [ZH] 写入PR寄存器
// [EN] Write PR register
code = controller.Registers.Write_PR(pose);
if (code == StatusCode.OK)
{
Console.WriteLine("写入PR寄存器成功/Write PR Register Success");
}
else
{
Console.WriteLine($"写入PR寄存器失败/Write PR Register Failed: {code.GetDescription()}");
}
// [ZH] 读取PR寄存器
// [EN] Read PR register
PoseRegister readValue;
(readValue, code) = controller.Registers.Read_PR(index);
if (code == StatusCode.OK)
{
Console.WriteLine($"读取PR寄存器成功/Read PR Register Success: ID = {readValue.Id}");
}
else
{
Console.WriteLine($"读取PR寄存器失败/Read PR Register Failed: {code.GetDescription()}");
}
// [ZH] 删除PR寄存器
// [EN] Delete PR register
code = controller.Registers.Delete_PR(index);
if (code == StatusCode.OK)
{
Console.WriteLine("删除PR寄存器成功/Delete PR Register Success");
}
else
{
Console.WriteLine($"删除PR寄存器失败/Delete PR Register 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.6.5 Modbus Registers (MH Holding Registers, MI Input Registers)
4.6.5.1 Reading the Value of an MH Register
| Method Name | Registers.Read_MH(int index ) |
|---|---|
| Description | Reads the value of an MH holding register. |
| Request Parameters | index : int Register number to read |
| Return Value | int: Register value StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.6.0.0 Industrial robot: 7.6.0.0 |
4.6.5.2 Reading the Value of an MI Register
| Method Name | Registers.Read_MI(int index ) |
|---|---|
| Description | Reads the value of an MI input register. |
| Request Parameters | index : int Register number to read |
| Return Value | int: Register value StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.6.0.0 Industrial robot: 7.6.0.0 |
4.6.5.3 Writing the Value of an MH Register
| Method Name | Registers.Write_MH(int index , int value ) |
|---|---|
| Description | Writes the value of an MH holding register. |
| Request Parameters | index : int Register number to write value : int Register numeric value to write |
| Return Value | StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.6.0.0 Industrial robot: 7.6.0.0 |
4.6.5.4 Writing the Value of an MI Register
| Method Name | Registers.Write_MI(int index , int value ) |
|---|---|
| Description | Writes the value of an MI input register. |
| Request Parameters | index : int Register number to write value : int Register numeric value to write |
| Return Value | StatusCode: Operation execution result |
| Compatible robot software version | Collaborative robot: 7.6.0.0 Industrial robot: 7.6.0.0 |
Example Code
cs
using Agilebot.IR;
using Agilebot.IR.Types;
public class ModbusRegisterOperations
{
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] Set register index and value
int index = 1;
int writeValue = 8;
// [ZH] 写入MH保持寄存器
// [EN] Write MH holding register
code = controller.Registers.Write_MH(index, writeValue);
if (code == StatusCode.OK)
{
Console.WriteLine("写入MH保持寄存器成功/Write MH Holding Register Success");
}
else
{
Console.WriteLine($"写入MH保持寄存器失败/Write MH Holding Register Failed: {code.GetDescription()}");
}
// [ZH] 写入MI输入寄存器
// [EN] Write MI input register
code = controller.Registers.Write_MI(index, writeValue + 1);
if (code == StatusCode.OK)
{
Console.WriteLine("写入MI输入寄存器成功/Write MI Input Register Success");
}
else
{
Console.WriteLine($"写入MI输入寄存器失败/Write MI Input Register Failed: {code.GetDescription()}");
}
// [ZH] 读取MH保持寄存器
// [EN] Read MH holding register
int mhValue;
(mhValue, code) = controller.Registers.Read_MH(index);
if (code == StatusCode.OK)
{
Console.WriteLine($"读取MH保持寄存器成功/Read MH Holding Register Success: 值/Value = {mhValue}");
}
else
{
Console.WriteLine($"读取MH保持寄存器失败/Read MH Holding Register Failed: {code.GetDescription()}");
}
// [ZH] 读取MI输入寄存器
// [EN] Read MI input register
int miValue;
(miValue, code) = controller.Registers.Read_MI(index);
if (code == StatusCode.OK)
{
Console.WriteLine($"读取MI输入寄存器成功/Read MI Input Register Success: 值/Value = {miValue}");
}
else
{
Console.WriteLine($"读取MI输入寄存器失败/Read MI Input Register 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;
}
}