21 int main(
int argc,
char *argv[])
23 const char* port_name =
"/dev/ttyUSB0";
24 int baud_rate = 57600;
30 printf(
"Please set '-port_name', '-baud_rate', '-dynamixel id' arguments for connected Dynamixels\n");
36 baud_rate = atoi(argv[2]);
37 dxl_id = atoi(argv[3]);
45 uint16_t model_number = 0;
47 result = dxl_wb.
init(port_name, baud_rate, &log);
51 printf(
"Failed to init\n");
56 printf(
"Succeeded to init(%d)\n", baud_rate);
58 result = dxl_wb.
ping(dxl_id, &model_number, &log);
62 printf(
"Failed to ping\n");
66 printf(
"Succeeded to ping\n");
67 printf(
"id : %d, model_number : %d\n", dxl_id, model_number);
71 printf(
"Please insert the right number from 0 to 5 to set control mode \n");
72 printf(
"0 - current control mode\n");
73 printf(
"1 - velocity control mode\n");
74 printf(
"2 - position control mode\n");
75 printf(
"3 - extended position control mode\n");
76 printf(
"4 - current based position control mode\n");
77 printf(
"5 - pwm control mode\n");
89 printf(
"Failed to set mode\n");
93 printf(
"Succeeded to set mode\n");
102 printf(
"Failed to set mode\n");
106 printf(
"Succeeded to set mode\n");
115 printf(
"Failed to set mode\n");
119 printf(
"Succeeded to set mode\n");
128 printf(
"Failed to set mode\n");
132 printf(
"Succeeded to set mode\n");
141 printf(
"Failed to set mode\n");
145 printf(
"Succeeded to set mode\n");
154 printf(
"Failed to set mode\n");
158 printf(
"Succeeded to set mode\n");
167 printf(
"Failed to set mode\n");
171 printf(
"Succeeded to set mode\n");
bool setCurrentBasedPositionControlMode(uint8_t id, const char **log=NULL)
bool setCurrentControlMode(uint8_t id, const char **log=NULL)
bool init(const char *device_name="/dev/ttyUSB0", uint32_t baud_rate=57600, const char **log=NULL)
DynamixelWorkbench dxl_wb
bool setExtendedPositionControlMode(uint8_t id, const char **log=NULL)
bool ping(uint8_t id, uint16_t *get_model_number, const char **log=NULL)
bool setVelocityControlMode(uint8_t id, const char **log=NULL)
bool setPWMControlMode(uint8_t id, const char **log=NULL)
bool setPositionControlMode(uint8_t id, const char **log=NULL)
int main(int argc, char *argv[])