using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; namespace BPASmartClient.JakaRobot { delegate void CallBackFuncType(int error_code); class jakaAPI { /// /// 获取版本控制器的Ip /// /// /// /// [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); /// /// 创建机器人控制句柄 /// /// /// /// [DllImport("jakaAPI.dll", EntryPoint = "create_handler", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int create_handler(char[] ip, ref int handle); /// /// 断开机器人控制句柄 /// /// /// [DllImport("jakaAPI.dll", EntryPoint = "destory_handler", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int destory_handler(ref int handle); /// /// 打开机器人电源 /// /// 机器人控制句柄 /// ERR_SUCC 成功 其他失败 [DllImport("jakaAPI.dll", EntryPoint = "power_on", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int power_on(ref int handle); /// /// 关闭机器人电源 /// /// 机器人控制句柄 /// ERR_SUCC 成功 其他失败 [DllImport("jakaAPI.dll", EntryPoint = "power_off", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int power_off(ref int handle); /// /// 机器人控制柜关机 /// /// /// ERR_SUCC 成功 其他失败 [DllImport("jakaAPI.dll", EntryPoint = "shut_down", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int shut_down(ref int handle); /// /// 控制机器人上使能 /// /// /// [DllImport("jakaAPI.dll", EntryPoint = "enable_robot", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int enable_robot(ref int handle); /// /// 控制机器人下使能 /// /// /// [DllImport("jakaAPI.dll", EntryPoint = "disable_robot", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int disable_robot(ref int handle); /// /// 控制机器人手动模式下运动 /// /// /// 标识值,在关节空间下代表关节号0-5,笛卡尔下依次为x,y,z,rx,ry,rz /// 机器人运动模式,增量运动或者连续运动 /// 机器人运动坐标系,工具坐标系,基坐标系(当前的世界/用户坐标系)或关节空间 /// 指令速度,旋转轴或关节运动单位为rad/s,移动轴单位为mm/s /// 指令位置,旋转轴或关节运动单位为rad,移动轴单位为mm /// [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); /// /// 控制机器人手动模式下运动停止 /// /// /// /// [DllImport("jakaAPI.dll", EntryPoint = "jog_stop", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int jog_stop(ref int handle, ref int num); /// /// 机器人关节运动 /// /// /// 机器人关节运动目标位置 /// 指定运动模式:增量运动(相对运动)或绝对运动 /// 设置接口是否为阻塞接口,TRUE为阻塞接口 FALSE为非阻塞接口 /// 机器人关节运动速度,单位:rad/s /// [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); /// /// 机器人末端直线运动 /// /// /// 机器人末端运动目标位置 /// 指定运动模式:增量运动(相对运动)或绝对运动 /// 设置接口是否为阻塞接口,TRUE 为阻塞接口 FALSE 为非阻塞接口 /// 机器人直线运动速度,单位:mm/s /// [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); /// /// 机器人SERVO MOVE模式使能 /// /// /// TRUE为进入SERVO MOVE模式,FALSE表示退出该模式 /// [DllImport("jakaAPI.dll", EntryPoint = "servo_move_enable", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int servo_move_enable(ref int handle, bool enable); /// /// 机器人关节空间位置控制模式 /// /// /// 机器人关节运动目标位置 /// 指定运动模式:增量运动或绝对运动 /// [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); /// /// 机器人关节空间位置控制模式 /// /// /// 机器人关节运动目标位置 /// 指定运动模式:增量运动或绝对运动 /// 倍分周期,servo_j运动周期为step_num*8ms,其中step_num>=1 /// [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); /// /// 机器人笛卡尔空间位置控制模式 /// /// /// 机器人笛卡尔空间运动目标位置 /// 指定运动模式:增量运动或绝对运动 /// [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); /// /// 机器人笛卡尔空间位置控制模式 /// /// /// 机器人笛卡尔空间运动目标位置 /// 指定运动模式:增量运动或绝对运动 /// 倍分周期,servo_p运动周期为step_num*8ms,其中step_num>=1 /// [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); /// /// 设置数字输出变量(DO)的值 /// /// /// type DO类型 /// index DO索引 /// value DO设置值 /// [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); /// /// 设置模拟输出变量的值(AO)的值 /// /// /// AO类型 /// AO索引 /// AO设置值 /// [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); /// /// 查询数字输入(DI)状态 /// /// /// DI类型 /// DI索引 /// DI状态查询结果 /// [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); /// /// 查询数字输出(DO)状态 /// /// /// DO类型 /// DO索引 /// DO状态查询结果 /// [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); /// /// 获取模拟量输入变量(AI)的值 /// /// /// AI的类型 /// AI索引 /// 指定AI状态查询结果 /// [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); /// /// 获取模拟量输出变量(AO)的值 /// /// /// AO的类型 /// AO索引 /// 指定AO状态查询结果 /// [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); /// /// 查询扩展IO模块是否运行 /// /// /// /// [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); /// /// 运行当前加载的作业程序 /// /// /// [DllImport("jakaAPI.dll", EntryPoint = "program_run", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int program_run(ref int handle); /// /// 暂停当前运行的作业程序 /// /// /// [DllImport("jakaAPI.dll", EntryPoint = "program_pause", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int program_pause(ref int handle); /// /// 继续运行当前暂停的作业程序 /// /// /// [DllImport("jakaAPI.dll", EntryPoint = "program_resume", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int program_resume(ref int handle); /// /// 终止当前执行的作业程序 /// /// /// [DllImport("jakaAPI.dll", EntryPoint = "program_abort", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int program_abort(ref int handle); /// /// 加载指定的作业程序 /// /// /// 程序文件路径 /// [DllImport("jakaAPI.dll", EntryPoint = "program_load", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int program_load(ref int handle, char[] file); /// /// 获取已加载的作业程序名字 /// /// /// /// [DllImport("jakaAPI.dll", EntryPoint = "get_loaded_program", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int get_loaded_program(ref int handle, StringBuilder file); /// /// 获取当前机器人作业程序的执行行号 /// /// /// 当前行号查询结果 /// [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); /// /// 获取机器人作业程序执行状态 /// /// /// 作业程序执行状态查询结果 /// [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); /// /// 设置机器人运行倍率 /// /// /// 是程序运行倍率,设置范围为[0,1] /// [DllImport("jakaAPI.dll", EntryPoint = "set_rapidrate", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int set_rapidrate(ref int handle, double rapid_rate); /// /// 获取机器人运行倍率 /// /// /// 当前控制系统倍率 /// [DllImport("jakaAPI.dll", EntryPoint = "get_rapidrate", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int get_rapidrate(ref int handle, ref double rapid_rate); /// /// 设置指定编号的工具信息 /// /// /// 工具编号 /// 工具坐标系相对法兰坐标系偏置 /// 指定工具的别名 /// [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); /// /// 查询使用的工具信息 /// /// /// 工具ID查询结果 /// 工具坐标系相对法兰坐标系偏置 /// [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); /// /// 设置当前使用的工具ID /// /// /// 工具坐标系ID /// [DllImport("jakaAPI.dll", EntryPoint = "set_tool_id", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int set_tool_id(ref int handle, int id); /// /// 查询当前使用的工具ID /// /// /// 工具ID查询结果 /// [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); /// /// 设置指定编号的用户坐标系信息 /// /// /// 用户坐标系编号 /// 用户坐标系偏置值 /// 用户坐标系别名 /// [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); /// /// /// /// /// /// /// [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); /// /// /// /// /// /// [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); /// /// 查询当前使用的用户坐标系ID /// /// /// 获取的结果 /// [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); /// /// 控制机器人进入或退出拖拽模式 /// /// /// TRUE为进入拖拽模式,FALSE为退出拖拽模式 /// [DllImport("jakaAPI.dll", EntryPoint = "drag_mode_enable", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int drag_mode_enable(ref int handle, bool enable); /// /// 查询机器人是否处于拖拽模式 /// /// /// /// [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); /// /// 获取机器人状态 /// /// /// 机器人状态查询结果 /// [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); /// /// 获取当前设置下工具末端的位姿 /// /// /// 工具末端位置查询结果 /// [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); /// /// 获取当前机器人关节角度 /// /// /// 关节角度查询结果 /// [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); /// /// 查询机器人是否处于碰撞保护模式 /// /// /// 查询结果 /// [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); /// /// 查询机器人是否超出限位 /// /// /// 查询结果 /// [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); /// /// 查询机器人运动是否停止 /// /// /// /// [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); /// /// /// /// /// [DllImport("jakaAPI.dll", EntryPoint = "collision_recover", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int collision_recover(ref int handle); /// /// 设置机器人碰撞等级 /// /// /// 碰撞等级,等级0-5 ,0为关闭碰撞,1为碰撞阈值25N,2为碰撞阈值50N,3为碰撞阈值75N,4为碰撞阈值100N,5为碰撞阈值125N /// [DllImport("jakaAPI.dll", EntryPoint = "set_collision_level", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int set_collision_level(ref int handle, int level); /// /// 获取机器人设置的碰撞等级 /// /// /// 碰撞等级,等级0-5 ,0为关闭碰撞,1为碰撞阈值25N,2为碰撞阈值50N,3为碰撞阈值75N,4为碰撞阈值100N,5为碰撞阈值125N /// [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); /// /// 计算指定位姿在当前工具、当前安装角度以及当前用户坐标系设置下的逆解 /// /// /// /// /// /// [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); /// /// 计算指定关节位置在当前工具、当前安装角度以及当前用户坐标系设置下的位姿值 /// /// /// 关节空间位置 /// 笛卡尔空间位姿计算结果 /// [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); /// /// 欧拉角到旋转矩阵的转换 /// /// /// 待转换的欧拉角数据 /// 转换后的旋转矩阵 /// [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); /// /// 旋转矩阵到欧拉角的转换 /// /// /// 待转换的旋转矩阵数据 /// 转换后的RPY欧拉角结果 /// [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); /// /// 四元数到旋转矩阵的转换 /// /// /// 待转换的四元数数据 /// 转换后的旋转矩阵结果 /// [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); /// /// 旋转矩阵到四元数的转换 /// /// /// 待转换的旋转矩阵 /// 转换后的四元数结果 /// [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); /// /// /// /// /// /// [DllImport("jakaAPI.dll", EntryPoint = "torque_control_enable", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int torque_control_enable(ref int handle, bool enable); /// /// /// /// /// /// /// [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); /// /// 机器人负载设置 /// /// /// 负载质心、质量数据 /// [DllImport("jakaAPI.dll", EntryPoint = "set_payload", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int set_payload(ref int handle, ref JKTYPE.PayLoad payload); /// /// 获取机器人负载数据 /// /// /// 负载查询结果 /// [DllImport("jakaAPI.dll", EntryPoint = "get_payload", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int get_payload(ref int handle, ref JKTYPE.PayLoad payload); /// /// 注册机器人出现错误时的回调函数 /// /// /// 指向用户定义的函数的函数指针 /// [DllImport("jakaAPI.dll", EntryPoint = "set_error_handler", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int set_error_handler(ref int i, CallBackFuncType func); /// /// 获取SDK版本号 /// /// /// SDK版本号 /// [DllImport("jakaAPI.dll", EntryPoint = "get_sdk_version", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int get_sdk_version(ref int i, StringBuilder version); /// /// 获取机器人状态数据 /// /// /// 机器人状态 /// [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); /// /// 终止当前机械臂运动 /// /// /// [DllImport("jakaAPI.dll", EntryPoint = "motion_abort", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int motion_abort(ref int i); /// /// 设置错误码文件路径,需要使用get_last_error接口时需要设置错误码文件路径,如果不使用get_last_error接口,则不需要设置该接口 /// /// /// /// [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); /// /// 获取机器人运行过程中最后一个错误码,当调用clear_error时,最后一个错误码会清零 /// /// /// /// [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); /// /// /// /// /// /// [DllImport("jakaAPI.dll", EntryPoint = "set_debug_mode", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int set_debug_mode(ref int i, bool mode); /// /// 设置是否开启调试模式,选择TRUE时,开始调试模式,此时会在标准输出流中输出调试信息,选择FALSE时,不输出调试信息 /// /// /// /// [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); /// /// 获取轨迹复现配置参数 /// /// /// 轨迹复现配置参数 /// [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); /// /// 采集轨迹复现数据控制开关 /// /// /// 选择TRUE时,开始数据采集,选择FALSE时,结束数据采集 /// 采集数据的存储文件名,当filename为空指针时,存储文件以当前日期命名 /// [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); /// /// 采集轨迹复现数据状态查询 /// /// /// 为TRUE时,数据正在采集,为FALSE时,数据采集结束,在数据采集状态时不允许再次开启数据采集开关 /// [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); /// /// 查询控制器中已经存在的轨迹复现数据的文件名 /// /// /// 控制器中已经存在的轨迹复现数据的文件名 /// [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); /// /// 重命名轨迹复现数据的文件名 /// /// /// 原文件名 /// 目标文件名,文件名长度不能超过100个字符,文件名不能为空,目标文件名不支持中文 /// [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); /// /// 删除控制器中轨迹复现数据文件 /// /// /// 要删除的文件的文件名,文件名为数据文件名字 /// [DllImport("jakaAPI.dll", EntryPoint = "remove_traj_file", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int remove_traj_file(ref int i, char[] filename); /// /// /// /// /// /// [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); /// /// /// /// /// /// /// /// /// /// /// /// [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); /// /// /// /// /// /// /// /// /// /// /// /// [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); /// /// 机器人末端圆弧运动 /// /// /// 机器人末端运动目标位置 /// 机器人末端运中间点 /// 指定运动模式:增量运动(相对运动)或绝对运动 /// 设置接口是否为阻塞接口,TRUE 为阻塞接口 FALSE 为非阻塞接口 /// 机器人圆弧运动速度,单位:rad/s /// 机器人圆弧运动加速度,单位:rad/s^2 /// 机器人圆弧运动终点误差, 单位mm /// 机器人关节可选参数,如果不需要,该值可不赋值,填入空指针就可 /// [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); /// /// SERVO模式下不使用滤波器,该指令在SERVO模式下不可设置,退出SERVO后可设置 /// /// /// [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); /// /// SERVO模式下关节空间一阶低通滤波,该指令在SERVO模式下不可设置,退出SERVO后可设置 /// /// /// 一阶低通滤波器截止频率 /// [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); /// /// SERVO模式下关节空间非线性滤波,该指令在SERVO模式下不可设置,退出SERVO后可设置 /// /// /// 笛卡尔空间姿态变化速度的速度上限值(绝对值)°/s /// 笛卡尔空间姿态变化速度的加速度上限值(绝对值)°/s^2 /// 笛卡尔空间姿态变化速度的加加速度上限值(绝对值)°/s^3 /// [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); /// /// SERVO模式下笛卡尔空间非线性滤波,该指令在SERVO模式下不可设置,退出SERVO后可设置 /// /// /// 笛卡尔空间下移动指令速度的上限值(绝对值)。单位:mm/s /// 笛卡尔空间下移动指令加速度的上限值(绝对值)。单位:mm/s^2 /// 笛卡尔空间下移动指令加加速度的上限值(绝对值)单位:mm/s^3 /// 笛卡尔空间姿态变化速度的速度上限值(绝对值)°/s /// 笛卡尔空间姿态变化速度的加速度上限值(绝对值)°/s^2 /// 笛卡尔空间姿态变化速度的加加速度上限值(绝对值)°/s^3 /// [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); /// /// SERVO模式下关节空间多阶均值滤波器,该指令在SERVO模式下不可设置,退出SERVO后可设置 /// /// /// 均值滤波器缓冲区的大小 /// 加速度滤波系数 /// 速度滤波系数 /// 位置滤波系数 /// [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); /// /// SERVO模式下速度前瞻参数设置 /// /// /// 缓冲区的大小 /// 加速度滤波系数 /// [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); /// /// 设置SDK日志路径 /// /// /// SDK日志路径 /// [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); /// /// 设置传感器品牌 /// /// /// 传感器品牌,可选值为1,2,3 分别代表不同品牌力矩传感器 /// [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); /// /// 获取传感器品牌 /// /// /// 传感器品牌,可选值为1,2,3 分别代表不同品牌力矩传感器 /// [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); /// /// 开启或关闭力矩传感器 /// /// /// 0代表关闭传感器,1代表开启力矩传感器 /// [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); /// /// 设置柔顺控制参数 /// /// /// 代表配置哪一轴,可选值为0~5 /// 柔顺方向,可选值为 1 2 3 4 5 6分别对应 fx fy fz mx my mz 0代表没有勾选 /// 阻尼力,表示用户用多大的力才能让机器人的沿着某个方向以最大速度进行运动 /// 回弹力,表示机器人回到初始状态的能力 /// 代表恒力,手动操作时全部设置为0 /// 法向跟踪,手动操作时全部设置为0, /// [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); /// /// 开始辨识工具末端负载 /// /// /// 使用力矩传感器进行自动负载辨识时的结束位置 /// [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); /// /// /// /// /// /// [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); /// /// 获取末端负载辨识结果 /// /// /// 末端负载 /// [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); /// /// 设置传感器末端负载 /// /// /// 末端负载 /// [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); /// /// 获取传感器末端负载 /// /// /// 末端负载 /// [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); /// /// 力控拖拽使能 /// /// /// 0为关闭力控拖拽使能,1为开启 /// [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); /// /// 设置力控类型和传感器初始化状态 /// /// /// 是否开启传感器补偿,1代表开启即初始化,0代表不初始化 /// 0 代表不使用任何一种柔顺控制方法 1 代表恒力柔顺控制,2 代表速度柔顺控制 /// [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); /// /// 获取力控类型和传感器初始化状态 /// /// /// 是否开启传感器补偿,1代表开启即初始化,0代表不初始化 /// 0 代表不使用任何一种柔顺控制方法 1 代表恒力柔顺控制,2 代表速度柔顺控制 /// [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); /// /// 错误状态清除 /// /// /// [DllImport("jakaAPI.dll", EntryPoint = "clear_error", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int clear_error(ref int i); /// /// 获取力控柔顺控制参数 /// /// /// 机器人力控柔顺控制参数存储地址 /// [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); /// /// 设置力控传感器ip地址 /// /// /// 0为使用tcp/ip协议,1为使用RS485协议 /// 为力控传感器地址 /// 为使用tcp/ip协议时力控传感器端口号 /// [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); /// /// 获取力控传感器ip地址 /// /// /// 0为使用tcp/ip协议,1为使用RS485协议 /// 力控传感器地址 /// 使用tcp/ip协议时力控传感器端口号 /// [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); /// /// 关闭力控 /// /// /// [DllImport("jakaAPI.dll", EntryPoint = "disable_force_control", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)] public static extern int disable_force_control(ref int i); /// /// 设置速度柔顺控制参数 /// /// /// 速度柔顺控制参数 /// [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); /// /// 设置柔顺控制力矩条件 /// /// /// ft为柔顺控制力矩条件 /// [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); /// /// 设置网络异常,SDK与机器人控制器失去连接后多长时间机器人控制器终止机械臂当前运动 /// /// /// 时间参数,单位毫秒 /// 网络异常时机器人需要进行的动作类型 /// [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); /// /// 设置机器人状态数据自动更新时间间隔 /// /// /// 时间参数,单位毫秒 /// [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); } }