• 通讯文档
  • Sdk接口

Api_V1

  • 初始化Sdk库和对应参数文件
  • 连接轴
  • 设置异常生成机制
  • 断开轴
  • 读取当前控制器版本
  • 读取物理IO口数量
  • 读取控制器可用逻辑IO信号
  • 操作逻辑IO信号
  • 操作逻辑IO信号对物理IO映射
  • 设置直接运动规划器参数
  • 移动到位置
  • 回原点
  • 绝对运动
  • 相对运动
  • 推压运动
  • 闭环推压运动
  • 等待运动完成
  • 是否在运动中
  • 是否运动到达
  • 是否推空
  • 设置指令
  • 读取指令
  • 执行指令
  • 触发指令
  • 读取指令
  • 保存指令
  • 读取当前位置
  • 读取当前速度
  • 读取当前电机出力
  • 读取当前力传感器读数
  • 读取错误状态代码
  • 重置错误
  • 开关伺服
  • 停止

连接与配置

初始化Sdk库和对应参数文件

C
CPP
CSharp
Python
// 函数原型
void rm_set_config_path(const char* path);

// 使用示例
rm_set_config_path("sdk/config/MotorMaster.config");
// 函数原型
void set_config_path(const char* path);

// 使用示例
set_config_path("sdk/config/MotorMaster.config");
// 函数原型
public static class Sdk
{
public static void Initialize(string sdk_path);
public static void SetConfigPath(string path);
}

// 使用示例
Sdk.Initialize("sdk/bin/MotorMaster.Sdk.dll");
Sdk.SetConfigPath("sdk/config/MotorMaster.config");
## 函数原型
def init(native_path, config_path):

## 使用示例
import motor_master.sdk as sdk
sdk.init('sdk/bin/MotorMaster.Sdk.dll', 'sdk/config/MotorMaster.config')
C和C++版的sdk仅需要设置对应的驱动器config参数文件即可完成初始化使用。 C#,Python版除了需要设置config参数文件外还需先设置原生sdk动态链接库的路径。

连接轴

C
CPP
CSharp
Python
Javascript
// 函数原型
rm_axis_t rm_create_modbus_rtu(const char* device, int baudrate, uint8_t slave_id);
rm_axis_t rm_create_modbus_tcp(const char* address, int port);

// 使用示例
rm_axis_handle handle = rm_create_modbus_rtu("\\\\.\\COM8", 115200, 0);
rm_axis_handle handle = rm_create_modbus_tcp("192.168.50.9", 502);
// 函数原型
IRMAxis* create_rmaxis_modbus_rtu(const char* device, int baudrate, uint8_t slave_id);
IRMAxis* create_rmaxis_modbus_tcp(const char* address, int port);

// 使用示例
auto axis = create_rmaxis_modbus_rtu("\\\\.\\COM8", 115200, 0);
auto axis = create_rmaxis_modbus_tcp("192.168.50.9", 502);
// 函数原型
public static RMAxis CreateModbusRtu(string device, int baudrate, ushort slave_id);
public static RMAxis CreateModbusTcp(string address, int port);

// 使用示例
var axis = Sdk.CreateModbusRtu("\\\\.\\COM8", 115200, 0);
var axis = Sdk.CreateModbusTcp("192.168.50.9", 502);
## 函数原型
def create_modbus_rtu(device, baudrate, axis_no):

## 使用示例
axis = sdk.create_modbus_rtu('\\\\.\\COM8', 115200, 0)
// 函数原型
declare var rmaxis_modbus_rtu:
{
new (device: string, baudrate: number, axis_no: number): rmaxix;
}

declare var rmaxis_modbus_tcp:
{
new (address: string, port: number): rmaxix;
}

// 使用示例
var axis = new rmaxis_modbus_rtu('\\\\.\\COM8', 115200, 0)
var axis = new rmaxis_modbus_tcp('192.168.50.9', 502)
变量描述
device串口设备 \\.\COM8 或 /dev/ttyS0 等
baudrate波特率
axis_no轴号

连接到指定设备上的控制器。

设置异常生成机制

C
CPP
// 函数原型
void rm_set_exception_throw(bool enable);
exception_t* rm_get_exception();

// 使用示例

// 关闭异常直接抛出
rm_set_exception_throw(false);

// 执行一条api指令
exception_t* ex = rm_get_exception();
if(ex)
{
// 异常触发

}
// 函数原型
exception_t* get_exception();
void set_exception_throw(bool enable);

// 使用示例
set_exception_throw(true);
try
{
// 执行一条api指令
}
catch(exception_t ex)
{
// ...
}
变量描述
enable是否使用异常直接抛出

设置异常的抛出方式是throw还是每次执行api函数后轮询。 建议使用轮询的方法避免因为编译器版本和运行时不同导致兼容性问题。可以参考c# sdk的binding接口代码的实现。

异常的定义为

#define MAX_STRING_SIZE 0xFF

typedef struct
{
    char message[MAX_STRING_SIZE];
    int line_number; 
    char src_file[MAX_STRING_SIZE];
} exception_t;

断开轴

C
CPP
CSharp
Python
Javascript
// 函数原型
void rm_destroy(rm_axis_t axis);

// 使用示例
rm_destroy(axis);
// 函数原型
void destroy_rmaxis(IRMAxis* axis);

// 使用示例
destroy_rmaxis(axis);
// 函数原型
public static void Destroy(RMAxis axis)

// 使用示例
Sdk.Destroy(axis)
;
## 函数原型
def destroy(axis):

## 使用示例
axis.close()
// 使用示例
delete axis;

断开连接的轴

读取当前控制器版本

C
CPP
CSharp
Python
Javascript
// 函数原型
typedef struct {
int32_t major;
int32_t minor;
int32_t build;
int32_t type;
} version_t;

version_t rm_get_version(rm_axis_t handle);

// 使用示例
version_t version = rm_get_version(handle);
// 函数原型
typedef struct {
int32_t major;
int32_t minor;
int32_t build;
int32_t type;
} version_t;

virtual version_t get_version() = 0;

// 使用示例
auto version = axis.get_version();
// 函数原型
public struct version_t
{
public int major;
public int minor;
public int build;
public int type;
}

public Native.version_t Version {get;}

// 使用示例
var version = axis.Version;
## 函数原型
class Version(ctypes.Structure):
_fields_ = [('major', ctypes.c_int),
('minor', ctypes.c_int),
('build', ctypes.c_int),
('type', ctypes.c_int)]

def get_version(self):

## 使用示例
version = axis.get_version()
// 函数原型
interface version_t
{
major: number;
minor: number;
build: number;
type: number;
}

get_version : () => version_t;

// 使用示例
var version = axis.get_version()

读取当前控制器版本,用于进一步调试或诊断异常。

IO功能控制

控制器IO分为 逻辑IO信号 和 物理IO信号。 逻辑IO信号 指控制器内部的信号,可通过通讯的方式进行操作来执行对应的功能。 物理IO信号 指控制器上实际引出的IO口信号, 如分体式RM-C控制器上存在的16个输入和16个输出口。 物理IO口单独无法执行任何功能, 必须把 内部的逻辑IO信号映射到物理IO信号后才能进行触发操作。

读取物理IO口数量

C
CPP
CSharp
Javascript
// 函数原型
int rm_get_input_count(rm_axis_t handle);
int rm_get_output_count(rm_axis_t handle);
// 函数原型
int get_input_count() = 0;
int get_output_count() = 0;
// 函数原型
public int InputCount{get;}
public int OutputCount{get;}
// 函数原型
get_input_count : () => void;
get_output_count : () => void;

读取控制器物理IO口的数量。

读取控制器可用逻辑IO信号

C
CPP
CSharp
Javascript
// 函数原型
int rm_list_input_signal(rm_axis_t handle, char signal_out[MAX_ARRAY_SIZE][MAX_STRING_SIZE]);
int rm_list_output_signal(rm_axis_t handle, char signal_out[MAX_ARRAY_SIZE][MAX_STRING_SIZE]);

// 使用示例
char signal_out[MAX_ARRAY_SIZE][MAX_STRING_SIZE] = {0};
int signal_count = rm_list_input_signal(handle, signal_out);
for(int i=0; i<signal_count; i++)
printf(signal_out[i]);
// 函数原型
int list_input_signal(char signal_out[MAX_ARRAY_SIZE][MAX_STRING_SIZE]) = 0;
int list_output_signal(char signal_out[MAX_ARRAY_SIZE][MAX_STRING_SIZE]) = 0;

// 使用示例
char signal_out[MAX_ARRAY_SIZE][MAX_STRING_SIZE] = {0};
int signal_count = axis.list_input_signal(handle, signal_out);
for(int i=0; i<signal_count; i++)
printf(signal_out[i]);
// 函数原型
public List<string> InputSignal{get;}
public List<string> OutputSignal{get;}
// 函数原型
list_input_signal : () => Array<string>;
list_output_signal : () => Array<string>;
变量描述
handle轴句柄
signal_out逻辑IO信号名称
返回值逻辑IO信号数量

读取当前控制器可用逻辑IO信号。

操作逻辑IO信号

C
CPP
CSharp
Python
Javascript
// 函数原型
void rm_set_input_signal(rm_axis_t handle, const char* signal, bool level);
bool rm_get_input_signal(rm_axis_t handle, const char* signal);
bool rm_get_output_signal(rm_axis_t handle, const char* signal);
// 函数原型
void set_input_signal(const char* signal, bool level) = 0;
bool get_input_signal(const char* signal) = 0;
bool get_output_signal(const char* signal) = 0;
// 函数原型
public void SetInputSignal(string signal, bool level);
public bool GetInputSignal(string signal);
public bool GetOutputSignal(string signal);
## 函数原型
def set_input_signal(self, signal, level):
def get_input_signal(self, signal):
def get_output_signal(self, signal):
// 函数原型
set_input_signal : (signal : string, level : boolean) => void;
get_input_signal : (signal : string) => boolean;
get_output_signal : (signal : string) => boolean;
变量描述
handle轴句柄
signal逻辑IO信号名称
返回值逻辑IO信号状态

读写当前控制器逻辑IO信号状态。

操作逻辑IO信号对物理IO映射

C
CPP
CSharp
Javascript
// 函数原型
const char* rm_get_map_input(rm_axis_t handle, int port);
const char* rm_get_map_output(rm_axis_t handle, int port);
void rm_set_map_input(rm_axis_t handle, const char* signal, int port);
void rm_set_map_output(rm_axis_t handle, const char* signal, int port);
// 函数原型
virtual const char* get_map_input(int port) = 0;
virtual const char* get_map_output(int port) = 0;
virtual void set_map_input(const char* signal, int port) = 0;
virtual void set_map_output(const char* signal, int port) = 0;
// 函数原型
public string GetInputMap(int port);
public string GetOutputMap(int port);
public void SetInputMap(string signal, int port);
public void SetOutputMap(string signal, int port);
// 函数原型
get_map_input : (port : number) => string;
get_map_output : (port : number) => string;
set_map_input : (signal: string, port: number) => void;
set_map_output : (signal: string, port: number) => void;
变量描述
handle轴句柄
port物理IO端口序号
signal逻辑IO信号名称
返回值逻辑IO信号名称

读写当前控制器物理IO映射信号。

通用运动控制

常用运动控制指令,如不需要进行复杂指令执行,只需要使用以下api指令即可完成大部分操作。

设置直接运动规划器参数

C
CPP
CSharp
Python
Javascript
// 函数原型
void rm_config_motion(rm_axis_handle handle, float velocity, float acceleration, float deacceleration);

// 使用示例
rm_config_motion(axis, 100.f, 500.f, 500.f);
// 函数原型
virtual void config_motion(float velocity, float acceleration, float deacceleration) = 0;

// 使用示例
axis.config_motion(100.f, 500.f, 500.f);
// 函数原型
void ConfigMotion(float velocity, float acceleration, float deacceleration);

// 使用示例
axis.ConfigMotion(100, 500, 500)
## 函数原型
def config_motion(self, velocity, acceleration, deacceleration):

## 使用示例
axis.config_motion(100, 3000, 3000)
// 函数原型
config_motion : (velocity: number, acceleration: number, deacceleration: number) => void;

// 使用示例
axis.config_motion(100, 3000, 3000)
变量描述
handle轴句柄
velocity速度 mm/s
acceleration加速度 mm/s^2
deacceleration减速度 mm/s^2

设置直接运动时规划器的速度,加速度和减速度和移动到位置配合使用。

移动到位置

C
CPP
CSharp
Python
Javascript
// 函数原型
void rm_move_to(rm_axis_t handle, float position);

// 使用示例
rm_move_to(axis, 10.f);
// 函数原型
virtual void move_to(float position) = 0;

// 使用示例
axis.move_to(10.f);
// 函数原型
public void MoveTo(float position);

// 使用示例
axis.MoveTo(10)
## 函数原型
def move_to(self, position):

## 使用示例
axis.move_to(10)
// 函数原型
move_to : (position: number) => void;

## 使用示例
axis.move_to(10)
变量描述
handle轴句柄
position位置 mm

设置直接运动时规划器的目标位置和设置直接运动规划器参数配合使用。

回原点

C
CPP
CSharp
Python
Javascript
// 函数原型
void rm_go_home(rm_axis_handle handle);

// 使用示例
rm_go_home(axis);
// 函数原型
virtual void go_home() = 0;

// 使用示例
axis.go_home();
// 函数原型
void GoHome();

// 使用示例
axis.GoHome();
## 函数原型
def go_home(self):

## 使用示例
axis.go_home()
// 函数原型
go_home : () => void;

## 使用示例
axis.go_home()
变量描述
handle轴句柄

触发轴回原点, 如果没有设置 自动回原点 的话 每次上电后只需要触发执行一次就行 可以通过读取逻辑信号 "gone_home" 来判断是否执行完成

绝对运动

C
CPP
CSharp
Python
Javascript
// 函数原型
void rm_move_absolute(rm_axis_handle handle, float position, float velocity, float acceleration, float deacceleration, float band);

// 使用示例
rm_move_absolute(axis, 10.f, 100.f, 3000.f, 3000.f, 0.1f);
// 函数原型
virtual void move_absolute(
float position, float velocity,
float acceleration, float deacceleration, float band)
= 0;

// 使用示例
axis.move_absolute(10.f, 100.f, 3000.f, 3000.f, 0.1f);
// 函数原型
void MoveAbsolute(float position, float velocity, float acceleration, float deacceleration, float band);

// 使用示例
axis.MoveAbsolute(10, 100, 3000, 3000, 0.1)
## 函数原型
def move_absolute(self, position, velocity, acceleration, deacceleration, band):

## 使用示例
axis.move_absolute(10, 100, 3000, 3000, 0.1)
// 函数原型
move_absolute : (
position: number, velocity: number,
acceleration: number, deacceleration: number, band: number) => void;

// 使用示例
axis.move_absolute(10, 100, 3000, 3000, 0.1)
变量描述
handle轴句柄
position位置 mm
velocity速度 mm/s
acceleration加速度 mm/s^2
deacceleration减速度 mm/s^2
band定位范围 mm

以设定速度加速度绝对运动到给定位置。

相对运动

C
CPP
CSharp
Python
Javascript
// 函数原型
void rm_move_relative(rm_axis_handle handle, float position, float velocity, float acceleration, float deacceleration, float band);

// 使用示例
rm_move_relative(axis, 10.f, 100.f, 3000.f, 3000.f, 0.1f);
// 函数原型
virtual void move_relative(
float position, float velocity,
float acceleration, float deacceleration, float band)
= 0;

// 使用示例
axis.move_relative(10.f, 100.f, 3000.f, 3000.f, 0.1f);
// 函数原型
void MoveRelative(float position, float velocity, float acceleration, float deacceleration, float band);

// 使用示例
axis.MoveRelative(10, 100, 3000, 3000, 0.1)
## 函数原型
def move_relative(self, position, velocity, acceleration, deacceleration, band):

## 使用示例
axis.move_relative(10, 100, 3000, 3000, 0.1)
// 函数原型
move_relative : (
position: number, velocity: number,
acceleration: number, deacceleration: number, band: number) => void;

// 使用示例
axis.move_relative(10, 100, 3000, 3000, 0.1)
变量描述
handle轴句柄
position位置 mm
velocity速度 mm/s
acceleration加速度 mm/s^2
deacceleration减速度 mm/s^2
band定位范围 mm

以设定速度加速度绝对运动到给定位置。

推压运动

C
CPP
CSharp
Python
Javascript
// 函数原型
void rm_push(rm_axis_handle handle, float force, float distance, float velocity);

// 使用示例
rm_push(axis, 50.f, 5.f, 20.f);
// 函数原型
virtual void push(
float force,
float distance, float velocity)
= 0;

// 使用示例
axis.push(50.f, 5.f, 20.f);
// 函数原型
void Push(float force, float distance, float velocity);

// 使用示例
axis.Push(50, 5, 20);
## 函数原型
def push(self, force, distance, velocity):

## 使用示例
axis.push(50, 5, 20)
// 函数原型
push : (
force: number,
distance: number, velocity: number) => void;

// 使用示例
axis.push(50, 5, 20)
变量描述
handle轴句柄
force出力 %
distance距离 mm
velocity速度 mm/s

以设定速度和出力推压到指定距离

闭环推压运动

C
CPP
CSharp
Python
Javascript
// 函数原型
void rm_precise_push(
rm_axis_t handle,
float force,
float distance, float velocity,
float force_band, uint32_t force_check_time)
;

// 使用示例
rm_precise_push(axis, 5.f, 5.f, 5.f, 0.1f, 50);
// 函数原型
virtual void precise_push(
float force,
float distance, float velocity,
float force_band, uint32_t force_check_time)
= 0;

// 使用示例
axis.precise_push(5.f, 5.f, 5.f, 0.1f, 50);
// 函数原型
public void PrecisePush(
float force,
float distance, float velocity,
float force_band, uint force_check_time
)
;

// 使用示例
axis.PrecisePush(5, 5, 5, 0.1, 50);
## 函数原型
def precise_push(self, force, distance, velocity, force_band, force_check_time):

## 使用示例
axis.precise_push(5, 5, 5, 0.1, 50)
// 函数原型
precise_push : (
force: number,
distance: number, velocity: number,
force_band: number, force_check_time: number) => void;

// 使用示例
axis.precise_push(5, 5, 5, 0.1, 50)
变量描述
handle轴句柄
force出力 N
distance距离 mm
velocity速度 mm/s
force_band力定位范围 N
force_check_time力定位时间 ms

以设定速度和出力推压到指定距离

等待运动完成

C
CPP
CSharp
Python
Javascript
// 函数原型
bool rm_wait_complete(rm_axis_t handle, uint32_t timeout_ms);
// 函数原型
virtual bool wait_complete(uint32_t timeout_ms) = 0;
// 函数原型
public bool WaitComplete(uint timeout_ms);
## 函数原型
def wait_complete(self, timeout_ms):
// 函数原型
wait_complete : (timeout_ms: number) => boolean;
变量描述
handle轴句柄
timeout等待超时时间 ms
返回值是否超时

等待运动完成,如果超时还未完成函数将返回,并将返回值设置成true,意为运动未完成但等待已经超时。

是否在运动中

C
CPP
CSharp
Python
Javascript
// 函数原型
bool rm_is_moving(rm_axis_handle handle);

// 使用示例
bool moving = rm_is_moving(axis);
// 函数原型
virtual bool is_moving() = 0;

// 使用示例
bool moving = axis.is_moving();
// 函数原型
bool IsMoving();

// 使用示例
bool moving = axis.IsMoving();
## 函数原型
def is_moving(self):

## 使用示例
moving = axis.is_moving()
// 函数原型
is_moving : () => boolean;

// 使用示例
var moving = axis.is_moving()
变量描述
handle轴句柄
返回值是否在运动

检查轴是否在运动

是否运动到达

C
CPP
CSharp
Python
Javascript
// 函数原型
bool rm_is_reached(rm_axis_handle handle);

// 使用示例
bool reached = rm_is_reached(axis);
// 函数原型
virtual bool is_reached() = 0;

// 使用示例
bool reached = axis.is_reached();
// 函数原型
bool IsReached();

// 使用示例
bool reached = axis.IsReached();
## 函数原型
def is_reached(self):

## 使用示例
reached = axis.is_reached()
// 函数原型
is_reached : () => boolean;

// 使用示例
var reached = axis.is_reached()
变量描述
handle轴句柄
返回值是否运动到达

检查轴是否到达运动目标

是否推空

C
CPP
CSharp
Python
Javascript
// 函数原型
bool rm_is_push_empty(rm_axis_handle handle);

// 使用示例
bool empty = rm_is_push_empty(axis);
// 函数原型
virtual bool is_push_empty() = 0;

// 使用示例
bool empty = axis.is_push_empty();
// 函数原型
bool IsPushEmpty();

// 使用示例
bool empty = axis.IsPushEmpty();
## 函数原型
def is_push_empty(self):

## 使用示例
empty = axis.is_push_empty()
// 函数原型
is_push_empty : () => boolean;

// 使用示例
var empty = axis.is_push_empty()
变量描述
handle轴句柄
返回值是否推空

检查轴推压运动是否推空, 可以在推压运动完成后用这来检测是否推压/夹持空。

指令

C/CPP
CSharp
Python
Javascript
typedef enum {
COMMAND_NONE = 0,
COMMAND_GO_HOME = 1,
COMMAND_DELAY = 2,
COMMAND_MOVE_ABSOLUTE = 3,
COMMAND_PUSH = 4,
COMMAND_MOVE_RELATIVE = 5,
COMMAND_PRECISE_PUSH = 6
} command_type_t;

typedef struct {
command_type_t type;
float position;
float velocity;
float acceleration;
float deacceleration;
float band;
float push_force;
float push_distance;
int32_t delay;
int32_t next_command_index;
} command_t;
public enum MOTION_COMMAND : uint
{
NONE = 0,
GO_HOME = 1,
DELAY = 2,
MOVE_ABSOLUTE = 3,
PUSH = 4,
MOVE_RELATIVE = 5,
CLOSE_LOOP_PUSH = 6
};

[StructLayout(LayoutKind.Sequential)]
public struct motion_command_t
{
public MOTION_COMMAND type;
public float position;
public float velocity;
public float acceleration;
public float deacceleration;
public float tolerance;
public float push_force;
public float push_distance;
public int delay;
public int next_command_index;
}

class Command(ctypes.Structure):
_fields_ = [('type', ctypes.c_int),
('position', ctypes.c_float),
('velocity', ctypes.c_float),
('acceleration', ctypes.c_float),
('deacceleration', ctypes.c_float),
('tolerance', ctypes.c_float),
('push_force', ctypes.c_float),
('push_distance', ctypes.c_float),
('delay', ctypes.c_float),
('next_command_index', ctypes.c_int)]
interface command_t
{
type : "none" | "move_abs" | "move_rel" | "push" | "delay" | "closed_loop_push";
position: number;
velocity: number;
acceleration: number;
deacceleration: number;
band: number;
push_force: number;
push_distance: number;
delay: number;
next_command_index: number;
}
指令结构体

设置指令

C
CPP
CSharp
Python
Javascript
// 函数原型
void rm_set_command(rm_axis_handle handle, int32_t index, command_t command);

// 使用示例
rm_set_command(axis,0, command);
// 函数原型
virtual void set_command(int index, command_t command) = 0;

// 使用示例
axis.set_command(axis,0, command);
// 函数原型
void SetCommand(int index, Native.motion_command_t command);

// 使用示例
axis.SetCommand(0, command);
## 函数原型
def set_command(self, index, command):

## 使用示例
axis.set_command(0, command)
// 函数原型
set_command : (index: number, command: command_t) => void;

// 使用示例
axis.set_command(0, command)
变量描述
handle轴句柄
index指令序号
command指令

设置指定序号的指令

读取指令

C
CPP
CSharp
Python
Javascript
// 函数原型
command_t rm_get_command(rm_axis_t handle, int index);

// 使用示例
command_t command = rm_get_command(axis, 0);
// 函数原型
virtual command_t get_command(int index) = 0;

// 使用示例
auto command = axis.get_command(0);
// 函数原型
Native.motion_command_t GetCommand(int index);

// 使用示例
var command = axis.GetCommand(0);
## 函数原型
def get_command(self, index):

## 使用示例
command = axis.get_command(0)
// 函数原型
get_command : (index: number) => command_t;

// 使用示例
var command = axis.get_command(0)
变量描述
handle轴句柄
index指令序号

读取指定序号的指令

执行指令

C
CPP
CSharp
Python
Javascript
// 函数原型
void rm_execute_command(rm_axis_handle handle, motion_command_t command);

// 使用示例
rm_execute_command(axis, command);
// 函数原型
virtual void execute_command(command_t command) = 0;

// 使用示例
axis.execute_command(command);
// 函数原型
void ExecuteCommand(Native.motion_command_t command);

// 使用示例
axis.ExecuteCommand(command);
## 函数原型
def execute_command(self, command):

## 使用示例
axis.execute_command(command)
// 函数原型
execute_command : (command: command_t) => void;

// 使用示例
axis.execute_command(command)
变量描述
handle轴句柄
command指令

触发执行指定指令

触发指令

C
CPP
CSharp
Python
Javascript
// 函数原型
void rm_trig_command(rm_axis_handle handle, int32_t index);

// 使用示例
rm_trig_command(axis, 0);
// 函数原型
virtual void trig_command(int index) = 0;

// 使用示例
axis.trig_command(0);
// 函数原型
void TrigCommand(int index);

// 使用示例
axis.TrigCommand(0);
## 函数原型
def trig_command(self, index):

## 使用示例
axis.trig_command(0)
// 函数原型
trig_command : (index: number) => void;

// 使用示例
axis.trig_command(0)
变量描述
handle轴句柄
index指令序号

触发执行指定序号的指令

读取指令

C
CPP
CSharp
Python
Javascript
// 函数原型
void rm_load_commands(rm_axis_t handle);

// 使用示例
rm_load_commands(axis);
// 函数原型
virtual void load_commands() = 0;

// 使用示例
axis.load_commands();
// 函数原型
void LoadCommands()

// 使用示例
axis.LoadCommands()
;
## 函数原型
def load_commands(self):

## 使用示例
axis.load_commands()
// 函数原型
load_commands : () => void;

// 使用示例
axis.load_commands()
变量描述
handle轴句柄

读取指令表

保存指令

C
CPP
CSharp
Python
Javascript
// 函数原型
void rm_save_commands(rm_axis_t handle);

// 使用示例
rm_save_commands(axis);
// 函数原型
virtual void save_commands() = 0;

// 使用示例
axis.save_commands();
// 函数原型
void SaveCommands();

// 使用示例
axis.SaveCommands();
## 函数原型
def save_commands(self):

## 使用示例
axis.save_commands()
// 函数原型
save_commands : () => void;

// 使用示例
axis.save_commands()
变量描述
handle轴句柄

保存指令表

状态

读取当前位置

C
CPP
CSharp
Python
Javascript
// 函数原型
float rm_position(rm_axis_t handle);

// 使用示例
float position = rm_position(axis);
// 函数原型
virtual float position() = 0;

// 使用示例
float position = axis.position();
// 函数原型
public float Position{get;}

// 使用示例
var position = axis.Position;
## 函数原型
def position(self):

## 使用示例
position = axis.position()
// 函数原型
position : () => number;

// 使用示例
position = axis.position()
变量描述
handle轴句柄
返回值位置 mm

读取当前位置

读取当前速度

C
CPP
CSharp
Python
Javascript
// 函数原型
float rm_velocity(rm_axis_t handle);

// 使用示例
float velocity = rm_velocity(axis);
// 函数原型
virtual float velocity() = 0;

// 使用示例
float velocity = axis.velocity();
// 函数原型
public float Velocity{get;}

// 使用示例
var velocity = axis.Velocity;
## 函数原型
def velocity(self):

## 使用示例
velocity = axis.velocity()
// 函数原型
velocity : () => number;

// 使用示例
velocity = axis.velocity()
变量描述
handle轴句柄
返回值速度 mm/s

读取当前速度

读取当前电机出力

C
CPP
CSharp
Python
Javascript
// 函数原型
float rm_torque(rm_axis_t handle);

// 使用示例
float torque = rm_torque(axis);
// 函数原型
virtual float torque() = 0;

// 使用示例
float torque = axis.torque();
// 函数原型
public float Torque{get;}

// 使用示例
var torque = axis.Torque;
## 函数原型
def torque(self):

## 使用示例
torque = axis.torque()
// 函数原型
torque : () => number;

// 使用示例
torque = axis.torque()
变量描述
handle轴句柄
返回值出力%

读取当前电机出力

读取当前力传感器读数

C
CPP
CSharp
Python
Javascript
// 函数原型
float rm_force_sensor(rm_axis_t handle);

// 使用示例
float force = rm_force_sensor(axis);
// 函数原型
virtual float force_sensor() = 0;

// 使用示例
float force = axis.force_sensor();
// 函数原型
public float ForceSensor{get;}

// 使用示例
var force = axis.ForceSensor;
## 函数原型
def force_sensor(self):

## 使用示例
force = axis.force_sensor()
// 函数原型
force_sensor : () => number;

// 使用示例
force = axis.force_sensor()
变量描述
handle轴句柄
返回值出力%

读取当前电机出力

读取错误状态代码

C
CPP
CSharp
Python
Javascript
// 函数原型
uint32_t rm_error_code(rm_axis_t handle);

// 使用示例
uint32_t error = rm_error_code(axis);
// 函数原型
virtual uint32_t error_code() = 0;

// 使用示例
uint32_t error = axis.error_code(axis);
// 函数原型
public uint ErrorCode{get;}

// 使用示例
var error = axis.ErrorCode;
## 函数原型
def error_code(self):

## 使用示例
error = axis.error_code()
// 函数原型
error_code : () => number;

// 使用示例
error = axis.error_code()
变量描述
handle轴句柄
返回值当前错误状态代码

读取当前错误状态代码

错误代码描述
0正常
1通用错误
2电机失相
3位置超差
4速度超差
5电机堵转
6初相励磁错误

重置错误

C
CPP
CSharp
Python
Javascript
// 函数原型
void rm_reset_error(rm_axis_t handle);

// 使用示例
rm_reset_error(axis);
// 函数原型
virtual void reset_error() = 0;

// 使用示例
axis.reset_error();
// 函数原型
void ResetError()

// 使用示例
axis.ResetError()
;
## 函数原型
def reset_error(self):

## 使用示例
axis.reset_error()
// 函数原型
reset_error : () => void;

// 使用示例
axis.reset_error()
变量描述
handle轴句柄

重置控制器错误状态

开关伺服

C
CPP
CSharp
Python
Javascript
// 函数原型
void rm_set_servo_on_off(rm_axis_t handle, bool on_off);
bool rm_get_servo_on_off(rm_axis_t handle);

// 使用示例
rm_set_servo_on_off(axis, false);
// 函数原型
virtual void set_servo_on_off(bool on_off) = 0;
virtual bool get_servo_on_off() = 0;

// 使用示例
axis.set_servo_on_off(false);
// 函数原型
public bool ServoOnOff{get; set;}

// 使用示例
axis.ServoOnOff = false;
## 函数原型
def set_servo_on_off(self,on_off):

## 使用示例
axis.set_servo_on_off(False)
// 函数原型
set_servo_on_off : (on_off: boolean) => void;
get_servo_on_off : () => boolean;

// 使用示例
axis.set_servo_on_off(false)
变量描述
handle轴句柄
on_off伺服开关信号

设置伺服开关信号

停止

C
CPP
CSharp
Python
Javascript
// 函数原型
void rm_stop(rm_axis_t handle);

// 使用示例
rm_stop(axis);
// 函数原型
virtual void stop() = 0;

// 使用示例
axis.stop();
// 函数原型
public void Stop()

// 使用示例
axis.Stop()
;
## 函数原型
def stop(self):

## 使用示例
axis.stop()
// 函数原型
stop : () => void;

// 使用示例
axis.stop()
变量描述
handle轴句柄

停止轴运动

Last updated on 4/20/2023
  • 连接与配置
    • 初始化Sdk库和对应参数文件
    • 连接轴
    • 设置异常生成机制
    • 断开轴
    • 读取当前控制器版本
  • IO功能控制
    • 读取物理IO口数量
    • 读取控制器可用逻辑IO信号
    • 操作逻辑IO信号
    • 操作逻辑IO信号对物理IO映射
  • 通用运动控制
    • 设置直接运动规划器参数
    • 移动到位置
    • 回原点
    • 绝对运动
    • 相对运动
    • 推压运动
    • 闭环推压运动
    • 等待运动完成
    • 是否在运动中
    • 是否运动到达
    • 是否推空
  • 指令
    • 设置指令
    • 读取指令
    • 执行指令
    • 触发指令
    • 读取指令
    • 保存指令
  • 状态
    • 读取当前位置
    • 读取当前速度
    • 读取当前电机出力
    • 读取当前力传感器读数
    • 读取错误状态代码
    • 重置错误
    • 开关伺服
    • 停止
开发资料
通讯参数Sdk接口常见问题更新日志
更多
产品资料微信公众号技术支持
Copyright © 2025 佛山市增广智能科技有限公司
备案/许可证号:粤ICP备19021060号