saved work on cmd timeout, not finished yet

This commit is contained in:
Ruixiang Du
2020-09-14 18:45:08 +08:00
parent f7a4736644
commit 8ba694b894
2 changed files with 8 additions and 1 deletions

View File

@@ -31,6 +31,8 @@ class MobileBase {
MobileBase(const MobileBase &hunter) = delete;
MobileBase &operator=(const MobileBase &hunter) = delete;
void SetCmdTimeout(bool enable, uint32_t timeout_ms = 100);
// connect to roboot from CAN or serial
void Connect(std::string dev_name, int32_t baud_rate = 0);
@@ -50,6 +52,12 @@ class MobileBase {
std::shared_ptr<AsyncCAN> can_if_;
std::shared_ptr<AsyncSerial> serial_if_;
// timeout to be implemented in each vehicle
bool enable_timeout_ = true;
uint32_t timeout_ms_ = 100;
uint32_t watchdog_counter_ = 0;
virtual void CheckCmdTimeout();
// command thread
std::thread cmd_thread_;
int32_t cmd_thread_period_ms_ = 10;