21 int main(
int argc,
char *argv[])
23 const char* port_name =
"/dev/ttyUSB0";
24 int baud_rate = 57600;
28 printf(
"Please set '-port_name' and '-baud_rate' arguments for connected Dynamixels\n");
34 baud_rate = atoi(argv[2]);
42 uint8_t scanned_id[16];
46 result = dxl_wb.
init(port_name, baud_rate, &log);
50 printf(
"Failed to init\n");
55 printf(
"Succeeded to init(%d)\n", baud_rate);
57 printf(
"Wait for scan...\n");
58 result = dxl_wb.
scan(scanned_id, &dxl_cnt, range, &log);
62 printf(
"Failed to scan\n");
66 printf(
"Find %d Dynamixels\n", dxl_cnt);
68 for (
int cnt = 0; cnt < dxl_cnt; cnt++)
69 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[])