9 #define _CRT_SECURE_NO_WARNINGS 18 #define REPORT_BUF_SIZE 1024 22 static int BAUDRATES[13] = { 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600, 1000000, 1500000, 2000000, 2500000 };
25 for (
int i = 0; i < 13; i++) {
if (
BAUDRATES[i] == baud)
return i; }
30 for (
int i = 0; i < 3; i++) {
34 else if (v1[i] < v2[i]) {
42 const std::string &port,
46 bool check_joint_limit,
47 bool check_cmdnum_limit,
51 int max_callback_thread_count,
53 : default_is_radian(is_radian), port_(port),
54 check_tcp_limit_(check_tcp_limit), check_joint_limit_(check_joint_limit),
55 check_cmdnum_limit_(check_cmdnum_limit), check_robot_sn_(check_robot_sn),
56 check_is_ready_(check_is_ready), check_is_pause_(check_is_pause) {
177 cgpio_input_conf =
new int[16]{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
178 cgpio_output_conf =
new int[16]{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
209 template<
typename callable_vector,
class... arguments>
211 for (
size_t i = 0; i < callbacks.size(); i++) {
213 else pool.
commit(callbacks[i], std::forward<arguments>(args)...);
294 unsigned char *data_fp = &rx_data[4];
296 if (sizeof_data >= 87) {
300 std::unique_lock<std::mutex> locker(
mutex_);
315 for (
int i = 0; i < 8; i++) {
319 for (
int i = 0; i < 8; i++) {
349 for (
int i = 0; i < 7; i++) {
353 for (
int i = 0; i < 6; i++) {
363 for (
int i = 0; i < 6; i++) {
367 if (sizeof_data >= 187) {
369 int _axis = data_fp[88];
377 memcpy(
version, &data_fp[93], 30);
413 for (
int i = 0; i < 17; i++)
sv3msg_[i] = data_fp[171 + i];
421 last_report_time_ = report_time;
426 unsigned char *data_fp = &rx_data[4];
428 if (sizeof_data >= 87) {
430 state = data_fp[4] & 0x0F;
432 std::unique_lock<std::mutex> locker(
mutex_);
440 mode = data_fp[4] >> 4;
447 for (
int i = 0; i < 7; i++) {
451 for (
int i = 0; i < 6; i++) {
457 if (sizeof_data >= 133) {
458 if (data_fp[131] < 0 || data_fp[131] > 6 || data_fp[132] < 0 || data_fp[132] > 6) {
460 printf(
"DataException\n");
470 for (
int i = 0; i < 8; i++) {
474 for (
int i = 0; i < 8; i++) {
508 for (
int i = 0; i < 6; i++) {
523 if (sizeof_data >= 245) {
525 int _axis = data_fp[146];
531 axis = (_axis >= 5 && _axis <= 7) ? _axis :
axis;
533 memcpy(
version, &data_fp[151], 30);
569 for (
int i = 0; i < 17; i++)
sv3msg_[i] = data_fp[229 + i];
571 if (sizeof_data >= 252) {
572 bool isChange =
false;
573 for (
int i = 0; i < 7; i++) {
574 isChange = (
temperatures[i] != data_fp[245 + i]) ?
true : isChange;
581 if (sizeof_data >= 284) {
587 if (sizeof_data >= 288) {
595 if (sizeof_data >= 312) {
597 for (
int i = 0; i < 6; i++) {
601 if (sizeof_data >= 314) {
605 if (sizeof_data >= 417) {
611 for (
int i = 0; i < 7; i++) {
626 for (
int i = 0; i < 8; i++) {
630 if (sizeof_data >= 433) {
631 for (
int i = 0; i < 8; i++) {
650 if (fail_count > 5)
break;
662 if (ret != 0)
continue;
665 if (num < 4 && size <= 0)
continue;
670 if (num + offset < size) {
671 memcpy(ret_data + offset + 4, rx_data + 4, num);
676 memcpy(ret_data + offset + 4, rx_data + 4, size - offset);
680 int offset2 = size - offset;
681 while (num - offset2 >= size) {
682 memcpy(ret_data + 4, rx_data + 4 + offset2, size);
687 memcpy(ret_data + 4, rx_data + 4 + offset2, num - offset2);
688 offset = num - offset2;
706 unsigned char version_[40];
708 while ((ret < 0 || ret > 2) && cnt > 0) {
713 std::string v((
const char *)version_);
714 std::regex pattern_new(
".*(\\d+),(\\d+),(\\S+),(\\S+),.*[vV](\\d+)\\.(\\d+)\\.(\\d+)");
715 std::regex pattern(
".*[vV](\\d+)\\.(\\d+)\\.(\\d+)");
719 int control_type = 0;
720 if (std::regex_match(v, result, pattern_new)) {
721 auto it = result.begin();
722 sscanf(std::string(*++it).data(),
"%d", &
axis);
723 sscanf(std::string(*++it).data(),
"%d", &
device_type);
724 sscanf(std::string(*++it).substr(2, 4).data(),
"%d", &arm_type);
725 sscanf(std::string(*++it).substr(2, 4).data(),
"%d", &control_type);
734 else if (std::regex_match(v, result, pattern)) {
735 auto it = result.begin();
741 std::vector<std::string> tmpList =
split(v,
"-");
742 int size = tmpList.size();
744 int year = atoi(tmpList[size - 3].c_str());
745 int month = atoi(tmpList[size - 2].c_str());
747 else if (year == 2019) {
770 printf(
"hardware_type: %d, control_box_type: %d\n", arm_type, control_type);
775 while ((ret < 0 || ret > 2) && cnt > 0 &&
warn_code == 0) {
781 printf(
"robot_sn: %s\n",
sn);
787 std::unique_lock<std::mutex> locker(
mutex_);
815 unsigned char version_[40];
818 std::string v((
const char *)version_);
819 std::regex pattern_new(
".*(\\d+),(\\d+),(\\S+),(\\S+),.*[vV](\\d+)\\.(\\d+)\\.(\\d+)");
820 std::regex pattern(
".*[vV](\\d+)\\.(\\d+)\\.(\\d+)");
823 int control_type = 0;
824 if (std::regex_match(v, result, pattern_new)) {
825 auto it = result.begin();
826 sscanf(std::string(*++it).data(),
"%d", &
axis);
827 sscanf(std::string(*++it).data(),
"%d", &
device_type);
828 sscanf(std::string(*++it).substr(2).data(),
"%d", &arm_type);
829 sscanf(std::string(*++it).substr(2).data(),
"%d", &control_type);
838 else if (std::regex_match(v, result, pattern)) {
839 auto it = result.begin();
845 std::vector<std::string> tmpList =
split(v,
"-");
846 int size = tmpList.size();
848 int year = atoi(tmpList[size - 3].c_str());
849 int month = atoi(tmpList[size - 2].c_str());
851 else if (year == 2019) {
878 if (port !=
"" && port !=
port_) {
882 printf(
"can not connect to port/ip: %s\n",
port_.data());
886 std::regex pattern(
"(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)[.]){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)");
888 if (
port_ ==
"localhost" || std::regex_match(
port_, pattern)) {
892 printf(
"Error: Tcp control connection failed\n");
896 printf(
"Tcp control connection successful\n");
904 printf(
"Error: Tcp report connection failed\n");
908 printf(
"Tcp report connection successful\n");
958 if (ret == 0 || ret == 1 || ret == 2) {
959 memcpy(
sn, robot_sn, 40);
1001 for (
int i = 0; i < 6; i++) {
1015 for (
int i = 0; i < 7; i++) {
1032 printf(
"[motion_enable], xArm is not ready to move\n");
1038 printf(
"[motion_enable], xArm is ready to move\n");
1053 printf(
"[set_state], xArm is not ready to move\n");
1059 printf(
"[set_state], xArm is ready to move\n");
1089 printf(
"[clean_error], xArm is not ready to move\n");
1095 printf(
"[clean_error], xArm is ready to move\n");
1110 if (wait_code != 0)
return wait_code;
1123 long long expired = timeout <= 0 ? 0 : (get_system_time() + timeout * 1000 + sleep_finish_time_ > start_time ?
sleep_finish_time_ : 0);
1128 int max_cnt = (ret == 0 && state_ == 1) ? 2 : 10;
1140 if (ret != 0 || (state_ != 4 && state_ != 5)) {
1154 if (cnt >= max_cnt) {
1157 if (ret == 0 && state_ != 1) {
1177 if (wait_code != 0)
return wait_code;
1182 for (
int i = 0; i < 6; i++) {
1194 if (wait && ret == 0) {
1203 return set_position(pose, radius, 0, 0, 0, wait, timeout);
1214 if (wait_code != 0)
return wait_code;
1218 for (
int i = 0; i < 6; i++) {
1224 if (wait && ret == 0) {
1241 if (wait_code != 0)
return wait_code;
1245 for (
int i = 0; i < 7; i++) {
1260 if (wait && ret == 0) {
1272 assert(servo_id > 0 && servo_id <= 7);
1278 return set_servo_angle(servo_id, angle, 0, 0, 0, wait, timeout, radius);
1284 for (
int i = 0; i < 7; i++) {
1293 for (
int i = 0; i < 6; i++) {
1296 mvtime = (float)(is_tool_coord ? 1.0 : 0.0);
1304 if (wait_code != 0)
return wait_code;
1309 for (
int i = 0; i < 6; i++) {
1315 if (wait && ret == 0) {
1327 if (wait_code != 0)
return wait_code;
1330 speed_ = speed_ > 0 ? speed_ : (float)0.8726646259971648;
1331 acc_ = acc_ > 0 ? acc_ : (float)17.453292519943297;
1334 if (wait && ret == 0) {
1387 for (
int i = 0; i < 6; i++) {
1392 for (
int i = 0; i < 7; i++) {
1401 for (
int i = 0; i < 7; i++) {
1406 for (
int i = 0; i < 6; i++) {
1415 for (
int i = 0; i < 6; i++) {
1424 for (
int i = 0; i < 7; i++) {
1462 for (
int i = 0; i < 6; i++) {
1473 if (wait_code != 0)
return wait_code;
1476 _gravity[0] = center_of_gravity[0];
1477 _gravity[1] = center_of_gravity[1];
1478 _gravity[2] = center_of_gravity[2];
1481 _gravity[0] = (float)(center_of_gravity[0] / 1000.0);
1482 _gravity[1] = (float)(center_of_gravity[1] / 1000.0);
1483 _gravity[2] = (float)(center_of_gravity[2] / 1000.0);
1491 if (wait_code != 0)
return wait_code;
1498 if (wait_code != 0)
return wait_code;
1505 if (wait_code != 0)
return wait_code;
1512 if (wait_code != 0)
return wait_code;
1574 unsigned char ver[3];
1583 unsigned char val[5];
1594 float last_pos = 0, pos_tmp, cur_pos;
1599 if (
int(last_pos) ==
int(target_pos))
1601 is_add = target_pos > last_pos ?
true :
false;
1612 failed_cnt = ret2 == 0 ? 0 : failed_cnt + 1;
1615 if (fabs(target_pos - cur_pos) < 1) {
1620 if (cur_pos <= last_pos) {
1623 else if (cur_pos <= target_pos) {
1636 if (cur_pos >= last_pos) {
1639 else if (cur_pos >= target_pos) {
1665 bool start_move =
false;
1666 int not_start_move_cnt = 0;
1674 failed_cnt = ret == 0 ? 0 : failed_cnt + 1;
1676 if ((status & 0x03) == 0 || (status & 0x03) == 2) {
1677 if (start_move)
return 0;
1678 not_start_move_cnt += 1;
1679 if (not_start_move_cnt > 20)
return 0;
1681 else if (!start_move) {
1682 not_start_move_cnt = 0;
1708 if (wait && ret == 0) {
1737 if (wait_code != 0)
return wait_code;
1738 assert(ionum == 0 || ionum == 1);
1739 if (delay_sec > 0) {
1749 assert(ionum == 0 || ionum == 1);
1762 for (
int i = 0; i < 8; i++) {
1763 digitals[i] = tmp >> i & 0x0001;
1765 if (digitals2 != NULL) {
1766 for (
int i = 8; i < 16; i++) {
1767 digitals2[i-8] = tmp >> i & 0x0001;
1775 assert(ionum == 0 || ionum == 1);
1787 if (wait_code != 0)
return wait_code;
1788 assert(ionum >= 0 && ionum <= 16);
1789 if (delay_sec > 0) {
1800 if (wait_code != 0)
return wait_code;
1801 assert(ionum == 0 || ionum == 1);
1812 assert(ionum >= 0 && ionum <= 16);
1818 assert(ionum >= 0 && ionum <= 16);
1824 return core->
cgpio_get_state(state_, digit_io, analog, input_conf, output_conf, input_conf2, output_conf2);
1847 int XArmAPI::get_reduced_states(
int *on,
int *xyz_list,
float *tcp_speed,
float *joint_speed,
float jrange[14],
int *fense_is_on,
int *collision_rebound_is_on) {
1851 *joint_speed = (float)(*joint_speed *
RAD_DEGREE);
1855 for (
int i = 0; i < 14; i++) {
1870 float joint_range[14];
1871 for (
int i = 0; i < 14; i++) {
1891 for (
int i = 0; i < 6; i++) {
1905 if (ret == 0 && filename != NULL) {
1969 if (filename != NULL) {
1977 if (ret == 0 && wait) {
1979 while (
state != 1) {
1985 max_count = max_count > 10 ? max_count : 10;
1987 while (
mode != 11) {
2003 while (
state != 4) {
2005 if (times == 1)
break;
2011 if (cnt > max_count)
break;
2027 template<
typename callable_vector,
typename callable>
2030 for (
size_t i = 0; i < callbacks.size(); i++) {
2031 if (callbacks[i] == callback)
return 1;
2033 callbacks.push_back(callback);
2037 template<
typename callable_vector,
typename callable>
2039 if (callback == NULL) {
2043 for (
size_t i = 0; i < callbacks.size(); i++) {
2044 if (callbacks[i] == callback) {
2045 callbacks.erase(callbacks.begin() + i);
2131 if (wait_code != 0)
return wait_code;
2141 int code = code1 == 0 ? code2 : code1;
2142 if (code == 0 && wait) {
2153 if (on && val == 1) {
2157 if (!on && val == 0) {
2171 unsigned char val1[5], val2[5], val3[5];
2183 versions[0] = (
unsigned char)
bin8_to_16(&val1[4]);
2186 else { code = ret1; }
2188 versions[1] = (
unsigned char)
bin8_to_16(&val2[4]);
2191 else { code = ret2; }
2193 versions[2] = (
unsigned char)
bin8_to_16(&val3[4]);
2196 else { code = ret3; }
2202 float val1, val2, val3;
2210 if (ret1 == 0) { versions[0] = (
unsigned char)val1; }
2211 else { code = ret1; }
2212 if (ret2 == 0) { versions[1] = (
unsigned char)val2; }
2213 else { code = ret2; }
2214 if (ret3 == 0) { versions[2] = (
unsigned char)val3; }
2215 else { code = ret3; }
2221 float val1, val2, val3;
2229 if (ret1 == 0) { versions[0] = (
unsigned char)val1; }
2230 else { code = ret1; }
2231 if (ret2 == 0) { versions[1] = (
unsigned char)val2; }
2232 else { code = ret2; }
2233 if (ret3 == 0) { versions[2] = (
unsigned char)val3; }
2234 else { code = ret3; }
2246 if (wait_code != 0)
return wait_code;
2253 if (wait_code != 0)
return wait_code;
2260 if (wait_code != 0)
return wait_code;
2267 if (wait_code != 0)
return wait_code;
2274 if (wait_code != 0)
return wait_code;
2292 if (wait_code != 0)
return wait_code;
2296 for (
int i = 0; i < 6; i++) {
2301 if (wait && ret == 0) {
2310 return set_position_aa(pose, 0, 0, 0, is_tool_coord, relative, wait, timeout);
2316 for (
int i = 0; i < 6; i++) {
2329 for (
int i = 0; i < 6; i++) {
2334 for (
int i = 0; i < 6; i++) {
2344 for (
int i = 0; i < 6; i++) {
2358 int err_warn[2] = { 0 };
2371 *baud_inx = (int)val;
2374 int err_warn[2] = { 0 };
2392 if (cur_baud_inx != baud_inx) {
2401 int err_warn[2] = { 0 };
2426 unsigned char *send_data =
new unsigned char[7 + length];
2427 send_data[0] = 0x09;
2428 send_data[1] = 0x10;
2429 send_data[2] = 0x03;
2430 send_data[3] = 0xE8;
2431 send_data[4] = 0x00;
2432 send_data[5] = 0x03;
2433 send_data[6] = (
unsigned char)length;
2434 for (
int i = 0; i < length; i++) { send_data[7+i] = params[i]; }
2442 unsigned char *send_data =
new unsigned char[6];
2443 send_data[0] = 0x09;
2444 send_data[1] = 0x03;
2445 send_data[2] = 0x07;
2446 send_data[3] = 0xD0;
2447 send_data[4] = 0x00;
2448 send_data[5] = number_of_registers;
2452 if (number_of_registers >= 0x01) {
2458 if (number_of_registers >= 0x02) {
2464 if (number_of_registers >= 0x03) {
2484 unsigned char rx_data[9] = { 0 };
2487 failed_cnt = code2 == 0 ? 0 : failed_cnt + 1;
2505 unsigned char rx_data[9] = { 0 };
2508 failed_cnt = code2 == 0 ? 0 : failed_cnt + 1;
2530 unsigned char params[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
2531 unsigned char rx_data[6] = { 0 };
2533 if (ret_data != NULL) { memcpy(ret_data, rx_data, 6); }
2539 unsigned char params[6] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 };
2540 unsigned char rx_data[6] = { 0 };
2542 if (ret_data != NULL) { memcpy(ret_data, rx_data, 6); }
2557 unsigned char params[6] = { 0x09, 0x00, 0x00, pos, speed, force };
2558 unsigned char rx_data[6] = { 0 };
2566 if (ret_data != NULL) { memcpy(ret_data, rx_data, 6); }
2623 unsigned char params[6] = { 0x08, 0x03, (
unsigned char)(address >> 8), (
unsigned char)address, (
unsigned char)(number_of_registers >> 8), (
unsigned char)number_of_registers };
2635 failed_cnt = code2 == 0 ? 0 : failed_cnt + 1;
2657 failed_cnt = code2 == 0 ? 0 : failed_cnt + 1;
2672 unsigned char params[6] = { 0x08, 0x06, 0x01, 0x00, 0x00, (
unsigned char)enable };
2673 unsigned char rx_data[6] = { 0 };
2681 unsigned short tmp = speed;
2682 unsigned char params[6] = { 0x08, 0x06, 0x03, 0x03, (
unsigned char)(tmp >> 8), (
unsigned char)tmp };
2683 unsigned char rx_data[6] = { 0 };
2692 unsigned char params[11] = { 0x08, 0x10, 0x07, 0x00, 0x00, 0x02, 0x04 };
2693 params[7] = (
unsigned char)(pos >> 24);
2694 params[8] = (
unsigned char)(pos >> 16);
2695 params[9] = (
unsigned char)(pos >> 8);
2696 params[10] = (
unsigned char)(pos);
2697 unsigned char rx_data[6] = { 0 };
2731 unsigned char rx_data[5] = { 0 };
2733 *status = (rx_data[3] << 8) + rx_data[4];
2747 unsigned char rx_data[5] = { 0 };
2749 *err = (rx_data[3] << 8) + rx_data[4];
2756 unsigned char params[6] = { 0x08, 0x06, 0x00, 0x0F, 0x00, 0x00 };
2757 unsigned char rx_data[6] = { 0 };
2776 if (ret == 0 && cur_baud_inx < 13)
2784 unsigned char *rx_data =
new unsigned char[ret_length + 1];
2787 memcpy(ret_data, rx_data + 1, ret_length);
2819 params[inx] = (
fp32)va_arg(args,
double);
2836 for (
int i = 0; i < 7; i++) {
2845 for (
int i = 0; i < 6; i++) {
int set_gravity_dir(float gravity_dir[3])
int get_reduced_states(int *on, int xyz_list[6], float *tcp_speed, float *joint_speed, float jrange_rad[14]=NULL, int *fense_is_on=NULL, int *collision_rebound_is_on=NULL, int length=21)
int set_collis_sens(int value)
int register_mtable_mtbrake_changed_callback(void(*callback)(int mtable, int mtbrake))
static const unsigned short SOFT_REBOOT
int _check_code(int code, bool is_move_cmd=false)
bool * motor_brake_states
int major_version_number_
int is_joint_limit(fp32 angles[7], int *limit)
void sleep_milliseconds(unsigned long milliseconds)
int gripper_modbus_set_pos(float pulse)
int _check_gripper_position(fp32 target_pos, fp32 timeout=10)
std::vector< std::string > split(const std::string &str, const std::string &pattern)
int set_joint_maxacc(float maxacc)
fp32 * collision_model_params
int get_tgpio_digital(int *io0_value, int *io1_value)
int get_err_code(int *rx_data)
int load_trajectory(char *filename, float timeout=10)
static const int CHECK_FAILED
int get_version(unsigned char rx_data[40])
int gripper_modbus_clean_err(void)
static const int TCP_PORT_REPORT_RICH
int release_mtable_mtbrake_changed_callback(void(*callback)(int mtable, int mtbrake)=NULL)
std::vector< void(*)(int)> state_changed_callbacks_
unsigned char version[30]
bool robotiq_is_activated_
int tgpio_get_analog1(float *value)
int set_timeout(float timeout)
static const int TRAJ_RW_FAILED
int set_bio_gripper_enable(bool enable, bool wait=true, fp32 timeout=3)
static const int SAVE_SUCCESS
int get_version(unsigned char version[40])
int set_gripper_mode(int mode)
static const int EMERGENCY_STOP
int cgpio_get_analog2(float *value)
XArmAPI(const std::string &port="", bool is_radian=DEFAULT_IS_RADIAN, bool do_not_open=false, bool check_tcp_limit=true, bool check_joint_limit=true, bool check_cmdnum_limit=true, bool check_robot_sn=false, bool check_is_ready=true, bool check_is_pause=true, int max_callback_thread_count=-1, int max_cmdnum=256)
int release_count_changed_callback(void(*callback)(int count)=NULL)
static const int SUCTION_CUP_TOUT
int register_report_location_callback(void(*callback)(const fp32 *pose, const fp32 *angles))
int move_jointb(float mvjoint[7], float mvvelo, float mvacc, float mvradii)
fp32 last_used_joint_speed
int get_cmdnum(int *cmdnum)
static const int IS_FAULT
int get_tgpio_version(unsigned char versions[3])
void _report_callback(callable_vector &&callbacks, arguments &&...args)
int get_report_tau_or_i(int *tau_or_i)
int _robotiq_get(unsigned char ret_data[9], unsigned char number_of_registers=0x03)
static const int TGPIO_ID_ERR
static void report_thread_handle_(void *arg)
SocketPort * stream_tcp_report_
int register_mode_changed_callback(void(*callback)(int mode))
int gripper_version_numbers_[3]
int register_error_warn_changed_callback(void(*callback)(int err_code, int warn_code))
int register_connect_changed_callback(void(*callback)(bool connected, bool reported))
int _bio_gripper_wait_motion_completed(fp32 timeout=5)
int move_lineb(float mvpose[6], float mvvelo, float mvacc, float mvtime, float mvradii)
static const int END_EFFECTOR_NOT_ENABLED
static const int TGPIO_ID
int set_tcp_maxacc(float maxacc)
int get_report_tau_or_i(int *rx_data)
int release_mode_changed_callback(void(*callback)(int mode)=NULL)
int close_bio_gripper(int speed=0, bool wait=true, fp32 timeout=5)
int _checkset_modbus_baud(int baudrate, bool check=true)
int set_reduced_mode(bool on)
int shutdown_system(int value=1)
int set_world_offset(float pose_offset[6])
int config_io_stop_reset(int io_type, int val)
int release_state_changed_callback(void(*callback)(int state)=NULL)
int _get_modbus_baudrate(int *baud_inx)
int set_reduced_jrange(float jrange_rad[14])
int get_pose_offset(float pose1[6], float pose2[6], float offset[6], int orient_type_in=0, int orient_type_out=0)
int release_report_location_callback(void(*callback)(const fp32 *pose, const fp32 *angles)=NULL)
int move_gohome(fp32 speed=0, fp32 acc=0, fp32 mvtime=0, bool wait=false, fp32 timeout=NO_TIMEOUT)
int * cgpio_input_digitals
void hex_to_nfp32(unsigned char *datahex, float *dataf, int n)
void _report_count_changed_callback(void)
int set_position_aa(fp32 pose[6], fp32 speed=0, fp32 acc=0, fp32 mvtime=0, bool is_tool_coord=false, bool relative=false, bool wait=false, fp32 timeout=NO_TIMEOUT)
static const int ERR_CODE
int shutdown_system(int value)
fp32 * cgpio_output_anglogs
int get_fk(float angles[7], float pose[6])
int load_traj(char filename[81])
int get_position(fp32 pose[6])
int vc_set_linev(float line_v[6], int coord)
int read_frame(unsigned char *data)
int reload_dynamics(void)
std::vector< void(*)(int)> mode_changed_callbacks_
int get_cgpio_analog(int ionum, fp32 *value)
int get_state(int *rx_data)
int set_xyz_limits(int xyz_list[6])
int is_tcp_limit(float pose[6], int *value)
int bin8_to_32(unsigned char *a)
int release_cmdnum_changed_callback(void(*callback)(int cmdnum)=NULL)
int tgpio_get_digital(int *io1, int *io2)
int _robotiq_wait_activation_completed(fp32 timeout=3)
int minor_version_number_
int reload_dynamics(void)
int set_reduced_jointspeed(float jspd_rad)
int set_servo_cartesian_aa(fp32 pose[6], fp32 speed=0, fp32 acc=0, bool is_tool_coord=false, bool relative=false)
std::vector< void(*)(int, int)> error_warn_changed_callbacks_
std::vector< void(*)(bool, bool)> connect_changed_callbacks_
std::vector< void(*)(int)> cmdnum_changed_callbacks_
int set_counter_reset(void)
int save_traj(char filename[81])
int set_collision_tool_model(int tool_type, int n=0,...)
int set_suction_cup(bool on, bool wait=false, float timeout=3, float delay_sec=0)
unsigned char * gpio_reset_config
int release_error_warn_changed_callback(void(*callback)(int err_code, int warn_code)=NULL)
int set_collision_tool_model(int tool_type, int n=0, float *argv=NULL)
static const int TRAJ_PLAYBACK_TOUT
void _report_mode_changed_callback(void)
int connect(const std::string &port="")
int get_joint_pose(float angles[7])
int set_tool_position(fp32 pose[6], fp32 speed=0, fp32 acc=0, fp32 mvtime=0, bool wait=false, fp32 timeout=NO_TIMEOUT)
int get_tgpio_analog(int ionum, float *value)
int set_timeout(fp32 timeout)
void _report_connect_changed_callback(void)
static const int NOT_CONNECTED
int clean_bio_gripper_error(void)
int get_err_warn_code(int err_warn[2])
int set_gripper_position(fp32 pos, bool wait=false, fp32 timeout=10)
int collision_sensitivity
int move_circle(float pose1[6], float pose2[6], float mvvelo, float mvacc, float mvtime, float percent)
int move_servo_cartesian(float mvpose[6], float mvvelo, float mvacc, float mvtime)
int is_joint_limit(float joint[7], int *value)
int set_pause_time(fp32 sltime)
static const int API_EXCEPTION
int set_cgpio_digital(int ionum, int value, float delay_sec=0)
long long max_report_interval_
void _report_mtable_mtbrake_changed_callback(void)
int set_position(fp32 pose[6], fp32 radius=-1, fp32 speed=0, fp32 acc=0, fp32 mvtime=0, bool wait=false, fp32 timeout=NO_TIMEOUT)
int set_cgpio_digital_input_function(int ionum, int fun)
static const int WAIT_FINISH_TIMEOUT
static const int STATE_NOT_READY
static const int HAS_ERROR
int cgpio_get_state(int *state, int *digit_io, float *analog, int *input_conf, int *output_conf, int *input_conf2=NULL, int *output_conf2=NULL)
bool _version_is_ge(int major=1, int minor=2, int revision=11)
int register_count_changed_callback(void(*callback)(int count))
int playback_traj(int times, int spdx=1)
static const int IS_ENABLED
void dispatch(callable &&f, arguments &&...args)
int _robotiq_wait_motion_completed(fp32 timeout=5, bool check_detected=false)
int set_collision_rebound(bool on)
long long sleep_finish_time_
int get_cgpio_digital(int *digitals, int *digitals2=NULL)
int robotiq_open(unsigned char speed=0xFF, unsigned char force=0xFF, bool wait=true, fp32 timeout=5, unsigned char ret_data[6]=NULL)
int get_traj_rw_status(int *rx_data)
int cgpio_position_set_analog(int ionum, float value, float xyz[3], float tol_r)
int set_tcp_maxacc(fp32 acc)
int xarm_gripper_error_code_
std::vector< void(*)(const fp32 *)> temperature_changed_callbacks_
int move_line_aa(float mvpose[6], float mvvelo, float mvacc, float mvtime, int mvcoord=0, int relative=0)
int get_robot_sn(unsigned char rx_data[40])
int set_servo_cartesian(fp32 pose[6], fp32 speed=0, fp32 acc=0, fp32 mvtime=0, bool is_tool_coord=false)
int tgpio_addr_w16(int addr, float value)
static const int TCP_PORT_CONTROL
int get_cgpio_state(int *state, int *digit_io, fp32 *analog, int *input_conf, int *output_conf, int *input_conf2=NULL, int *output_conf2=NULL)
int servo_addr_r16(int id, int addr, float *value)
bool bio_gripper_is_enabled_
int move_gohome(float mvvelo, float mvacc, float mvtime)
int get_ik(float pose[6], float angles[7])
int gripper_modbus_set_en(int value)
int _robotiq_set(unsigned char *params, int length, unsigned char ret_data[6])
int save_record_trajectory(char *filename, float timeout=10)
int tgpio_set_modbus(unsigned char *send_data, int length, unsigned char *recv_data)
int set_modbus_timeout(int value)
int _get_bio_gripper_register(unsigned char *ret_data, int address=0x00, int number_of_registers=1)
void _report_temperature_changed_callback(void)
int set_teach_sensitivity(int sensitivity)
int set_counter_increase(void)
int set_cgpio_digital_with_xyz(int ionum, int value, float xyz[3], float tol_r)
int _release_event_callback(callable_vector &&callbacks, callable &&f)
static const int SAVE_FAIL
int set_tgpio_digital(int ionum, int value, float delay_sec=0)
int set_tcp_jerk(fp32 jerk)
int gripper_modbus_get_errcode(int *err)
void emergency_stop(void)
int set_simulation_robot(int on_off)
int robotiq_close(unsigned char speed=0xFF, unsigned char force=0xFF, bool wait=true, fp32 timeout=5, unsigned char ret_data[6]=NULL)
int _get_gripper_status(int *status)
int get_position_aa(fp32 pose[6])
int _wait_move(fp32 timeout)
int config_cgpio_reset_when_stop(bool on_off)
int cgpio_set_infun(int ionum, int fun)
int motion_enable(bool enable, int servo_id=8)
int get_position_aa(float pose[6])
int cgpio_set_auxdigit(int ionum, int value)
int get_pose_offset(float pose1[6], float pose2[6], float offset[6], int orient_type_in=0, int orient_type_out=0)
int gripper_modbus_set_posspd(float speed)
int get_gripper_err_code(int *err)
int * cgpio_output_digitals
int get_bio_gripper_error(int *err)
int set_gripper_enable(bool enable)
int set_tcp_offset(float pose_offset[6])
void _recv_report_data(void)
int get_robot_sn(unsigned char robot_sn[40])
static const int LOAD_FAIL
int set_world_offset(float pose_offset[6])
int set_joint_jerk(fp32 jerk)
int config_tgpio_reset_when_stop(bool on_off)
void reset(bool wait=false, fp32 timeout=NO_TIMEOUT)
int is_tcp_limit(fp32 pose[6], int *limit)
std::vector< void(*)(int)> count_changed_callbacks_
void _check_is_pause(void)
int set_reduced_tcp_boundary(int boundary[6])
int set_fense_on(int on_off)
int _check_modbus_code(int ret, unsigned char *rx_data=NULL)
int robotiq_reset(unsigned char ret_data[6]=NULL)
int get_gripper_version(unsigned char versions[3])
int bio_gripper_error_code_
int gripper_modbus_r16s(int addr, int len, unsigned char *rx_data)
int clean_gripper_error(void)
int gripper_modbus_set_mode(int value)
fp32 * last_used_position
int tgpio_get_analog2(float *value)
int get_reduced_mode(int *mode)
int set_collis_reb(int on_off)
std::thread report_thread_
int get_tcp_pose(float pose[6])
void _check_version(void)
long long get_system_time()
int set_cgpio_digital_output_function(int ionum, int fun)
int start_record_trajectory(void)
int robotiq_get_status(unsigned char ret_data[9], unsigned char number_of_registers=3)
bool control_box_type_is_1300_
int cgpio_get_auxdigit(int *value)
int move_line_tool(float mvpose[6], float mvvelo, float mvacc, float mvtime)
fp32 * realtime_joint_speeds
int sleep_instruction(float sltime)
int register_state_changed_callback(void(*callback)(int state))
int move_line(float mvpose[6], float mvvelo, float mvacc, float mvtime)
int set_cgpio_analog(int ionum, fp32 value)
int set_gravity_direction(fp32 gravity_dir[3])
void _report_location_callback(void)
static const int WAR_CODE
static const int TRAJ_RW_TOUT
int set_servo_angle_j(fp32 angles[7], fp32 speed=0, fp32 acc=0, fp32 mvtime=0)
static const int SERIAL_BAUD
int set_servo_angle(fp32 angles[7], fp32 speed=0, fp32 acc=0, fp32 mvtime=0, bool wait=false, fp32 timeout=NO_TIMEOUT, fp32 radius=-1)
static const int ERR_CODE
int get_bio_gripper_status(int *status)
void set_max_thread_count(int max_thread_count)
int set_tgpio_modbus_timeout(int timeout)
int get_inverse_kinematics(fp32 pose[6], fp32 angles[7])
int set_gripper_speed(fp32 speed)
int set_bio_gripper_speed(int speed)
int get_cmdnum(int *rx_data)
int register_temperature_changed_callback(void(*callback)(const fp32 *temps))
std::condition_variable cond_
int get_gripper_position(fp32 *pos)
int get_state(int *state)
bool _gripper_is_support_status(void)
long long last_report_time_
int set_reduced_max_joint_speed(float speed)
int _check_gripper_status(fp32 timeout=10)
int tgpio_addr_r16(int addr, float *value)
int set_tcp_jerk(float jerk)
int set_collision_sensitivity(int sensitivity)
int register_cmdnum_changed_callback(void(*callback)(int cmdnum))
void _report_cmdnum_changed_callback(void)
int get_forward_kinematics(fp32 angles[7], fp32 pose[6])
int is_collision_detection
int set_cgpio_analog_with_xyz(int ionum, float value, float xyz[3], float tol_r)
static const int WAR_CODE
int get_servo_version(unsigned char versions[3], int servo_id=1)
static const int LOAD_SUCCESS
static const int MODBUS_BAUD_NOT_CORRECT
int move_circle(fp32 pose1[6], fp32 pose2[6], fp32 percent, fp32 speed=0, fp32 acc=0, fp32 mvtime=0, bool wait=false, fp32 timeout=NO_TIMEOUT)
int set_fense_mode(bool on)
int set_reduced_joint_range(float jrange[14])
int cgpio_position_set_digital(int ionum, int value, float xyz[3], float tol_r)
int set_servo_attach(int servo_id)
std::vector< void(*)(const fp32 *, const fp32 *)> report_location_callbacks_
int revision_version_number_
int get_suction_cup(int *val)
static const int IS_MOTION
int set_record_traj(int value)
int move_servoj(float mvjoint[7], float mvvelo, float mvacc, float mvtime)
int open_bio_gripper(int speed=0, bool wait=true, fp32 timeout=5)
void commit(callable &&f, arguments &&...args)
int vc_set_joint_velocity(fp32 speeds[7], bool is_sync=true)
int tgpio_position_set_digital(int ionum, int value, float xyz[3], float tol_r)
int _bio_gripper_send_modbus(unsigned char *send_data, int length, unsigned char *ret_data, int ret_length)
int gripper_modbus_get_pos(float *pulse)
int release_connect_changed_callback(void(*callback)(bool connected, bool reported)=NULL)
int set_reduced_mode(int on_off)
int set_teach_sens(int value)
int _wait_until_cmdnum_lt_max(void)
int move_joint(float mvjoint[7], float mvvelo, float mvacc, float mvtime)
int playback_trajectory(int times=1, char *filename=NULL, bool wait=false, int double_speed=1)
int set_reduced_linespeed(float lspd_mm)
int get_reduced_mode(int *rx_data)
int robotiq_set_position(unsigned char pos, unsigned char speed=0xFF, unsigned char force=0xFF, bool wait=true, fp32 timeout=5, unsigned char ret_data[6]=NULL)
int stop_record_trajectory(char *filename=NULL)
int _bio_gripper_wait_enable_completed(fp32 timeout=3)
int release_temperature_changed_callback(void(*callback)(const fp32 *temps)=NULL)
int get_servo_angle(fp32 angles[7])
int set_self_collision_detection(int on_off)
int vc_set_jointv(float jnt_v[7], int jnt_sync)
int set_tcp_offset(fp32 pose_offset[6])
void _update(unsigned char *data)
int get_tgpio_modbus_baudrate(int *baud)
int _register_event_callback(callable_vector &&callbacks, callable &&f)
static const unsigned short MODBUS_BAUDRATE
int set_tcp_load(float mass, float load_offset[3])
void _report_state_changed_callback(void)
int set_joint_jerk(float jerk)
int move_servo_cart_aa(float mvpose[6], float mvvelo, float mvacc, int tool_coord=0, int relative=0)
int set_report_tau_or_i(int tau_or_i=0)
int set_tgpio_modbus_baudrate(int baud)
int set_self_collision_detection(bool on)
int cgpio_set_outfun(int ionum, int fun)
void _report_error_warn_changed_callback(void)
int motion_en(int id, int value)
int cgpio_set_analog2(float value)
int set_reduced_max_tcp_speed(float speed)
int _set_bio_gripper_position(int pos, int speed=0, bool wait=true, fp32 timeout=5)
int cgpio_get_analog1(float *value)
int cgpio_delay_set_digital(int ionum, int value, float delay_sec)
int vc_set_cartesian_velocity(fp32 speeds[6], bool is_tool_coord=false)
int set_joint_maxacc(fp32 acc)
static int get_baud_inx(int baud)
int set_report_tau_or_i(int tau_or_i)
int getset_tgpio_modbus_data(unsigned char *modbus_data, int modbus_length, unsigned char *ret_data, int ret_length)
std::vector< void(*)(int, int)> mtable_mtbrake_changed_callbacks_
struct RobotIqStatus robotiq_status
int set_servo_detach(int servo_id)
static const int MODBUS_BAUD_NOT_SUPPORT
void _update_old(unsigned char *data)
fp32 * cgpio_intput_anglogs
static const int END_EFFECTOR_HAS_FAULT
int robotiq_set_activate(bool wait=true, fp32 timeout=3, unsigned char ret_data[6]=NULL)
int get_reduced_states(int *on, int *xyz_list, float *tcp_speed, float *joint_speed, float jrange[14]=NULL, int *fense_is_on=NULL, int *collision_rebound_is_on=NULL)
static bool compare_version(int v1[3], int v2[3])
void bin32_to_8(int a, unsigned char *b)
int set_tcp_load(fp32 weight, fp32 center_of_gravity[3])
static const int IS_NOT_ENABLED
static const int NOT_READY
int set_brake(int axis, int en)
int bin8_to_16(unsigned char *a)
int cgpio_set_analog1(float value)
int get_trajectory_rw_status(int *status)
int tgpio_delay_set_digital(int ionum, int value, float delay_sec)
int set_tgpio_digital_with_xyz(int ionum, int value, float xyz[3], float tol_r)
int tgpio_set_digital(int ionum, int value)
int set_simulation_robot(bool on)
bool * motor_enable_states