Report axis errors and current state in heartbeat

This commit is contained in:
Unknown
2018-09-30 02:04:37 -04:00
parent 04a0a78c3d
commit c48251f3f5
+6
View File
@@ -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);