mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-08-18 09:29:03 +08:00
added trajectory_done flag to heartbeat
This commit is contained in:
@@ -307,7 +307,7 @@ bool CANSimple::get_iq_callback(const Axis& axis) {
|
||||
if (!Idq_setpoint.has_value()) {
|
||||
Idq_setpoint = {0.0f, 0.0f};
|
||||
}
|
||||
|
||||
|
||||
static_assert(sizeof(float) == sizeof(Idq_setpoint->first));
|
||||
static_assert(sizeof(float) == sizeof(Idq_setpoint->second));
|
||||
can_setSignal<float>(txmsg, Idq_setpoint->first, 0, 32, true);
|
||||
@@ -383,7 +383,25 @@ bool CANSimple::send_heartbeat(const Axis& axis) {
|
||||
txmsg.len = 8;
|
||||
|
||||
can_setSignal(txmsg, axis.error_, 0, 32, true);
|
||||
can_setSignal(txmsg, axis.current_state_, 32, 32, true);
|
||||
can_setSignal(txmsg, uint8_t(axis.current_state_), 32, 8, true);
|
||||
|
||||
// Motor flags
|
||||
// bit 0 = pre_calibrated
|
||||
uint8_t motorFlags = 0;
|
||||
|
||||
// Encoder flags
|
||||
uint8_t encoderFlags = 0;
|
||||
|
||||
// Controller flags
|
||||
// bit 7 = traj_done flag
|
||||
uint8_t controllerFlags = 0;
|
||||
uint8_t trajDone = uint8_t(axis.controller_.trajectory_done_) << 7;
|
||||
controllerFlags |= trajDone;
|
||||
|
||||
can_setSignal(txmsg, motorFlags, 40, 8, true);
|
||||
can_setSignal(txmsg, encoderFlags, 48, 8, true);
|
||||
can_setSignal(txmsg, controllerFlags, 56, 8, true);
|
||||
// can_setSignal(txmsg, axis.current_state_, 32, 32, true);
|
||||
|
||||
return canbus_->send_message(txmsg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user