21 int main(
int argc,
char *argv[])
23 const char* port_name =
"/dev/ttyUSB0";
24 int baud_rate = 57600;
29 printf(
"Please set '-port_name', '-baud_rate', '-dynamixel id' arguments for connected Dynamixels\n");
35 baud_rate = atoi(argv[2]);
36 dxl_id = atoi(argv[3]);
44 uint16_t model_number = 0;
46 result = dxl_wb.
init(port_name, baud_rate, &log);
50 printf(
"Failed to init\n");
55 printf(
"Succeed to init(%d)\n", baud_rate);
57 result = dxl_wb.
ping(dxl_id, &model_number, &log);
61 printf(
"Failed to ping\n");
65 printf(
"Succeed to ping\n");
66 printf(
"id : %d, model_number : %d\n", dxl_id, model_number);
69 result = dxl_wb.
itemWrite(dxl_id,
"LED", 1, &log);
73 printf(
"Failed to LED On\n");
77 printf(
"Succeed to LED On\n");
81 result = dxl_wb.
itemRead(dxl_id,
"Present_Position", &get_data, &log);
85 printf(
"Failed to get present position\n");
89 printf(
"Succeed to get present position(value : %d)\n", get_data);
bool init(const char *device_name="/dev/ttyUSB0", uint32_t baud_rate=57600, const char **log=NULL)
DynamixelWorkbench dxl_wb
bool itemWrite(uint8_t id, const char *item_name, int32_t data, const char **log=NULL)
bool ping(uint8_t id, uint16_t *get_model_number, const char **log=NULL)
int main(int argc, char *argv[])
bool itemRead(uint8_t id, const char *item_name, int32_t *data, const char **log=NULL)