6 serial_port_(&finger_data_mtx_, &reply_mtx_, &is_connected_),
7 connection_trd_on_(true),
34 return is_port_opened;
48 return is_port_closed;
62 std::string pos_cmd =
"@" + std::to_string(mot_id + 1) +
"P+000040......";
66 pos_cmd.replace(3, 1,
"-");
72 pos_cmd.replace(5, 3,
"999");
76 pos_cmd.replace(5, 3,
numToStr(mot_pos, 3));
86 std::string spe_cmd =
"@" + std::to_string(mot_id + 1) +
"S+....0080....";
90 spe_cmd.replace(3, 1,
"-");
96 spe_cmd.replace(8, 2,
"99");
100 spe_cmd.replace(8, 2,
numToStr(mot_spe, 2));
110 std::string for_cmd =
"@" + std::to_string(mot_id + 1) +
"F+....0080....";
114 for_cmd.replace(8, 2,
"99");
116 else if (fin_for > 0)
118 for_cmd.replace(8, 2,
numToStr(fin_for, 2));
278 std::string grasp_cmd =
"@AG" + std::string(1, grasp_id) +
"a10050......";
286 std::string grasp_cmd =
"@AG" + std::string(1, grasp_id) +
"A10050......";
294 std::string grasp_cmd =
"@AG" + std::string(1, grasp_id) +
"M00050......";
296 if (close_percent > 99)
298 grasp_cmd.replace(5, 3,
"100");
300 else if (close_percent > 0)
302 grasp_cmd.replace(6, 2,
numToStr(close_percent, 2));
317 std::string grasp_ref_cmd =
"@1G" + std::string(1, grasp_id) +
"+000+000+000";
321 grasp_ref_cmd.replace(5, 3,
numToStr(rest, 3));
326 grasp_ref_cmd.replace(9, 3,
numToStr(pos, 3));
331 grasp_ref_cmd.replace(13, 1,
"1");
335 grasp_ref_cmd.replace(13, 3,
numToStr(delay, 3));
350 std::string grasp_ref_cmd =
"@3G" + std::string(1, grasp_id) +
"+000+000+000";
354 grasp_ref_cmd.replace(5, 3,
numToStr(rest, 3));
359 grasp_ref_cmd.replace(9, 3,
numToStr(pos, 3));
364 grasp_ref_cmd.replace(13, 1,
"1");
368 grasp_ref_cmd.replace(13, 3,
numToStr(delay, 3));
383 std::string grasp_ref_cmd =
"@2G" + std::string(1, grasp_id) +
"+000+000+000";
387 grasp_ref_cmd.replace(5, 3,
numToStr(rest, 3));
392 grasp_ref_cmd.replace(9, 3,
numToStr(pos, 3));
397 grasp_ref_cmd.replace(13, 1,
"1");
401 grasp_ref_cmd.replace(13, 3,
numToStr(delay, 3));
415 std::string stream_cmd =
"@ADP" + std::to_string(b_on_off ? 1 : 0)
425 std::string stream_cmd =
"@ADS" + std::to_string(b_on_off ? 1 : 0)
435 std::string stream_cmd =
"@ADA" + std::to_string(b_on_off ? 1 : 0)
445 std::string stream_cmd =
"@ADC" + std::to_string(b_on_off ? 1 : 0)
455 char num_ascii[n_digits];
457 for (int8_t ascii_it = n_digits - 1; ascii_it > -1; --ascii_it)
459 num_ascii[ascii_it] = num % 10 + 48;
463 std::string num_str(num_ascii, n_digits);
489 std::this_thread::sleep_for(std::chrono::milliseconds(500));