mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-26 21:10:05 +08:00
Report axis errors and current state in heartbeat
This commit is contained in:
@@ -41,6 +41,8 @@
|
||||
#include <cmsis_os.h>
|
||||
#include <stm32f4xx_hal.h>
|
||||
|
||||
#include <odrive_main.h>
|
||||
|
||||
std::unordered_map<CAN_HandleTypeDef *, ODriveCAN *> ctxMap;
|
||||
|
||||
// Constructor is called by communication.cpp and the handle is assigned appropriately
|
||||
@@ -65,6 +67,10 @@ void ODriveCAN::can_server_thread() {
|
||||
}
|
||||
|
||||
// Handle heartbeat message
|
||||
heartbeat.buf[0] = axes[0]->error_;
|
||||
heartbeat.buf[1] = axes[0]->current_state_;
|
||||
heartbeat.buf[2] = axes[1]->error_;
|
||||
heartbeat.buf[3] = axes[2]->current_state_;
|
||||
uint32_t now = osKernelSysTick();
|
||||
if(now - lastHeartbeatTick >= 100){
|
||||
write(heartbeat);
|
||||
|
||||
Reference in New Issue
Block a user