|
- using System;
- using System.Collections.Generic;
- using System.Runtime.InteropServices;
- using System.Text;
- using jkType;
-
- namespace HBLConsole.Communication
- {
- delegate void CallBackFuncType(int error_code);
- class jakaAPI
- {
- /// <summary>
- /// 获取版本控制器的Ip
- /// </summary>
- /// <param name="controller_name"></param>
- /// <param name="ip"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_controller_ip", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_controller_ip(char[] controller_name, ref byte ip);
-
- /// <summary>
- /// 创建机器人控制句柄
- /// </summary>
- /// <param name="ip"></param>
- /// <param name="handle"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "create_handler", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int create_handler(char[] ip, ref int handle);
-
- /// <summary>
- /// 断开机器人控制句柄
- /// </summary>
- /// <param name="handle"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "destory_handler", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int destory_handler(ref int handle);
-
- /// <summary>
- /// 打开机器人电源
- /// </summary>
- /// <param name="handle">机器人控制句柄</param>
- /// <returns>ERR_SUCC 成功 其他失败</returns>
- [DllImport("jakaAPI.dll", EntryPoint = "power_on", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int power_on(ref int handle);
-
- /// <summary>
- /// 关闭机器人电源
- /// </summary>
- /// <param name="handle">机器人控制句柄</param>
- /// <returns>ERR_SUCC 成功 其他失败</returns>
- [DllImport("jakaAPI.dll", EntryPoint = "power_off", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int power_off(ref int handle);
-
- /// <summary>
- /// 机器人控制柜关机
- /// </summary>
- /// <param name="handle"></param>
- /// <returns>ERR_SUCC 成功 其他失败</returns>
- [DllImport("jakaAPI.dll", EntryPoint = "shut_down", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int shut_down(ref int handle);
-
- /// <summary>
- /// 控制机器人上使能
- /// </summary>
- /// <param name="handle"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "enable_robot", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int enable_robot(ref int handle);
-
- /// <summary>
- /// 控制机器人下使能
- /// </summary>
- /// <param name="handle"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "disable_robot", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int disable_robot(ref int handle);
-
- /// <summary>
- /// 控制机器人手动模式下运动
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="aj_num">标识值,在关节空间下代表关节号0-5,笛卡尔下依次为x,y,z,rx,ry,rz</param>
- /// <param name="move_mode">机器人运动模式,增量运动或者连续运动</param>
- /// <param name="coord_type">机器人运动坐标系,工具坐标系,基坐标系(当前的世界/用户坐标系)或关节空间</param>
- /// <param name="vel_cmd">指令速度,旋转轴或关节运动单位为rad/s,移动轴单位为mm/s</param>
- /// <param name="pos_cmd">指令位置,旋转轴或关节运动单位为rad,移动轴单位为mm</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "jog", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int jog(ref int handle, int aj_num, JKTYPE.MoveMode move_mode, JKTYPE.CoordType coord_type, double vel_cmd, double pos_cmd);
-
- /// <summary>
- /// 控制机器人手动模式下运动停止
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="num"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "jog_stop", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int jog_stop(ref int handle, ref int num);
-
- /// <summary>
- /// 机器人关节运动
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="joint_pos">机器人关节运动目标位置</param>
- /// <param name="move_mode">指定运动模式:增量运动(相对运动)或绝对运动</param>
- /// <param name="is_block">设置接口是否为阻塞接口,TRUE为阻塞接口 FALSE为非阻塞接口</param>
- /// <param name="speed">机器人关节运动速度,单位:rad/s</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "joint_move", ExactSpelling = false, CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)]
- public static extern int joint_move(ref int handle, ref JKTYPE.JointValue joint_pos, JKTYPE.MoveMode move_mode, bool is_block, double speed);
-
- /// <summary>
- /// 机器人末端直线运动
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="end_pos">机器人末端运动目标位置</param>
- /// <param name="move_mode">指定运动模式:增量运动(相对运动)或绝对运动</param>
- /// <param name="is_block">设置接口是否为阻塞接口,TRUE 为阻塞接口 FALSE 为非阻塞接口</param>
- /// <param name="speed">机器人直线运动速度,单位:mm/s</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "linear_move", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int linear_move(ref int handle, ref JKTYPE.CartesianPose end_pos, JKTYPE.MoveMode move_mode, bool is_block, double speed);
-
- /// <summary>
- /// 机器人SERVO MOVE模式使能
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="enable">TRUE为进入SERVO MOVE模式,FALSE表示退出该模式</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "servo_move_enable", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int servo_move_enable(ref int handle, bool enable);
-
- /// <summary>
- /// 机器人关节空间位置控制模式
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="joint_pos">机器人关节运动目标位置</param>
- /// <param name="move_mode">指定运动模式:增量运动或绝对运动</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "servo_j", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int servo_j(ref int handle, ref JKTYPE.JointValue joint_pos, JKTYPE.MoveMode move_mode);
-
- /// <summary>
- /// 机器人关节空间位置控制模式
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="joint_pos">机器人关节运动目标位置</param>
- /// <param name="move_mode">指定运动模式:增量运动或绝对运动</param>
- /// <param name="step_num">倍分周期,servo_j运动周期为step_num*8ms,其中step_num>=1</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "servo_j_extend", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int servo_j_extend(ref int handle, ref JKTYPE.JointValue joint_pos, JKTYPE.MoveMode move_mode, int step_num);
-
- /// <summary>
- /// 机器人笛卡尔空间位置控制模式
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="cartesian_pose">机器人笛卡尔空间运动目标位置</param>
- /// <param name="move_mode">指定运动模式:增量运动或绝对运动</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "servo_p", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int servo_p(ref int handle, ref JKTYPE.CartesianPose cartesian_pose, JKTYPE.MoveMode move_mode);
-
- /// <summary>
- /// 机器人笛卡尔空间位置控制模式
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="cartesian_pose">机器人笛卡尔空间运动目标位置</param>
- /// <param name="move_mode">指定运动模式:增量运动或绝对运动</param>
- /// <param name="step_num">倍分周期,servo_p运动周期为step_num*8ms,其中step_num>=1</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "servo_p_extend", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int servo_p_extend(ref int handle, ref JKTYPE.CartesianPose cartesian_pose, JKTYPE.MoveMode move_mode, int step_num);
-
- /// <summary>
- /// 设置数字输出变量(DO)的值
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="type">type DO类型</param>
- /// <param name="index">index DO索引</param>
- /// <param name="value">value DO设置值</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_digital_output", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_digital_output(ref int handle, JKTYPE.IOType type, int index, bool value);
-
- /// <summary>
- /// 设置模拟输出变量的值(AO)的值
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="type"> AO类型</param>
- /// <param name="index">AO索引</param>
- /// <param name="value">AO设置值</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_analog_output", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_analog_output(ref int handle, JKTYPE.IOType type, int index, float value);
-
- /// <summary>
- /// 查询数字输入(DI)状态
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="type">DI类型</param>
- /// <param name="index">DI索引</param>
- /// <param name="result">DI状态查询结果</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_digital_input", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_digital_input(ref int handle, JKTYPE.IOType type, int index, ref bool result);
-
- /// <summary>
- /// 查询数字输出(DO)状态
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="type">DO类型</param>
- /// <param name="index">DO索引</param>
- /// <param name="result">DO状态查询结果</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_digital_output", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_digital_output(ref int handle, JKTYPE.IOType type, int index, ref bool result);
-
- /// <summary>
- /// 获取模拟量输入变量(AI)的值
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="type">AI的类型</param>
- /// <param name="index">AI索引</param>
- /// <param name="result">指定AI状态查询结果</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_analog_input", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_analog_input(ref int handle, JKTYPE.IOType type, int index, ref float result);
-
- /// <summary>
- /// 获取模拟量输出变量(AO)的值
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="type">AO的类型</param>
- /// <param name="index">AO索引</param>
- /// <param name="result">指定AO状态查询结果</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_analog_output", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_analog_output(ref int handle, JKTYPE.IOType type, int index, ref float result);
-
- /// <summary>
- /// 查询扩展IO模块是否运行
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="is_running"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "is_extio_running", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int is_extio_running(ref int handle, ref bool is_running);
-
- /// <summary>
- /// 运行当前加载的作业程序
- /// </summary>
- /// <param name="handle"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "program_run", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int program_run(ref int handle);
-
- /// <summary>
- /// 暂停当前运行的作业程序
- /// </summary>
- /// <param name="handle"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "program_pause", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int program_pause(ref int handle);
-
- /// <summary>
- /// 继续运行当前暂停的作业程序
- /// </summary>
- /// <param name="handle"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "program_resume", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int program_resume(ref int handle);
-
- /// <summary>
- /// 终止当前执行的作业程序
- /// </summary>
- /// <param name="handle"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "program_abort", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int program_abort(ref int handle);
-
- /// <summary>
- /// 加载指定的作业程序
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="file">程序文件路径</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "program_load", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int program_load(ref int handle, char[] file);
-
- /// <summary>
- /// 获取已加载的作业程序名字
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="file"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_loaded_program", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_loaded_program(ref int handle, StringBuilder file);
-
- /// <summary>
- /// 获取当前机器人作业程序的执行行号
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="curr_line">当前行号查询结果</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_current_line", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_current_line(ref int handle, ref int curr_line);
-
- /// <summary>
- /// 获取机器人作业程序执行状态
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="status">作业程序执行状态查询结果</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_program_state", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_program_state(ref int handle, ref JKTYPE.ProgramState status);
-
- /// <summary>
- /// 设置机器人运行倍率
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="rapid_rate">是程序运行倍率,设置范围为[0,1]</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_rapidrate", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_rapidrate(ref int handle, double rapid_rate);
-
- /// <summary>
- /// 获取机器人运行倍率
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="rapid_rate">当前控制系统倍率</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_rapidrate", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_rapidrate(ref int handle, ref double rapid_rate);
-
- /// <summary>
- /// 设置指定编号的工具信息
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="id">工具编号</param>
- /// <param name="tcp">工具坐标系相对法兰坐标系偏置</param>
- /// <param name="name">指定工具的别名</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_tool_data", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_tool_data(ref int handle, int id, ref JKTYPE.CartesianPose tcp, char[] name);
-
- /// <summary>
- /// 查询使用的工具信息
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="id">工具ID查询结果</param>
- /// <param name="tcp">工具坐标系相对法兰坐标系偏置</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_tool_data", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_tool_data(ref int handle, ref int id, ref JKTYPE.CartesianPose tcp);
-
- /// <summary>
- /// 设置当前使用的工具ID
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="id">工具坐标系ID</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_tool_id", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_tool_id(ref int handle, int id);
-
- /// <summary>
- /// 查询当前使用的工具ID
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="id">工具ID查询结果</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_tool_id", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_tool_id(ref int handle, ref int id);
-
- /// <summary>
- /// 设置指定编号的用户坐标系信息
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="id">用户坐标系编号</param>
- /// <param name="user_frame">用户坐标系偏置值</param>
- /// <param name="name">用户坐标系别名</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_user_frame_data", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_user_frame_data(ref int handle, int id, ref JKTYPE.CartesianPose user_frame, char[] name);
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="id"></param>
- /// <param name="user_frame"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_user_frame_data", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_user_frame_data(ref int handle, ref int id, ref JKTYPE.CartesianPose user_frame);
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="id"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_user_frame_id", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_user_frame_id(ref int handle, int id);
-
- /// <summary>
- /// 查询当前使用的用户坐标系ID
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="id">获取的结果</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_user_frame_id", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_user_frame_id(ref int handle, ref int id);
-
- /// <summary>
- /// 控制机器人进入或退出拖拽模式
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="enable">TRUE为进入拖拽模式,FALSE为退出拖拽模式</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "drag_mode_enable", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int drag_mode_enable(ref int handle, bool enable);
-
- /// <summary>
- /// 查询机器人是否处于拖拽模式
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="in_drag"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "is_in_drag_mode", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int is_in_drag_mode(ref int handle, ref bool in_drag);
-
- /// <summary>
- /// 获取机器人状态
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="state">机器人状态查询结果</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_robot_state", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_robot_state(ref int handle, ref JKTYPE.RobotState state);
-
- /// <summary>
- /// 获取当前设置下工具末端的位姿
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="tcp_position">工具末端位置查询结果</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_tcp_position", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_tcp_position(ref int handle, ref JKTYPE.CartesianPose tcp_position);
-
- /// <summary>
- /// 获取当前机器人关节角度
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="joint_position">关节角度查询结果</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_joint_position", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_joint_position(ref int handle, ref JKTYPE.JointValue joint_position);
-
- /// <summary>
- /// 查询机器人是否处于碰撞保护模式
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="in_collision">查询结果</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "is_in_collision", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int is_in_collision(ref int handle, ref bool in_collision);
-
- /// <summary>
- /// 查询机器人是否超出限位
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="on_limit">查询结果</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "is_on_limit", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int is_on_limit(ref int handle, ref bool on_limit);
-
- /// <summary>
- /// 查询机器人运动是否停止
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="in_pos"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "is_in_pos", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int is_in_pos(ref int handle, ref bool in_pos);
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="handle"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "collision_recover", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int collision_recover(ref int handle);
-
- /// <summary>
- /// 设置机器人碰撞等级
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="level">碰撞等级,等级0-5 ,0为关闭碰撞,1为碰撞阈值25N,2为碰撞阈值50N,3为碰撞阈值75N,4为碰撞阈值100N,5为碰撞阈值125N</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_collision_level", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_collision_level(ref int handle, int level);
-
- /// <summary>
- /// 获取机器人设置的碰撞等级
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="level">碰撞等级,等级0-5 ,0为关闭碰撞,1为碰撞阈值25N,2为碰撞阈值50N,3为碰撞阈值75N,4为碰撞阈值100N,5为碰撞阈值125N</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_collision_level", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_collision_level(ref int handle, ref int level);
-
- /// <summary>
- /// 计算指定位姿在当前工具、当前安装角度以及当前用户坐标系设置下的逆解
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="ref_pos"></param>
- /// <param name="cartesian_pose"></param>
- /// <param name="joint_pos"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "kine_inverse", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int kine_inverse(ref int handle, ref JKTYPE.JointValue ref_pos, ref JKTYPE.CartesianPose cartesian_pose, ref JKTYPE.JointValue joint_pos);
-
- /// <summary>
- /// 计算指定关节位置在当前工具、当前安装角度以及当前用户坐标系设置下的位姿值
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="joint_pos">关节空间位置</param>
- /// <param name="cartesian_pose">笛卡尔空间位姿计算结果</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "kine_forward", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int kine_forward(ref int handle, ref JKTYPE.JointValue joint_pos, ref JKTYPE.CartesianPose cartesian_pose);
-
- /// <summary>
- /// 欧拉角到旋转矩阵的转换
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="rpy">待转换的欧拉角数据</param>
- /// <param name="rot_matrix">转换后的旋转矩阵</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "rpy_to_rot_matrix", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int rpy_to_rot_matrix(ref int handle, ref JKTYPE.Rpy rpy, ref JKTYPE.RotMatrix rot_matrix);
-
- /// <summary>
- /// 旋转矩阵到欧拉角的转换
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="rot_matrix">待转换的旋转矩阵数据</param>
- /// <param name="rpy">转换后的RPY欧拉角结果</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "rot_matrix_to_rpy", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int rot_matrix_to_rpy(ref int handle, ref JKTYPE.RotMatrix rot_matrix, ref JKTYPE.Rpy rpy);
-
- /// <summary>
- /// 四元数到旋转矩阵的转换
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="quaternion">待转换的四元数数据</param>
- /// <param name="rot_matrix">转换后的旋转矩阵结果</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "quaternion_to_rot_matrix", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int quaternion_to_rot_matrix(ref int handle, ref JKTYPE.Quaternion quaternion, ref JKTYPE.RotMatrix rot_matrix);
-
- /// <summary>
- /// 旋转矩阵到四元数的转换
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="rot_matrix">待转换的旋转矩阵</param>
- /// <param name="quaternion">转换后的四元数结果</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "rot_matrix_to_quaternion", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int rot_matrix_to_quaternion(ref int handle, ref JKTYPE.RotMatrix rot_matrix, ref JKTYPE.Quaternion quaternion);
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="enable"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "torque_control_enable", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int torque_control_enable(ref int handle, bool enable);
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="tor_val"></param>
- /// <param name="grv_flag"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "torque_feedforward", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int torque_feedforward(ref int handle, JKTYPE.TorqueValue tor_val, int grv_flag);
-
- /// <summary>
- /// 机器人负载设置
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="payload">负载质心、质量数据</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_payload", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_payload(ref int handle, ref JKTYPE.PayLoad payload);
-
- /// <summary>
- /// 获取机器人负载数据
- /// </summary>
- /// <param name="handle"></param>
- /// <param name="payload">负载查询结果</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_payload", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_payload(ref int handle, ref JKTYPE.PayLoad payload);
-
- /// <summary>
- /// 注册机器人出现错误时的回调函数
- /// </summary>
- /// <param name="i"></param>
- /// <param name="func">指向用户定义的函数的函数指针</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_error_handler", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_error_handler(ref int i, CallBackFuncType func);
-
- /// <summary>
- /// 获取SDK版本号
- /// </summary>
- /// <param name="i"></param>
- /// <param name="version">SDK版本号</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_sdk_version", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_sdk_version(ref int i, StringBuilder version);
-
- /// <summary>
- /// 获取机器人状态数据
- /// </summary>
- /// <param name="i"></param>
- /// <param name="status">机器人状态</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_robot_status", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_robot_status(ref int i, ref JKTYPE.RobotStatus status);
-
- /// <summary>
- /// 终止当前机械臂运动
- /// </summary>
- /// <param name="i"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "motion_abort", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int motion_abort(ref int i);
-
- /// <summary>
- /// 设置错误码文件路径,需要使用get_last_error接口时需要设置错误码文件路径,如果不使用get_last_error接口,则不需要设置该接口
- /// </summary>
- /// <param name="i"></param>
- /// <param name="path"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_errorcode_file_path", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_errorcode_file_path(ref int i, StringBuilder path);
-
- /// <summary>
- /// 获取机器人运行过程中最后一个错误码,当调用clear_error时,最后一个错误码会清零
- /// </summary>
- /// <param name="i"></param>
- /// <param name="code"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_last_error", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_last_error(ref int i, ref JKTYPE.ErrorCode code);
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="i"></param>
- /// <param name="mode"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_debug_mode", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_debug_mode(ref int i, bool mode);
-
- /// <summary>
- /// 设置是否开启调试模式,选择TRUE时,开始调试模式,此时会在标准输出流中输出调试信息,选择FALSE时,不输出调试信息
- /// </summary>
- /// <param name="i"></param>
- /// <param name="para"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_traj_config", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_traj_config(ref int i, ref JKTYPE.TrajTrackPara para);
-
- /// <summary>
- /// 获取轨迹复现配置参数
- /// </summary>
- /// <param name="i"></param>
- /// <param name="para">轨迹复现配置参数</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_traj_config", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_traj_config(ref int i, ref JKTYPE.TrajTrackPara para);
-
- /// <summary>
- /// 采集轨迹复现数据控制开关
- /// </summary>
- /// <param name="i"></param>
- /// <param name="mode">选择TRUE时,开始数据采集,选择FALSE时,结束数据采集</param>
- /// <param name="filename">采集数据的存储文件名,当filename为空指针时,存储文件以当前日期命名</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_traj_sample_mode", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_traj_sample_mode(ref int i, bool mode, char[] filename);
-
- /// <summary>
- /// 采集轨迹复现数据状态查询
- /// </summary>
- /// <param name="i"></param>
- /// <param name="sample_statuse">为TRUE时,数据正在采集,为FALSE时,数据采集结束,在数据采集状态时不允许再次开启数据采集开关</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_traj_sample_status", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_traj_sample_status(ref int i, ref bool sample_statuse);
-
- /// <summary>
- /// 查询控制器中已经存在的轨迹复现数据的文件名
- /// </summary>
- /// <param name="i"></param>
- /// <param name="filename">控制器中已经存在的轨迹复现数据的文件名</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_exist_traj_file_name", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_exist_traj_file_name(ref int i, ref JKTYPE.MultStrStorType filename);
-
- /// <summary>
- /// 重命名轨迹复现数据的文件名
- /// </summary>
- /// <param name="i"></param>
- /// <param name="src">原文件名</param>
- /// <param name="dest">目标文件名,文件名长度不能超过100个字符,文件名不能为空,目标文件名不支持中文</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "rename_traj_file_name", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int rename_traj_file_name(ref int i, ref char[] src, ref char[] dest);
-
- /// <summary>
- /// 删除控制器中轨迹复现数据文件
- /// </summary>
- /// <param name="i"></param>
- /// <param name="filename">要删除的文件的文件名,文件名为数据文件名字</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "remove_traj_file", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int remove_traj_file(ref int i, char[] filename);
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="i"></param>
- /// <param name="filename"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "generate_traj_exe_file", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int generate_traj_exe_file(ref int i, char[] filename);
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="i"></param>
- /// <param name="joint_pos"></param>
- /// <param name="move_mode"></param>
- /// <param name="is_block"></param>
- /// <param name="speed"></param>
- /// <param name="acc"></param>
- /// <param name="tol"></param>
- /// <param name="option_cond"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "joint_move_extend", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int joint_move_extend(ref int i, ref JKTYPE.JointValue joint_pos, JKTYPE.MoveMode move_mode, bool is_block, double speed, double acc, double tol, ref JKTYPE.OptionalCond option_cond);
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="i"></param>
- /// <param name="cart_pos"></param>
- /// <param name="move_mode"></param>
- /// <param name="is_block"></param>
- /// <param name="speed"></param>
- /// <param name="acc"></param>
- /// <param name="tol"></param>
- /// <param name="option_cond"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "linear_move_extend", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int linear_move_extend(ref int i, ref JKTYPE.CartesianPose cart_pos, JKTYPE.MoveMode move_mode, bool is_block, double speed, double acc, double tol, ref JKTYPE.OptionalCond option_cond);
-
- /// <summary>
- /// 机器人末端圆弧运动
- /// </summary>
- /// <param name="i"></param>
- /// <param name="end_pos">机器人末端运动目标位置</param>
- /// <param name="mid_pos">机器人末端运中间点</param>
- /// <param name="move_mode">指定运动模式:增量运动(相对运动)或绝对运动</param>
- /// <param name="is_block">设置接口是否为阻塞接口,TRUE 为阻塞接口 FALSE 为非阻塞接口</param>
- /// <param name="speed">机器人圆弧运动速度,单位:rad/s</param>
- /// <param name="acc">机器人圆弧运动加速度,单位:rad/s^2</param>
- /// <param name="tol">机器人圆弧运动终点误差, 单位mm</param>
- /// <param name="option_cond">机器人关节可选参数,如果不需要,该值可不赋值,填入空指针就可</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "circular_move", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int circular_move(ref int i, ref JKTYPE.CartesianPose end_pos, ref JKTYPE.CartesianPose mid_pos, JKTYPE.MoveMode move_mode, bool is_block, double speed, double acc, double tol, ref JKTYPE.OptionalCond option_cond);
-
- /// <summary>
- /// SERVO模式下不使用滤波器,该指令在SERVO模式下不可设置,退出SERVO后可设置
- /// </summary>
- /// <param name="i"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "servo_move_use_none_filter", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int servo_move_use_none_filter(ref int i);
-
- /// <summary>
- /// SERVO模式下关节空间一阶低通滤波,该指令在SERVO模式下不可设置,退出SERVO后可设置
- /// </summary>
- /// <param name="i"></param>
- /// <param name="cutoffFreq">一阶低通滤波器截止频率</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "servo_move_use_joint_LPF", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int servo_move_use_joint_LPF(ref int i, double cutoffFreq);
-
- /// <summary>
- /// SERVO模式下关节空间非线性滤波,该指令在SERVO模式下不可设置,退出SERVO后可设置
- /// </summary>
- /// <param name="i"></param>
- /// <param name="max_vr">笛卡尔空间姿态变化速度的速度上限值(绝对值)°/s</param>
- /// <param name="max_ar">笛卡尔空间姿态变化速度的加速度上限值(绝对值)°/s^2</param>
- /// <param name="max_jr">笛卡尔空间姿态变化速度的加加速度上限值(绝对值)°/s^3</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "servo_move_use_joint_NLF", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int servo_move_use_joint_NLF(ref int i, double max_vr, double max_ar, double max_jr);
-
- /// <summary>
- /// SERVO模式下笛卡尔空间非线性滤波,该指令在SERVO模式下不可设置,退出SERVO后可设置
- /// </summary>
- /// <param name="i"></param>
- /// <param name="max_vp">笛卡尔空间下移动指令速度的上限值(绝对值)。单位:mm/s</param>
- /// <param name="max_ap">笛卡尔空间下移动指令加速度的上限值(绝对值)。单位:mm/s^2</param>
- /// <param name="max_jp">笛卡尔空间下移动指令加加速度的上限值(绝对值)单位:mm/s^3</param>
- /// <param name="max_vr">笛卡尔空间姿态变化速度的速度上限值(绝对值)°/s</param>
- /// <param name="max_ar">笛卡尔空间姿态变化速度的加速度上限值(绝对值)°/s^2</param>
- /// <param name="max_jr">笛卡尔空间姿态变化速度的加加速度上限值(绝对值)°/s^3</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "servo_move_use_carte_NLF", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int servo_move_use_carte_NLF(ref int i, double max_vp, double max_ap, double max_jp, double max_vr, double max_ar, double max_jr);
-
- /// <summary>
- /// SERVO模式下关节空间多阶均值滤波器,该指令在SERVO模式下不可设置,退出SERVO后可设置
- /// </summary>
- /// <param name="i"></param>
- /// <param name="max_buf">均值滤波器缓冲区的大小</param>
- /// <param name="kp">加速度滤波系数</param>
- /// <param name="kv">速度滤波系数</param>
- /// <param name="ka">位置滤波系数</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "servo_move_use_joint_MMF", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int servo_move_use_joint_MMF(ref int i, int max_buf, double kp, double kv, double ka);
-
- /// <summary>
- /// SERVO模式下速度前瞻参数设置
- /// </summary>
- /// <param name="i"></param>
- /// <param name="max_buf">缓冲区的大小</param>
- /// <param name="kp">加速度滤波系数</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "servo_speed_foresight", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int servo_speed_foresight(ref int i, int max_buf, double kp);
-
- /// <summary>
- /// 设置SDK日志路径
- /// </summary>
- /// <param name="i"></param>
- /// <param name="filepath">SDK日志路径</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_SDK_filepath", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_SDK_filepath(ref int i, ref char[] filepath);
-
- /// <summary>
- /// 设置传感器品牌
- /// </summary>
- /// <param name="i"></param>
- /// <param name="sensor_brand">传感器品牌,可选值为1,2,3 分别代表不同品牌力矩传感器</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_torsenosr_brand", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_torsenosr_brand(ref int i, int sensor_brand);
-
- /// <summary>
- /// 获取传感器品牌
- /// </summary>
- /// <param name="i"></param>
- /// <param name="sensor_brand">传感器品牌,可选值为1,2,3 分别代表不同品牌力矩传感器</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_torsenosr_brand", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_torsenosr_brand(ref int i, ref int sensor_brand);
-
- /// <summary>
- /// 开启或关闭力矩传感器
- /// </summary>
- /// <param name="i"></param>
- /// <param name="sensor_mode">0代表关闭传感器,1代表开启力矩传感器</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_torque_sensor_mode", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_torque_sensor_mode(ref int i, int sensor_mode);
-
- /// <summary>
- /// 设置柔顺控制参数
- /// </summary>
- /// <param name="i"></param>
- /// <param name="axis">代表配置哪一轴,可选值为0~5</param>
- /// <param name="opt">柔顺方向,可选值为 1 2 3 4 5 6分别对应 fx fy fz mx my mz 0代表没有勾选</param>
- /// <param name="ftUser">阻尼力,表示用户用多大的力才能让机器人的沿着某个方向以最大速度进行运动</param>
- /// <param name="ftConstant">回弹力,表示机器人回到初始状态的能力</param>
- /// <param name="ftNnormalTrack">代表恒力,手动操作时全部设置为0</param>
- /// <param name="ftReboundFK">法向跟踪,手动操作时全部设置为0,</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_admit_ctrl_config", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_admit_ctrl_config(ref int i, int axis, int opt, int ftUser, int ftConstant, int ftNnormalTrack, int ftReboundFK);
-
- /// <summary>
- /// 开始辨识工具末端负载
- /// </summary>
- /// <param name="i"></param>
- /// <param name="joint_pos">使用力矩传感器进行自动负载辨识时的结束位置</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "start_torq_sensor_payload_identify", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int start_torq_sensor_payload_identify(ref int i, ref JKTYPE.JointValue joint_pos);
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="i"></param>
- /// <param name="identify_status"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_torq_sensor_identify_staus", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_torq_sensor_identify_staus(ref int i, ref int identify_status);
-
- /// <summary>
- /// 获取末端负载辨识结果
- /// </summary>
- /// <param name="i"></param>
- /// <param name="payload">末端负载</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_torq_sensor_payload_identify_result", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_torq_sensor_payload_identify_result(ref int i, ref JKTYPE.PayLoad payload);
-
- /// <summary>
- /// 设置传感器末端负载
- /// </summary>
- /// <param name="i"></param>
- /// <param name="payload">末端负载</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_torq_sensor_tool_payload", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_torq_sensor_tool_payload(ref int i, ref JKTYPE.PayLoad payload);
-
- /// <summary>
- /// 获取传感器末端负载
- /// </summary>
- /// <param name="i"></param>
- /// <param name="payload">末端负载</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_torq_sensor_tool_payload", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_torq_sensor_tool_payload(ref int i, ref JKTYPE.PayLoad payload);
-
- /// <summary>
- /// 力控拖拽使能
- /// </summary>
- /// <param name="i"></param>
- /// <param name="enable_flag">0为关闭力控拖拽使能,1为开启</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "enable_admittance_ctrl", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int enable_admittance_ctrl(ref int i, int enable_flag);
-
- /// <summary>
- /// 设置力控类型和传感器初始化状态
- /// </summary>
- /// <param name="i"></param>
- /// <param name="sensor_compensation">是否开启传感器补偿,1代表开启即初始化,0代表不初始化</param>
- /// <param name="compliance_type">0 代表不使用任何一种柔顺控制方法 1 代表恒力柔顺控制,2 代表速度柔顺控制</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_compliant_type", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_compliant_type(ref int i, int sensor_compensation, int compliance_type);
-
- /// <summary>
- /// 获取力控类型和传感器初始化状态
- /// </summary>
- /// <param name="i"></param>
- /// <param name="sensor_compensation">是否开启传感器补偿,1代表开启即初始化,0代表不初始化</param>
- /// <param name="compliance_type">0 代表不使用任何一种柔顺控制方法 1 代表恒力柔顺控制,2 代表速度柔顺控制</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_compliant_type", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_compliant_type(ref int i, ref int sensor_compensation, ref int compliance_type);
-
- /// <summary>
- /// 错误状态清除
- /// </summary>
- /// <param name="i"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "clear_error", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int clear_error(ref int i);
-
- /// <summary>
- /// 获取力控柔顺控制参数
- /// </summary>
- /// <param name="i"></param>
- /// <param name="admit_ctrl_cfg">机器人力控柔顺控制参数存储地址</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_admit_ctrl_config", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_admit_ctrl_config(ref int i, ref JKTYPE.RobotAdmitCtrl admit_ctrl_cfg);
-
- /// <summary>
- /// 设置力控传感器ip地址
- /// </summary>
- /// <param name="i"></param>
- /// <param name="type"> 0为使用tcp/ip协议,1为使用RS485协议</param>
- /// <param name="ip_addr">为力控传感器地址</param>
- /// <param name="port">为使用tcp/ip协议时力控传感器端口号</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_torque_sensor_comm", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_torque_sensor_comm(ref int i, int type, ref char[] ip_addr, int port);
-
- /// <summary>
- /// 获取力控传感器ip地址
- /// </summary>
- /// <param name="i"></param>
- /// <param name="type">0为使用tcp/ip协议,1为使用RS485协议</param>
- /// <param name="ip_addr">力控传感器地址</param>
- /// <param name="port">使用tcp/ip协议时力控传感器端口号</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "get_torque_sensor_comm", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int get_torque_sensor_comm(ref int i, ref int type, ref byte ip_addr, ref int port);
-
- /// <summary>
- /// 关闭力控
- /// </summary>
- /// <param name="i"></param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "disable_force_control", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int disable_force_control(ref int i);
-
- /// <summary>
- /// 设置速度柔顺控制参数
- /// </summary>
- /// <param name="i"></param>
- /// <param name="vel">速度柔顺控制参数</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_vel_compliant_ctrl", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_vel_compliant_ctrl(ref int i, ref JKTYPE.VelCom vel);
-
- /// <summary>
- /// 设置柔顺控制力矩条件
- /// </summary>
- /// <param name="i"></param>
- /// <param name="ft">ft为柔顺控制力矩条件</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_compliance_condition", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_compliance_condition(ref int i, ref JKTYPE.FTxyz ft);
-
- /// <summary>
- /// 设置网络异常,SDK与机器人控制器失去连接后多长时间机器人控制器终止机械臂当前运动
- /// </summary>
- /// <param name="i"></param>
- /// <param name="millisecond"> 时间参数,单位毫秒</param>
- /// <param name="mnt">网络异常时机器人需要进行的动作类型</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_network_exception_handle", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_network_exception_handle(ref int i, float millisecond, JKTYPE.ProcessType mnt);
-
- /// <summary>
- /// 设置机器人状态数据自动更新时间间隔
- /// </summary>
- /// <param name="i"></param>
- /// <param name="millisecond">时间参数,单位毫秒</param>
- /// <returns></returns>
- [DllImport("jakaAPI.dll", EntryPoint = "set_status_data_update_time_interval", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- public static extern int set_status_data_update_time_interval(ref int i, float millisecond);
- }
- }
|