终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

jakaAPI.cs 57 KiB

2 vuotta sitten
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Runtime.InteropServices;
  4. using System.Text;
  5. namespace BPASmartClient.JakaRobot
  6. {
  7. delegate void CallBackFuncType(int error_code);
  8. class jakaAPI
  9. {
  10. /// <summary>
  11. /// 获取版本控制器的Ip
  12. /// </summary>
  13. /// <param name="controller_name"></param>
  14. /// <param name="ip"></param>
  15. /// <returns></returns>
  16. [DllImport("jakaAPI.dll", EntryPoint = "get_controller_ip", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  17. public static extern int get_controller_ip(char[] controller_name, ref byte ip);
  18. /// <summary>
  19. /// 创建机器人控制句柄
  20. /// </summary>
  21. /// <param name="ip"></param>
  22. /// <param name="handle"></param>
  23. /// <returns></returns>
  24. [DllImport("jakaAPI.dll", EntryPoint = "create_handler", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  25. public static extern int create_handler(char[] ip, ref int handle);
  26. /// <summary>
  27. /// 断开机器人控制句柄
  28. /// </summary>
  29. /// <param name="handle"></param>
  30. /// <returns></returns>
  31. [DllImport("jakaAPI.dll", EntryPoint = "destory_handler", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  32. public static extern int destory_handler(ref int handle);
  33. /// <summary>
  34. /// 打开机器人电源
  35. /// </summary>
  36. /// <param name="handle">机器人控制句柄</param>
  37. /// <returns>ERR_SUCC 成功 其他失败</returns>
  38. [DllImport("jakaAPI.dll", EntryPoint = "power_on", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  39. public static extern int power_on(ref int handle);
  40. /// <summary>
  41. /// 关闭机器人电源
  42. /// </summary>
  43. /// <param name="handle">机器人控制句柄</param>
  44. /// <returns>ERR_SUCC 成功 其他失败</returns>
  45. [DllImport("jakaAPI.dll", EntryPoint = "power_off", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  46. public static extern int power_off(ref int handle);
  47. /// <summary>
  48. /// 机器人控制柜关机
  49. /// </summary>
  50. /// <param name="handle"></param>
  51. /// <returns>ERR_SUCC 成功 其他失败</returns>
  52. [DllImport("jakaAPI.dll", EntryPoint = "shut_down", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  53. public static extern int shut_down(ref int handle);
  54. /// <summary>
  55. /// 控制机器人上使能
  56. /// </summary>
  57. /// <param name="handle"></param>
  58. /// <returns></returns>
  59. [DllImport("jakaAPI.dll", EntryPoint = "enable_robot", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  60. public static extern int enable_robot(ref int handle);
  61. /// <summary>
  62. /// 控制机器人下使能
  63. /// </summary>
  64. /// <param name="handle"></param>
  65. /// <returns></returns>
  66. [DllImport("jakaAPI.dll", EntryPoint = "disable_robot", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  67. public static extern int disable_robot(ref int handle);
  68. /// <summary>
  69. /// 控制机器人手动模式下运动
  70. /// </summary>
  71. /// <param name="handle"></param>
  72. /// <param name="aj_num">标识值,在关节空间下代表关节号0-5,笛卡尔下依次为x,y,z,rx,ry,rz</param>
  73. /// <param name="move_mode">机器人运动模式,增量运动或者连续运动</param>
  74. /// <param name="coord_type">机器人运动坐标系,工具坐标系,基坐标系(当前的世界/用户坐标系)或关节空间</param>
  75. /// <param name="vel_cmd">指令速度,旋转轴或关节运动单位为rad/s,移动轴单位为mm/s</param>
  76. /// <param name="pos_cmd">指令位置,旋转轴或关节运动单位为rad,移动轴单位为mm</param>
  77. /// <returns></returns>
  78. [DllImport("jakaAPI.dll", EntryPoint = "jog", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  79. 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);
  80. /// <summary>
  81. /// 控制机器人手动模式下运动停止
  82. /// </summary>
  83. /// <param name="handle"></param>
  84. /// <param name="num"></param>
  85. /// <returns></returns>
  86. [DllImport("jakaAPI.dll", EntryPoint = "jog_stop", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  87. public static extern int jog_stop(ref int handle, ref int num);
  88. /// <summary>
  89. /// 机器人关节运动
  90. /// </summary>
  91. /// <param name="handle"></param>
  92. /// <param name="joint_pos">机器人关节运动目标位置</param>
  93. /// <param name="move_mode">指定运动模式:增量运动(相对运动)或绝对运动</param>
  94. /// <param name="is_block">设置接口是否为阻塞接口,TRUE为阻塞接口 FALSE为非阻塞接口</param>
  95. /// <param name="speed">机器人关节运动速度,单位:rad/s</param>
  96. /// <returns></returns>
  97. [DllImport("jakaAPI.dll", EntryPoint = "joint_move", ExactSpelling = false, CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)]
  98. public static extern int joint_move(ref int handle, ref JKTYPE.JointValue joint_pos, JKTYPE.MoveMode move_mode, bool is_block, double speed);
  99. /// <summary>
  100. /// 机器人末端直线运动
  101. /// </summary>
  102. /// <param name="handle"></param>
  103. /// <param name="end_pos">机器人末端运动目标位置</param>
  104. /// <param name="move_mode">指定运动模式:增量运动(相对运动)或绝对运动</param>
  105. /// <param name="is_block">设置接口是否为阻塞接口,TRUE 为阻塞接口 FALSE 为非阻塞接口</param>
  106. /// <param name="speed">机器人直线运动速度,单位:mm/s</param>
  107. /// <returns></returns>
  108. [DllImport("jakaAPI.dll", EntryPoint = "linear_move", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  109. public static extern int linear_move(ref int handle, ref JKTYPE.CartesianPose end_pos, JKTYPE.MoveMode move_mode, bool is_block, double speed);
  110. /// <summary>
  111. /// 机器人SERVO MOVE模式使能
  112. /// </summary>
  113. /// <param name="handle"></param>
  114. /// <param name="enable">TRUE为进入SERVO MOVE模式,FALSE表示退出该模式</param>
  115. /// <returns></returns>
  116. [DllImport("jakaAPI.dll", EntryPoint = "servo_move_enable", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  117. public static extern int servo_move_enable(ref int handle, bool enable);
  118. /// <summary>
  119. /// 机器人关节空间位置控制模式
  120. /// </summary>
  121. /// <param name="handle"></param>
  122. /// <param name="joint_pos">机器人关节运动目标位置</param>
  123. /// <param name="move_mode">指定运动模式:增量运动或绝对运动</param>
  124. /// <returns></returns>
  125. [DllImport("jakaAPI.dll", EntryPoint = "servo_j", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  126. public static extern int servo_j(ref int handle, ref JKTYPE.JointValue joint_pos, JKTYPE.MoveMode move_mode);
  127. /// <summary>
  128. /// 机器人关节空间位置控制模式
  129. /// </summary>
  130. /// <param name="handle"></param>
  131. /// <param name="joint_pos">机器人关节运动目标位置</param>
  132. /// <param name="move_mode">指定运动模式:增量运动或绝对运动</param>
  133. /// <param name="step_num">倍分周期,servo_j运动周期为step_num*8ms,其中step_num>=1</param>
  134. /// <returns></returns>
  135. [DllImport("jakaAPI.dll", EntryPoint = "servo_j_extend", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  136. public static extern int servo_j_extend(ref int handle, ref JKTYPE.JointValue joint_pos, JKTYPE.MoveMode move_mode, int step_num);
  137. /// <summary>
  138. /// 机器人笛卡尔空间位置控制模式
  139. /// </summary>
  140. /// <param name="handle"></param>
  141. /// <param name="cartesian_pose">机器人笛卡尔空间运动目标位置</param>
  142. /// <param name="move_mode">指定运动模式:增量运动或绝对运动</param>
  143. /// <returns></returns>
  144. [DllImport("jakaAPI.dll", EntryPoint = "servo_p", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  145. public static extern int servo_p(ref int handle, ref JKTYPE.CartesianPose cartesian_pose, JKTYPE.MoveMode move_mode);
  146. /// <summary>
  147. /// 机器人笛卡尔空间位置控制模式
  148. /// </summary>
  149. /// <param name="handle"></param>
  150. /// <param name="cartesian_pose">机器人笛卡尔空间运动目标位置</param>
  151. /// <param name="move_mode">指定运动模式:增量运动或绝对运动</param>
  152. /// <param name="step_num">倍分周期,servo_p运动周期为step_num*8ms,其中step_num>=1</param>
  153. /// <returns></returns>
  154. [DllImport("jakaAPI.dll", EntryPoint = "servo_p_extend", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  155. public static extern int servo_p_extend(ref int handle, ref JKTYPE.CartesianPose cartesian_pose, JKTYPE.MoveMode move_mode, int step_num);
  156. /// <summary>
  157. /// 设置数字输出变量(DO)的值
  158. /// </summary>
  159. /// <param name="handle"></param>
  160. /// <param name="type">type DO类型</param>
  161. /// <param name="index">index DO索引</param>
  162. /// <param name="value">value DO设置值</param>
  163. /// <returns></returns>
  164. [DllImport("jakaAPI.dll", EntryPoint = "set_digital_output", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  165. public static extern int set_digital_output(ref int handle, JKTYPE.IOType type, int index, bool value);
  166. /// <summary>
  167. /// 设置模拟输出变量的值(AO)的值
  168. /// </summary>
  169. /// <param name="handle"></param>
  170. /// <param name="type"> AO类型</param>
  171. /// <param name="index">AO索引</param>
  172. /// <param name="value">AO设置值</param>
  173. /// <returns></returns>
  174. [DllImport("jakaAPI.dll", EntryPoint = "set_analog_output", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  175. public static extern int set_analog_output(ref int handle, JKTYPE.IOType type, int index, float value);
  176. /// <summary>
  177. /// 查询数字输入(DI)状态
  178. /// </summary>
  179. /// <param name="handle"></param>
  180. /// <param name="type">DI类型</param>
  181. /// <param name="index">DI索引</param>
  182. /// <param name="result">DI状态查询结果</param>
  183. /// <returns></returns>
  184. [DllImport("jakaAPI.dll", EntryPoint = "get_digital_input", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  185. public static extern int get_digital_input(ref int handle, JKTYPE.IOType type, int index, ref bool result);
  186. /// <summary>
  187. /// 查询数字输出(DO)状态
  188. /// </summary>
  189. /// <param name="handle"></param>
  190. /// <param name="type">DO类型</param>
  191. /// <param name="index">DO索引</param>
  192. /// <param name="result">DO状态查询结果</param>
  193. /// <returns></returns>
  194. [DllImport("jakaAPI.dll", EntryPoint = "get_digital_output", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  195. public static extern int get_digital_output(ref int handle, JKTYPE.IOType type, int index, ref bool result);
  196. /// <summary>
  197. /// 获取模拟量输入变量(AI)的值
  198. /// </summary>
  199. /// <param name="handle"></param>
  200. /// <param name="type">AI的类型</param>
  201. /// <param name="index">AI索引</param>
  202. /// <param name="result">指定AI状态查询结果</param>
  203. /// <returns></returns>
  204. [DllImport("jakaAPI.dll", EntryPoint = "get_analog_input", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  205. public static extern int get_analog_input(ref int handle, JKTYPE.IOType type, int index, ref float result);
  206. /// <summary>
  207. /// 获取模拟量输出变量(AO)的值
  208. /// </summary>
  209. /// <param name="handle"></param>
  210. /// <param name="type">AO的类型</param>
  211. /// <param name="index">AO索引</param>
  212. /// <param name="result">指定AO状态查询结果</param>
  213. /// <returns></returns>
  214. [DllImport("jakaAPI.dll", EntryPoint = "get_analog_output", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  215. public static extern int get_analog_output(ref int handle, JKTYPE.IOType type, int index, ref float result);
  216. /// <summary>
  217. /// 查询扩展IO模块是否运行
  218. /// </summary>
  219. /// <param name="handle"></param>
  220. /// <param name="is_running"></param>
  221. /// <returns></returns>
  222. [DllImport("jakaAPI.dll", EntryPoint = "is_extio_running", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  223. public static extern int is_extio_running(ref int handle, ref bool is_running);
  224. /// <summary>
  225. /// 运行当前加载的作业程序
  226. /// </summary>
  227. /// <param name="handle"></param>
  228. /// <returns></returns>
  229. [DllImport("jakaAPI.dll", EntryPoint = "program_run", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  230. public static extern int program_run(ref int handle);
  231. /// <summary>
  232. /// 暂停当前运行的作业程序
  233. /// </summary>
  234. /// <param name="handle"></param>
  235. /// <returns></returns>
  236. [DllImport("jakaAPI.dll", EntryPoint = "program_pause", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  237. public static extern int program_pause(ref int handle);
  238. /// <summary>
  239. /// 继续运行当前暂停的作业程序
  240. /// </summary>
  241. /// <param name="handle"></param>
  242. /// <returns></returns>
  243. [DllImport("jakaAPI.dll", EntryPoint = "program_resume", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  244. public static extern int program_resume(ref int handle);
  245. /// <summary>
  246. /// 终止当前执行的作业程序
  247. /// </summary>
  248. /// <param name="handle"></param>
  249. /// <returns></returns>
  250. [DllImport("jakaAPI.dll", EntryPoint = "program_abort", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  251. public static extern int program_abort(ref int handle);
  252. /// <summary>
  253. /// 加载指定的作业程序
  254. /// </summary>
  255. /// <param name="handle"></param>
  256. /// <param name="file">程序文件路径</param>
  257. /// <returns></returns>
  258. [DllImport("jakaAPI.dll", EntryPoint = "program_load", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  259. public static extern int program_load(ref int handle, char[] file);
  260. /// <summary>
  261. /// 获取已加载的作业程序名字
  262. /// </summary>
  263. /// <param name="handle"></param>
  264. /// <param name="file"></param>
  265. /// <returns></returns>
  266. [DllImport("jakaAPI.dll", EntryPoint = "get_loaded_program", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  267. public static extern int get_loaded_program(ref int handle, StringBuilder file);
  268. /// <summary>
  269. /// 获取当前机器人作业程序的执行行号
  270. /// </summary>
  271. /// <param name="handle"></param>
  272. /// <param name="curr_line">当前行号查询结果</param>
  273. /// <returns></returns>
  274. [DllImport("jakaAPI.dll", EntryPoint = "get_current_line", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  275. public static extern int get_current_line(ref int handle, ref int curr_line);
  276. /// <summary>
  277. /// 获取机器人作业程序执行状态
  278. /// </summary>
  279. /// <param name="handle"></param>
  280. /// <param name="status">作业程序执行状态查询结果</param>
  281. /// <returns></returns>
  282. [DllImport("jakaAPI.dll", EntryPoint = "get_program_state", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  283. public static extern int get_program_state(ref int handle, ref JKTYPE.ProgramState status);
  284. /// <summary>
  285. /// 设置机器人运行倍率
  286. /// </summary>
  287. /// <param name="handle"></param>
  288. /// <param name="rapid_rate">是程序运行倍率,设置范围为[0,1]</param>
  289. /// <returns></returns>
  290. [DllImport("jakaAPI.dll", EntryPoint = "set_rapidrate", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  291. public static extern int set_rapidrate(ref int handle, double rapid_rate);
  292. /// <summary>
  293. /// 获取机器人运行倍率
  294. /// </summary>
  295. /// <param name="handle"></param>
  296. /// <param name="rapid_rate">当前控制系统倍率</param>
  297. /// <returns></returns>
  298. [DllImport("jakaAPI.dll", EntryPoint = "get_rapidrate", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  299. public static extern int get_rapidrate(ref int handle, ref double rapid_rate);
  300. /// <summary>
  301. /// 设置指定编号的工具信息
  302. /// </summary>
  303. /// <param name="handle"></param>
  304. /// <param name="id">工具编号</param>
  305. /// <param name="tcp">工具坐标系相对法兰坐标系偏置</param>
  306. /// <param name="name">指定工具的别名</param>
  307. /// <returns></returns>
  308. [DllImport("jakaAPI.dll", EntryPoint = "set_tool_data", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  309. public static extern int set_tool_data(ref int handle, int id, ref JKTYPE.CartesianPose tcp, char[] name);
  310. /// <summary>
  311. /// 查询使用的工具信息
  312. /// </summary>
  313. /// <param name="handle"></param>
  314. /// <param name="id">工具ID查询结果</param>
  315. /// <param name="tcp">工具坐标系相对法兰坐标系偏置</param>
  316. /// <returns></returns>
  317. [DllImport("jakaAPI.dll", EntryPoint = "get_tool_data", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  318. public static extern int get_tool_data(ref int handle, ref int id, ref JKTYPE.CartesianPose tcp);
  319. /// <summary>
  320. /// 设置当前使用的工具ID
  321. /// </summary>
  322. /// <param name="handle"></param>
  323. /// <param name="id">工具坐标系ID</param>
  324. /// <returns></returns>
  325. [DllImport("jakaAPI.dll", EntryPoint = "set_tool_id", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  326. public static extern int set_tool_id(ref int handle, int id);
  327. /// <summary>
  328. /// 查询当前使用的工具ID
  329. /// </summary>
  330. /// <param name="handle"></param>
  331. /// <param name="id">工具ID查询结果</param>
  332. /// <returns></returns>
  333. [DllImport("jakaAPI.dll", EntryPoint = "get_tool_id", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  334. public static extern int get_tool_id(ref int handle, ref int id);
  335. /// <summary>
  336. /// 设置指定编号的用户坐标系信息
  337. /// </summary>
  338. /// <param name="handle"></param>
  339. /// <param name="id">用户坐标系编号</param>
  340. /// <param name="user_frame">用户坐标系偏置值</param>
  341. /// <param name="name">用户坐标系别名</param>
  342. /// <returns></returns>
  343. [DllImport("jakaAPI.dll", EntryPoint = "set_user_frame_data", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  344. public static extern int set_user_frame_data(ref int handle, int id, ref JKTYPE.CartesianPose user_frame, char[] name);
  345. /// <summary>
  346. ///
  347. /// </summary>
  348. /// <param name="handle"></param>
  349. /// <param name="id"></param>
  350. /// <param name="user_frame"></param>
  351. /// <returns></returns>
  352. [DllImport("jakaAPI.dll", EntryPoint = "get_user_frame_data", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  353. public static extern int get_user_frame_data(ref int handle, ref int id, ref JKTYPE.CartesianPose user_frame);
  354. /// <summary>
  355. ///
  356. /// </summary>
  357. /// <param name="handle"></param>
  358. /// <param name="id"></param>
  359. /// <returns></returns>
  360. [DllImport("jakaAPI.dll", EntryPoint = "set_user_frame_id", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  361. public static extern int set_user_frame_id(ref int handle, int id);
  362. /// <summary>
  363. /// 查询当前使用的用户坐标系ID
  364. /// </summary>
  365. /// <param name="handle"></param>
  366. /// <param name="id">获取的结果</param>
  367. /// <returns></returns>
  368. [DllImport("jakaAPI.dll", EntryPoint = "get_user_frame_id", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  369. public static extern int get_user_frame_id(ref int handle, ref int id);
  370. /// <summary>
  371. /// 控制机器人进入或退出拖拽模式
  372. /// </summary>
  373. /// <param name="handle"></param>
  374. /// <param name="enable">TRUE为进入拖拽模式,FALSE为退出拖拽模式</param>
  375. /// <returns></returns>
  376. [DllImport("jakaAPI.dll", EntryPoint = "drag_mode_enable", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  377. public static extern int drag_mode_enable(ref int handle, bool enable);
  378. /// <summary>
  379. /// 查询机器人是否处于拖拽模式
  380. /// </summary>
  381. /// <param name="handle"></param>
  382. /// <param name="in_drag"></param>
  383. /// <returns></returns>
  384. [DllImport("jakaAPI.dll", EntryPoint = "is_in_drag_mode", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  385. public static extern int is_in_drag_mode(ref int handle, ref bool in_drag);
  386. /// <summary>
  387. /// 获取机器人状态
  388. /// </summary>
  389. /// <param name="handle"></param>
  390. /// <param name="state">机器人状态查询结果</param>
  391. /// <returns></returns>
  392. [DllImport("jakaAPI.dll", EntryPoint = "get_robot_state", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  393. public static extern int get_robot_state(ref int handle, ref JKTYPE.RobotState state);
  394. /// <summary>
  395. /// 获取当前设置下工具末端的位姿
  396. /// </summary>
  397. /// <param name="handle"></param>
  398. /// <param name="tcp_position">工具末端位置查询结果</param>
  399. /// <returns></returns>
  400. [DllImport("jakaAPI.dll", EntryPoint = "get_tcp_position", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  401. public static extern int get_tcp_position(ref int handle, ref JKTYPE.CartesianPose tcp_position);
  402. /// <summary>
  403. /// 获取当前机器人关节角度
  404. /// </summary>
  405. /// <param name="handle"></param>
  406. /// <param name="joint_position">关节角度查询结果</param>
  407. /// <returns></returns>
  408. [DllImport("jakaAPI.dll", EntryPoint = "get_joint_position", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  409. public static extern int get_joint_position(ref int handle, ref JKTYPE.JointValue joint_position);
  410. /// <summary>
  411. /// 查询机器人是否处于碰撞保护模式
  412. /// </summary>
  413. /// <param name="handle"></param>
  414. /// <param name="in_collision">查询结果</param>
  415. /// <returns></returns>
  416. [DllImport("jakaAPI.dll", EntryPoint = "is_in_collision", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  417. public static extern int is_in_collision(ref int handle, ref bool in_collision);
  418. /// <summary>
  419. /// 查询机器人是否超出限位
  420. /// </summary>
  421. /// <param name="handle"></param>
  422. /// <param name="on_limit">查询结果</param>
  423. /// <returns></returns>
  424. [DllImport("jakaAPI.dll", EntryPoint = "is_on_limit", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  425. public static extern int is_on_limit(ref int handle, ref bool on_limit);
  426. /// <summary>
  427. /// 查询机器人运动是否停止
  428. /// </summary>
  429. /// <param name="handle"></param>
  430. /// <param name="in_pos"></param>
  431. /// <returns></returns>
  432. [DllImport("jakaAPI.dll", EntryPoint = "is_in_pos", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  433. public static extern int is_in_pos(ref int handle, ref bool in_pos);
  434. /// <summary>
  435. ///
  436. /// </summary>
  437. /// <param name="handle"></param>
  438. /// <returns></returns>
  439. [DllImport("jakaAPI.dll", EntryPoint = "collision_recover", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  440. public static extern int collision_recover(ref int handle);
  441. /// <summary>
  442. /// 设置机器人碰撞等级
  443. /// </summary>
  444. /// <param name="handle"></param>
  445. /// <param name="level">碰撞等级,等级0-5 ,0为关闭碰撞,1为碰撞阈值25N,2为碰撞阈值50N,3为碰撞阈值75N,4为碰撞阈值100N,5为碰撞阈值125N</param>
  446. /// <returns></returns>
  447. [DllImport("jakaAPI.dll", EntryPoint = "set_collision_level", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  448. public static extern int set_collision_level(ref int handle, int level);
  449. /// <summary>
  450. /// 获取机器人设置的碰撞等级
  451. /// </summary>
  452. /// <param name="handle"></param>
  453. /// <param name="level">碰撞等级,等级0-5 ,0为关闭碰撞,1为碰撞阈值25N,2为碰撞阈值50N,3为碰撞阈值75N,4为碰撞阈值100N,5为碰撞阈值125N</param>
  454. /// <returns></returns>
  455. [DllImport("jakaAPI.dll", EntryPoint = "get_collision_level", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  456. public static extern int get_collision_level(ref int handle, ref int level);
  457. /// <summary>
  458. /// 计算指定位姿在当前工具、当前安装角度以及当前用户坐标系设置下的逆解
  459. /// </summary>
  460. /// <param name="handle"></param>
  461. /// <param name="ref_pos"></param>
  462. /// <param name="cartesian_pose"></param>
  463. /// <param name="joint_pos"></param>
  464. /// <returns></returns>
  465. [DllImport("jakaAPI.dll", EntryPoint = "kine_inverse", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  466. public static extern int kine_inverse(ref int handle, ref JKTYPE.JointValue ref_pos, ref JKTYPE.CartesianPose cartesian_pose, ref JKTYPE.JointValue joint_pos);
  467. /// <summary>
  468. /// 计算指定关节位置在当前工具、当前安装角度以及当前用户坐标系设置下的位姿值
  469. /// </summary>
  470. /// <param name="handle"></param>
  471. /// <param name="joint_pos">关节空间位置</param>
  472. /// <param name="cartesian_pose">笛卡尔空间位姿计算结果</param>
  473. /// <returns></returns>
  474. [DllImport("jakaAPI.dll", EntryPoint = "kine_forward", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  475. public static extern int kine_forward(ref int handle, ref JKTYPE.JointValue joint_pos, ref JKTYPE.CartesianPose cartesian_pose);
  476. /// <summary>
  477. /// 欧拉角到旋转矩阵的转换
  478. /// </summary>
  479. /// <param name="handle"></param>
  480. /// <param name="rpy">待转换的欧拉角数据</param>
  481. /// <param name="rot_matrix">转换后的旋转矩阵</param>
  482. /// <returns></returns>
  483. [DllImport("jakaAPI.dll", EntryPoint = "rpy_to_rot_matrix", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  484. public static extern int rpy_to_rot_matrix(ref int handle, ref JKTYPE.Rpy rpy, ref JKTYPE.RotMatrix rot_matrix);
  485. /// <summary>
  486. /// 旋转矩阵到欧拉角的转换
  487. /// </summary>
  488. /// <param name="handle"></param>
  489. /// <param name="rot_matrix">待转换的旋转矩阵数据</param>
  490. /// <param name="rpy">转换后的RPY欧拉角结果</param>
  491. /// <returns></returns>
  492. [DllImport("jakaAPI.dll", EntryPoint = "rot_matrix_to_rpy", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  493. public static extern int rot_matrix_to_rpy(ref int handle, ref JKTYPE.RotMatrix rot_matrix, ref JKTYPE.Rpy rpy);
  494. /// <summary>
  495. /// 四元数到旋转矩阵的转换
  496. /// </summary>
  497. /// <param name="handle"></param>
  498. /// <param name="quaternion">待转换的四元数数据</param>
  499. /// <param name="rot_matrix">转换后的旋转矩阵结果</param>
  500. /// <returns></returns>
  501. [DllImport("jakaAPI.dll", EntryPoint = "quaternion_to_rot_matrix", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  502. public static extern int quaternion_to_rot_matrix(ref int handle, ref JKTYPE.Quaternion quaternion, ref JKTYPE.RotMatrix rot_matrix);
  503. /// <summary>
  504. /// 旋转矩阵到四元数的转换
  505. /// </summary>
  506. /// <param name="handle"></param>
  507. /// <param name="rot_matrix">待转换的旋转矩阵</param>
  508. /// <param name="quaternion">转换后的四元数结果</param>
  509. /// <returns></returns>
  510. [DllImport("jakaAPI.dll", EntryPoint = "rot_matrix_to_quaternion", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  511. public static extern int rot_matrix_to_quaternion(ref int handle, ref JKTYPE.RotMatrix rot_matrix, ref JKTYPE.Quaternion quaternion);
  512. /// <summary>
  513. ///
  514. /// </summary>
  515. /// <param name="handle"></param>
  516. /// <param name="enable"></param>
  517. /// <returns></returns>
  518. [DllImport("jakaAPI.dll", EntryPoint = "torque_control_enable", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  519. public static extern int torque_control_enable(ref int handle, bool enable);
  520. /// <summary>
  521. ///
  522. /// </summary>
  523. /// <param name="handle"></param>
  524. /// <param name="tor_val"></param>
  525. /// <param name="grv_flag"></param>
  526. /// <returns></returns>
  527. [DllImport("jakaAPI.dll", EntryPoint = "torque_feedforward", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  528. public static extern int torque_feedforward(ref int handle, JKTYPE.TorqueValue tor_val, int grv_flag);
  529. /// <summary>
  530. /// 机器人负载设置
  531. /// </summary>
  532. /// <param name="handle"></param>
  533. /// <param name="payload">负载质心、质量数据</param>
  534. /// <returns></returns>
  535. [DllImport("jakaAPI.dll", EntryPoint = "set_payload", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  536. public static extern int set_payload(ref int handle, ref JKTYPE.PayLoad payload);
  537. /// <summary>
  538. /// 获取机器人负载数据
  539. /// </summary>
  540. /// <param name="handle"></param>
  541. /// <param name="payload">负载查询结果</param>
  542. /// <returns></returns>
  543. [DllImport("jakaAPI.dll", EntryPoint = "get_payload", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  544. public static extern int get_payload(ref int handle, ref JKTYPE.PayLoad payload);
  545. /// <summary>
  546. /// 注册机器人出现错误时的回调函数
  547. /// </summary>
  548. /// <param name="i"></param>
  549. /// <param name="func">指向用户定义的函数的函数指针</param>
  550. /// <returns></returns>
  551. [DllImport("jakaAPI.dll", EntryPoint = "set_error_handler", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  552. public static extern int set_error_handler(ref int i, CallBackFuncType func);
  553. /// <summary>
  554. /// 获取SDK版本号
  555. /// </summary>
  556. /// <param name="i"></param>
  557. /// <param name="version">SDK版本号</param>
  558. /// <returns></returns>
  559. [DllImport("jakaAPI.dll", EntryPoint = "get_sdk_version", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  560. public static extern int get_sdk_version(ref int i, StringBuilder version);
  561. /// <summary>
  562. /// 获取机器人状态数据
  563. /// </summary>
  564. /// <param name="i"></param>
  565. /// <param name="status">机器人状态</param>
  566. /// <returns></returns>
  567. [DllImport("jakaAPI.dll", EntryPoint = "get_robot_status", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  568. public static extern int get_robot_status(ref int i, ref JKTYPE.RobotStatus status);
  569. /// <summary>
  570. /// 终止当前机械臂运动
  571. /// </summary>
  572. /// <param name="i"></param>
  573. /// <returns></returns>
  574. [DllImport("jakaAPI.dll", EntryPoint = "motion_abort", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  575. public static extern int motion_abort(ref int i);
  576. /// <summary>
  577. /// 设置错误码文件路径,需要使用get_last_error接口时需要设置错误码文件路径,如果不使用get_last_error接口,则不需要设置该接口
  578. /// </summary>
  579. /// <param name="i"></param>
  580. /// <param name="path"></param>
  581. /// <returns></returns>
  582. [DllImport("jakaAPI.dll", EntryPoint = "set_errorcode_file_path", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  583. public static extern int set_errorcode_file_path(ref int i, StringBuilder path);
  584. /// <summary>
  585. /// 获取机器人运行过程中最后一个错误码,当调用clear_error时,最后一个错误码会清零
  586. /// </summary>
  587. /// <param name="i"></param>
  588. /// <param name="code"></param>
  589. /// <returns></returns>
  590. [DllImport("jakaAPI.dll", EntryPoint = "get_last_error", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  591. public static extern int get_last_error(ref int i, ref JKTYPE.ErrorCode code);
  592. /// <summary>
  593. ///
  594. /// </summary>
  595. /// <param name="i"></param>
  596. /// <param name="mode"></param>
  597. /// <returns></returns>
  598. [DllImport("jakaAPI.dll", EntryPoint = "set_debug_mode", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  599. public static extern int set_debug_mode(ref int i, bool mode);
  600. /// <summary>
  601. /// 设置是否开启调试模式,选择TRUE时,开始调试模式,此时会在标准输出流中输出调试信息,选择FALSE时,不输出调试信息
  602. /// </summary>
  603. /// <param name="i"></param>
  604. /// <param name="para"></param>
  605. /// <returns></returns>
  606. [DllImport("jakaAPI.dll", EntryPoint = "set_traj_config", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  607. public static extern int set_traj_config(ref int i, ref JKTYPE.TrajTrackPara para);
  608. /// <summary>
  609. /// 获取轨迹复现配置参数
  610. /// </summary>
  611. /// <param name="i"></param>
  612. /// <param name="para">轨迹复现配置参数</param>
  613. /// <returns></returns>
  614. [DllImport("jakaAPI.dll", EntryPoint = "get_traj_config", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  615. public static extern int get_traj_config(ref int i, ref JKTYPE.TrajTrackPara para);
  616. /// <summary>
  617. /// 采集轨迹复现数据控制开关
  618. /// </summary>
  619. /// <param name="i"></param>
  620. /// <param name="mode">选择TRUE时,开始数据采集,选择FALSE时,结束数据采集</param>
  621. /// <param name="filename">采集数据的存储文件名,当filename为空指针时,存储文件以当前日期命名</param>
  622. /// <returns></returns>
  623. [DllImport("jakaAPI.dll", EntryPoint = "set_traj_sample_mode", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  624. public static extern int set_traj_sample_mode(ref int i, bool mode, char[] filename);
  625. /// <summary>
  626. /// 采集轨迹复现数据状态查询
  627. /// </summary>
  628. /// <param name="i"></param>
  629. /// <param name="sample_statuse">为TRUE时,数据正在采集,为FALSE时,数据采集结束,在数据采集状态时不允许再次开启数据采集开关</param>
  630. /// <returns></returns>
  631. [DllImport("jakaAPI.dll", EntryPoint = "get_traj_sample_status", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  632. public static extern int get_traj_sample_status(ref int i, ref bool sample_statuse);
  633. /// <summary>
  634. /// 查询控制器中已经存在的轨迹复现数据的文件名
  635. /// </summary>
  636. /// <param name="i"></param>
  637. /// <param name="filename">控制器中已经存在的轨迹复现数据的文件名</param>
  638. /// <returns></returns>
  639. [DllImport("jakaAPI.dll", EntryPoint = "get_exist_traj_file_name", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  640. public static extern int get_exist_traj_file_name(ref int i, ref JKTYPE.MultStrStorType filename);
  641. /// <summary>
  642. /// 重命名轨迹复现数据的文件名
  643. /// </summary>
  644. /// <param name="i"></param>
  645. /// <param name="src">原文件名</param>
  646. /// <param name="dest">目标文件名,文件名长度不能超过100个字符,文件名不能为空,目标文件名不支持中文</param>
  647. /// <returns></returns>
  648. [DllImport("jakaAPI.dll", EntryPoint = "rename_traj_file_name", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  649. public static extern int rename_traj_file_name(ref int i, ref char[] src, ref char[] dest);
  650. /// <summary>
  651. /// 删除控制器中轨迹复现数据文件
  652. /// </summary>
  653. /// <param name="i"></param>
  654. /// <param name="filename">要删除的文件的文件名,文件名为数据文件名字</param>
  655. /// <returns></returns>
  656. [DllImport("jakaAPI.dll", EntryPoint = "remove_traj_file", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  657. public static extern int remove_traj_file(ref int i, char[] filename);
  658. /// <summary>
  659. ///
  660. /// </summary>
  661. /// <param name="i"></param>
  662. /// <param name="filename"></param>
  663. /// <returns></returns>
  664. [DllImport("jakaAPI.dll", EntryPoint = "generate_traj_exe_file", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  665. public static extern int generate_traj_exe_file(ref int i, char[] filename);
  666. /// <summary>
  667. ///
  668. /// </summary>
  669. /// <param name="i"></param>
  670. /// <param name="joint_pos"></param>
  671. /// <param name="move_mode"></param>
  672. /// <param name="is_block"></param>
  673. /// <param name="speed"></param>
  674. /// <param name="acc"></param>
  675. /// <param name="tol"></param>
  676. /// <param name="option_cond"></param>
  677. /// <returns></returns>
  678. [DllImport("jakaAPI.dll", EntryPoint = "joint_move_extend", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  679. 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);
  680. /// <summary>
  681. ///
  682. /// </summary>
  683. /// <param name="i"></param>
  684. /// <param name="cart_pos"></param>
  685. /// <param name="move_mode"></param>
  686. /// <param name="is_block"></param>
  687. /// <param name="speed"></param>
  688. /// <param name="acc"></param>
  689. /// <param name="tol"></param>
  690. /// <param name="option_cond"></param>
  691. /// <returns></returns>
  692. [DllImport("jakaAPI.dll", EntryPoint = "linear_move_extend", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  693. 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);
  694. /// <summary>
  695. /// 机器人末端圆弧运动
  696. /// </summary>
  697. /// <param name="i"></param>
  698. /// <param name="end_pos">机器人末端运动目标位置</param>
  699. /// <param name="mid_pos">机器人末端运中间点</param>
  700. /// <param name="move_mode">指定运动模式:增量运动(相对运动)或绝对运动</param>
  701. /// <param name="is_block">设置接口是否为阻塞接口,TRUE 为阻塞接口 FALSE 为非阻塞接口</param>
  702. /// <param name="speed">机器人圆弧运动速度,单位:rad/s</param>
  703. /// <param name="acc">机器人圆弧运动加速度,单位:rad/s^2</param>
  704. /// <param name="tol">机器人圆弧运动终点误差, 单位mm</param>
  705. /// <param name="option_cond">机器人关节可选参数,如果不需要,该值可不赋值,填入空指针就可</param>
  706. /// <returns></returns>
  707. [DllImport("jakaAPI.dll", EntryPoint = "circular_move", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  708. 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);
  709. /// <summary>
  710. /// SERVO模式下不使用滤波器,该指令在SERVO模式下不可设置,退出SERVO后可设置
  711. /// </summary>
  712. /// <param name="i"></param>
  713. /// <returns></returns>
  714. [DllImport("jakaAPI.dll", EntryPoint = "servo_move_use_none_filter", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  715. public static extern int servo_move_use_none_filter(ref int i);
  716. /// <summary>
  717. /// SERVO模式下关节空间一阶低通滤波,该指令在SERVO模式下不可设置,退出SERVO后可设置
  718. /// </summary>
  719. /// <param name="i"></param>
  720. /// <param name="cutoffFreq">一阶低通滤波器截止频率</param>
  721. /// <returns></returns>
  722. [DllImport("jakaAPI.dll", EntryPoint = "servo_move_use_joint_LPF", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  723. public static extern int servo_move_use_joint_LPF(ref int i, double cutoffFreq);
  724. /// <summary>
  725. /// SERVO模式下关节空间非线性滤波,该指令在SERVO模式下不可设置,退出SERVO后可设置
  726. /// </summary>
  727. /// <param name="i"></param>
  728. /// <param name="max_vr">笛卡尔空间姿态变化速度的速度上限值(绝对值)°/s</param>
  729. /// <param name="max_ar">笛卡尔空间姿态变化速度的加速度上限值(绝对值)°/s^2</param>
  730. /// <param name="max_jr">笛卡尔空间姿态变化速度的加加速度上限值(绝对值)°/s^3</param>
  731. /// <returns></returns>
  732. [DllImport("jakaAPI.dll", EntryPoint = "servo_move_use_joint_NLF", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  733. public static extern int servo_move_use_joint_NLF(ref int i, double max_vr, double max_ar, double max_jr);
  734. /// <summary>
  735. /// SERVO模式下笛卡尔空间非线性滤波,该指令在SERVO模式下不可设置,退出SERVO后可设置
  736. /// </summary>
  737. /// <param name="i"></param>
  738. /// <param name="max_vp">笛卡尔空间下移动指令速度的上限值(绝对值)。单位:mm/s</param>
  739. /// <param name="max_ap">笛卡尔空间下移动指令加速度的上限值(绝对值)。单位:mm/s^2</param>
  740. /// <param name="max_jp">笛卡尔空间下移动指令加加速度的上限值(绝对值)单位:mm/s^3</param>
  741. /// <param name="max_vr">笛卡尔空间姿态变化速度的速度上限值(绝对值)°/s</param>
  742. /// <param name="max_ar">笛卡尔空间姿态变化速度的加速度上限值(绝对值)°/s^2</param>
  743. /// <param name="max_jr">笛卡尔空间姿态变化速度的加加速度上限值(绝对值)°/s^3</param>
  744. /// <returns></returns>
  745. [DllImport("jakaAPI.dll", EntryPoint = "servo_move_use_carte_NLF", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  746. 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);
  747. /// <summary>
  748. /// SERVO模式下关节空间多阶均值滤波器,该指令在SERVO模式下不可设置,退出SERVO后可设置
  749. /// </summary>
  750. /// <param name="i"></param>
  751. /// <param name="max_buf">均值滤波器缓冲区的大小</param>
  752. /// <param name="kp">加速度滤波系数</param>
  753. /// <param name="kv">速度滤波系数</param>
  754. /// <param name="ka">位置滤波系数</param>
  755. /// <returns></returns>
  756. [DllImport("jakaAPI.dll", EntryPoint = "servo_move_use_joint_MMF", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  757. public static extern int servo_move_use_joint_MMF(ref int i, int max_buf, double kp, double kv, double ka);
  758. /// <summary>
  759. /// SERVO模式下速度前瞻参数设置
  760. /// </summary>
  761. /// <param name="i"></param>
  762. /// <param name="max_buf">缓冲区的大小</param>
  763. /// <param name="kp">加速度滤波系数</param>
  764. /// <returns></returns>
  765. [DllImport("jakaAPI.dll", EntryPoint = "servo_speed_foresight", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  766. public static extern int servo_speed_foresight(ref int i, int max_buf, double kp);
  767. /// <summary>
  768. /// 设置SDK日志路径
  769. /// </summary>
  770. /// <param name="i"></param>
  771. /// <param name="filepath">SDK日志路径</param>
  772. /// <returns></returns>
  773. [DllImport("jakaAPI.dll", EntryPoint = "set_SDK_filepath", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  774. public static extern int set_SDK_filepath(ref int i, ref char[] filepath);
  775. /// <summary>
  776. /// 设置传感器品牌
  777. /// </summary>
  778. /// <param name="i"></param>
  779. /// <param name="sensor_brand">传感器品牌,可选值为1,2,3 分别代表不同品牌力矩传感器</param>
  780. /// <returns></returns>
  781. [DllImport("jakaAPI.dll", EntryPoint = "set_torsenosr_brand", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  782. public static extern int set_torsenosr_brand(ref int i, int sensor_brand);
  783. /// <summary>
  784. /// 获取传感器品牌
  785. /// </summary>
  786. /// <param name="i"></param>
  787. /// <param name="sensor_brand">传感器品牌,可选值为1,2,3 分别代表不同品牌力矩传感器</param>
  788. /// <returns></returns>
  789. [DllImport("jakaAPI.dll", EntryPoint = "get_torsenosr_brand", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  790. public static extern int get_torsenosr_brand(ref int i, ref int sensor_brand);
  791. /// <summary>
  792. /// 开启或关闭力矩传感器
  793. /// </summary>
  794. /// <param name="i"></param>
  795. /// <param name="sensor_mode">0代表关闭传感器,1代表开启力矩传感器</param>
  796. /// <returns></returns>
  797. [DllImport("jakaAPI.dll", EntryPoint = "set_torque_sensor_mode", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  798. public static extern int set_torque_sensor_mode(ref int i, int sensor_mode);
  799. /// <summary>
  800. /// 设置柔顺控制参数
  801. /// </summary>
  802. /// <param name="i"></param>
  803. /// <param name="axis">代表配置哪一轴,可选值为0~5</param>
  804. /// <param name="opt">柔顺方向,可选值为 1 2 3 4 5 6分别对应 fx fy fz mx my mz 0代表没有勾选</param>
  805. /// <param name="ftUser">阻尼力,表示用户用多大的力才能让机器人的沿着某个方向以最大速度进行运动</param>
  806. /// <param name="ftConstant">回弹力,表示机器人回到初始状态的能力</param>
  807. /// <param name="ftNnormalTrack">代表恒力,手动操作时全部设置为0</param>
  808. /// <param name="ftReboundFK">法向跟踪,手动操作时全部设置为0,</param>
  809. /// <returns></returns>
  810. [DllImport("jakaAPI.dll", EntryPoint = "set_admit_ctrl_config", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  811. public static extern int set_admit_ctrl_config(ref int i, int axis, int opt, int ftUser, int ftConstant, int ftNnormalTrack, int ftReboundFK);
  812. /// <summary>
  813. /// 开始辨识工具末端负载
  814. /// </summary>
  815. /// <param name="i"></param>
  816. /// <param name="joint_pos">使用力矩传感器进行自动负载辨识时的结束位置</param>
  817. /// <returns></returns>
  818. [DllImport("jakaAPI.dll", EntryPoint = "start_torq_sensor_payload_identify", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  819. public static extern int start_torq_sensor_payload_identify(ref int i, ref JKTYPE.JointValue joint_pos);
  820. /// <summary>
  821. ///
  822. /// </summary>
  823. /// <param name="i"></param>
  824. /// <param name="identify_status"></param>
  825. /// <returns></returns>
  826. [DllImport("jakaAPI.dll", EntryPoint = "get_torq_sensor_identify_staus", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  827. public static extern int get_torq_sensor_identify_staus(ref int i, ref int identify_status);
  828. /// <summary>
  829. /// 获取末端负载辨识结果
  830. /// </summary>
  831. /// <param name="i"></param>
  832. /// <param name="payload">末端负载</param>
  833. /// <returns></returns>
  834. [DllImport("jakaAPI.dll", EntryPoint = "get_torq_sensor_payload_identify_result", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  835. public static extern int get_torq_sensor_payload_identify_result(ref int i, ref JKTYPE.PayLoad payload);
  836. /// <summary>
  837. /// 设置传感器末端负载
  838. /// </summary>
  839. /// <param name="i"></param>
  840. /// <param name="payload">末端负载</param>
  841. /// <returns></returns>
  842. [DllImport("jakaAPI.dll", EntryPoint = "set_torq_sensor_tool_payload", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  843. public static extern int set_torq_sensor_tool_payload(ref int i, ref JKTYPE.PayLoad payload);
  844. /// <summary>
  845. /// 获取传感器末端负载
  846. /// </summary>
  847. /// <param name="i"></param>
  848. /// <param name="payload">末端负载</param>
  849. /// <returns></returns>
  850. [DllImport("jakaAPI.dll", EntryPoint = "get_torq_sensor_tool_payload", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  851. public static extern int get_torq_sensor_tool_payload(ref int i, ref JKTYPE.PayLoad payload);
  852. /// <summary>
  853. /// 力控拖拽使能
  854. /// </summary>
  855. /// <param name="i"></param>
  856. /// <param name="enable_flag">0为关闭力控拖拽使能,1为开启</param>
  857. /// <returns></returns>
  858. [DllImport("jakaAPI.dll", EntryPoint = "enable_admittance_ctrl", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  859. public static extern int enable_admittance_ctrl(ref int i, int enable_flag);
  860. /// <summary>
  861. /// 设置力控类型和传感器初始化状态
  862. /// </summary>
  863. /// <param name="i"></param>
  864. /// <param name="sensor_compensation">是否开启传感器补偿,1代表开启即初始化,0代表不初始化</param>
  865. /// <param name="compliance_type">0 代表不使用任何一种柔顺控制方法 1 代表恒力柔顺控制,2 代表速度柔顺控制</param>
  866. /// <returns></returns>
  867. [DllImport("jakaAPI.dll", EntryPoint = "set_compliant_type", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  868. public static extern int set_compliant_type(ref int i, int sensor_compensation, int compliance_type);
  869. /// <summary>
  870. /// 获取力控类型和传感器初始化状态
  871. /// </summary>
  872. /// <param name="i"></param>
  873. /// <param name="sensor_compensation">是否开启传感器补偿,1代表开启即初始化,0代表不初始化</param>
  874. /// <param name="compliance_type">0 代表不使用任何一种柔顺控制方法 1 代表恒力柔顺控制,2 代表速度柔顺控制</param>
  875. /// <returns></returns>
  876. [DllImport("jakaAPI.dll", EntryPoint = "get_compliant_type", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  877. public static extern int get_compliant_type(ref int i, ref int sensor_compensation, ref int compliance_type);
  878. /// <summary>
  879. /// 错误状态清除
  880. /// </summary>
  881. /// <param name="i"></param>
  882. /// <returns></returns>
  883. [DllImport("jakaAPI.dll", EntryPoint = "clear_error", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  884. public static extern int clear_error(ref int i);
  885. /// <summary>
  886. /// 获取力控柔顺控制参数
  887. /// </summary>
  888. /// <param name="i"></param>
  889. /// <param name="admit_ctrl_cfg">机器人力控柔顺控制参数存储地址</param>
  890. /// <returns></returns>
  891. [DllImport("jakaAPI.dll", EntryPoint = "get_admit_ctrl_config", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  892. public static extern int get_admit_ctrl_config(ref int i, ref JKTYPE.RobotAdmitCtrl admit_ctrl_cfg);
  893. /// <summary>
  894. /// 设置力控传感器ip地址
  895. /// </summary>
  896. /// <param name="i"></param>
  897. /// <param name="type"> 0为使用tcp/ip协议,1为使用RS485协议</param>
  898. /// <param name="ip_addr">为力控传感器地址</param>
  899. /// <param name="port">为使用tcp/ip协议时力控传感器端口号</param>
  900. /// <returns></returns>
  901. [DllImport("jakaAPI.dll", EntryPoint = "set_torque_sensor_comm", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  902. public static extern int set_torque_sensor_comm(ref int i, int type, ref char[] ip_addr, int port);
  903. /// <summary>
  904. /// 获取力控传感器ip地址
  905. /// </summary>
  906. /// <param name="i"></param>
  907. /// <param name="type">0为使用tcp/ip协议,1为使用RS485协议</param>
  908. /// <param name="ip_addr">力控传感器地址</param>
  909. /// <param name="port">使用tcp/ip协议时力控传感器端口号</param>
  910. /// <returns></returns>
  911. [DllImport("jakaAPI.dll", EntryPoint = "get_torque_sensor_comm", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  912. public static extern int get_torque_sensor_comm(ref int i, ref int type, ref byte ip_addr, ref int port);
  913. /// <summary>
  914. /// 关闭力控
  915. /// </summary>
  916. /// <param name="i"></param>
  917. /// <returns></returns>
  918. [DllImport("jakaAPI.dll", EntryPoint = "disable_force_control", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  919. public static extern int disable_force_control(ref int i);
  920. /// <summary>
  921. /// 设置速度柔顺控制参数
  922. /// </summary>
  923. /// <param name="i"></param>
  924. /// <param name="vel">速度柔顺控制参数</param>
  925. /// <returns></returns>
  926. [DllImport("jakaAPI.dll", EntryPoint = "set_vel_compliant_ctrl", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  927. public static extern int set_vel_compliant_ctrl(ref int i, ref JKTYPE.VelCom vel);
  928. /// <summary>
  929. /// 设置柔顺控制力矩条件
  930. /// </summary>
  931. /// <param name="i"></param>
  932. /// <param name="ft">ft为柔顺控制力矩条件</param>
  933. /// <returns></returns>
  934. [DllImport("jakaAPI.dll", EntryPoint = "set_compliance_condition", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  935. public static extern int set_compliance_condition(ref int i, ref JKTYPE.FTxyz ft);
  936. /// <summary>
  937. /// 设置网络异常,SDK与机器人控制器失去连接后多长时间机器人控制器终止机械臂当前运动
  938. /// </summary>
  939. /// <param name="i"></param>
  940. /// <param name="millisecond"> 时间参数,单位毫秒</param>
  941. /// <param name="mnt">网络异常时机器人需要进行的动作类型</param>
  942. /// <returns></returns>
  943. [DllImport("jakaAPI.dll", EntryPoint = "set_network_exception_handle", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  944. public static extern int set_network_exception_handle(ref int i, float millisecond, JKTYPE.ProcessType mnt);
  945. /// <summary>
  946. /// 设置机器人状态数据自动更新时间间隔
  947. /// </summary>
  948. /// <param name="i"></param>
  949. /// <param name="millisecond">时间参数,单位毫秒</param>
  950. /// <returns></returns>
  951. [DllImport("jakaAPI.dll", EntryPoint = "set_status_data_update_time_interval", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
  952. public static extern int set_status_data_update_time_interval(ref int i, float millisecond);
  953. }
  954. }