22 #define BAUDRATE_NUM 7 24 int main(
int argc,
char *argv[])
26 std::string port_name =
"/dev/ttyUSB0";
30 printf(
"Please set '-port_name'arguments for connected Dynamixels\n");
43 uint8_t scanned_id[100];
46 uint32_t baudrate[
BAUDRATE_NUM] = {9600, 57600, 115200, 1000000, 2000000, 3000000, 4000000};
53 result = dxl_wb.
init(port_name.c_str(), baudrate[index], &log);
61 ROS_INFO(
"Succeed to init(%d)", baudrate[index]);
65 for (uint8_t num = 0; num < 100; num++) scanned_id[num] = 0;
68 result = dxl_wb.
scan(scanned_id, &dxl_cnt, range, &log);
76 ROS_INFO(
"Find %d Dynamixels", dxl_cnt);
78 for (
int cnt = 0; cnt < dxl_cnt; 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[])