From a768ead9fdb99b631ddb4e56316fd2c6c3d3e823 Mon Sep 17 00:00:00 2001 From: Ruixiang Du Date: Wed, 17 Jun 2020 15:03:02 +0800 Subject: [PATCH] finished hunter HunterBase::SendRobotCmd() --- src/platforms/hunter_base.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/platforms/hunter_base.cpp b/src/platforms/hunter_base.cpp index c2378ef..7625511 100644 --- a/src/platforms/hunter_base.cpp +++ b/src/platforms/hunter_base.cpp @@ -14,7 +14,10 @@ namespace westonrobot { -void HunterBase::SendRobotCmd() {} +void HunterBase::SendRobotCmd() { + static uint8_t cmd_count = 0; + SendMotionCmd(cmd_count++); +} void HunterBase::SendMotionCmd(uint8_t count) { // motion control message @@ -42,19 +45,12 @@ void HunterBase::SendMotionCmd(uint8_t count) { if (can_connected_) m_msg.body.motion_cmd_msg.data.cmd.checksum = CalcHunterCANChecksum( CAN_MSG_MOTION_CMD_ID, m_msg.body.motion_cmd_msg.data.raw, 8); - // serial_connected_: checksum will be calculated later when packed into a - // complete serial frame + // send to can bus if (can_connected_) { - // send to can bus can_frame m_frame; EncodeHunterMsgToCAN(&m_msg, &m_frame); can_if_->send_frame(m_frame); - } else { - // TODO - // send to serial port - // EncodeHunterMsgToUART(&m_msg, tx_buffer_, &tx_cmd_len_); - // serial_if_->send_bytes(tx_buffer_, tx_cmd_len_); } }