21 #define BAUDRATE_NUM 7 23 int main(
int argc,
char *argv[])
25 const char* port_name =
"/dev/ttyUSB0";
29 printf(
"Please set '-port_name' arguments for connected Dynamixels\n");
42 uint8_t scanned_id[100];
45 uint32_t baudrate[
BAUDRATE_NUM] = {9600, 57600, 115200, 1000000, 2000000, 3000000, 4000000};
52 result = dxl_wb.
init(port_name, baudrate[index], &log);
56 printf(
"Failed to init\n");
59 printf(
"Succeed to init(%d)\n", baudrate[index]);
62 for (uint8_t num = 0; num < 100; num++) scanned_id[num] = 0;
64 printf(
"Wait for scan...\n");
65 result = dxl_wb.
scan(scanned_id, &dxl_cnt, range, &log);
69 printf(
"Failed to scan\n");
73 printf(
"Find %d Dynamixels\n", dxl_cnt);
75 for (
int cnt = 0; cnt < dxl_cnt; cnt++)
76 printf(
"id : %d, model name : %s\n", scanned_id[cnt], dxl_wb.
getModelName(scanned_id[cnt]));
bool init(const char *device_name="/dev/ttyUSB0", uint32_t baud_rate=57600, const char **log=NULL)
DynamixelWorkbench dxl_wb
const char * getModelName(uint8_t id, const char **log=NULL)
bool scan(uint8_t *get_id, uint8_t *get_the_number_of_id, uint8_t range=253, const char **log=NULL)
int main(int argc, char *argv[])