19 int main(
int argc,
char *argv[])
21 ros::init(argc, argv,
"quori_controller");
29 std::vector<std::string> devices;
30 if (!pnh.
getParam(
"devices", devices))
32 std::cerr <<
"Expected ~devices parameter" << std::endl;
36 bool generate_csvs =
false;
37 pnh.
getParam(
"generate_csvs", generate_csvs);
39 boost::asio::io_service service;
40 std::vector<SerialDevice::Ptr> serial_devices;
41 std::unique_ptr<std::ofstream> csv_file;
47 csv_file = std::make_unique<std::ofstream>(
"out.csv");
48 if (!*csv_file)
throw std::runtime_error(
"Could not open csv file");
50 std::cerr <<
"Opened CSV" << std::endl;
53 for (
const auto &device : devices)
56 if (csv) serial_device->attachSetPositionsCsv(csv);
57 serial_devices.push_back(serial_device);
61 Quori robot(nh, serial_devices);
65 double rate_hz = pnh.
param(
"rate", 100.0);
77 robot.
read(read_time, read_time - last_read);
78 last_read = read_time;
81 cm.
update(update_time, update_time - last_update);
82 last_update = update_time;
86 robot.
write(write_time, write_time - last_write);
87 last_write = write_time;