Try and fix random disconnects
This commit is contained in:
@@ -82,6 +82,15 @@ hardware_interface::return_type toid::StepperInterface::write(const rclcpp::Time
|
||||
boost::system::error_code ec;
|
||||
ec = serial_port_.close(ec);
|
||||
ec = serial_port_.open(serial_port_name_, ec);
|
||||
if(!ec.failed()) {
|
||||
try {
|
||||
for(int i = 0; i < 64; i++) {
|
||||
asio::write(serial_port_, asio::buffer("\x00"));
|
||||
}
|
||||
} catch(const std::runtime_error& err) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return hardware_interface::return_type::OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user