Merge pull request #709 from odriverobotics/can_controller_error

Add controller error message
This commit is contained in:
Paul Guenette
2022-09-05 22:10:08 -07:00
committed by GitHub
6 changed files with 34 additions and 2 deletions
+1
View File
@@ -65,3 +65,4 @@ GUI/node_modules
GUI/build
docs/reStructuredText/_build/
tools/odrive-cansimple.ini
+15
View File
@@ -154,6 +154,9 @@ void CANSimple::do_command(Axis& axis, const can_Message_t& msg) {
case MSG_GET_ADC_VOLTAGE:
get_adc_voltage_callback(axis, msg);
break;
case MSG_GET_CONTROLLER_ERROR:
get_controller_error_callback(axis);
break;
default:
break;
}
@@ -203,6 +206,18 @@ bool CANSimple::get_sensorless_error_callback(const Axis& axis) {
return canbus_->send_message(txmsg);
}
bool CANSimple::get_controller_error_callback(const Axis& axis) {
can_Message_t txmsg;
txmsg.id = axis.config_.can.node_id << NUM_CMD_ID_BITS;
txmsg.id += MSG_GET_CONTROLLER_ERROR; // heartbeat ID
txmsg.isExt = axis.config_.can.is_extended;
txmsg.len = 8;
can_setSignal(txmsg, axis.controller_.error_, 0, 32, true);
return canbus_->send_message(txmsg);
}
void CANSimple::set_axis_nodeid_callback(Axis& axis, const can_Message_t& msg) {
axis.config_.can.node_id = can_getSignal<uint32_t>(msg, 0, 32, true);
}
@@ -36,6 +36,7 @@ class CANSimple {
MSG_SET_POS_GAIN,
MSG_SET_VEL_GAINS,
MSG_GET_ADC_VOLTAGE,
MSG_GET_CONTROLLER_ERROR,
MSG_CO_HEARTBEAT_CMD = 0x700, // CANOpen NMT Heartbeat SEND
};
+1
View File
@@ -105,4 +105,5 @@ IEEE 754 Float","32
1","0
0"
0x01C,Get ADC Voltage****,Master***,ADC Voltage,0,IEEE 754 Float,32,1,0
0x01D,Get Controller Error*,Axis,Controller Error,0,Unsigned Int,32,1,0
0x700,CANOpen Heartbeat Message**,Slave,-,-,-,-,-,-
1 CMD ID Name Sender Signals Start byte Signal Type Bits Factor Offset
105
106
107
108
109
+8 -1
View File
@@ -161,6 +161,12 @@ setVelGainsMsg = cantools.database.can.Message(0x01B, "Set_Vel_gains", 8, [velGa
adcVoltage = cantools.database.can.Signal("ADC_Voltage", 0, 32, is_float=True)
getADCVoltageMsg = cantools.database.can.Message(0x01C, "Get_ADC_Voltage", 8, [adcVoltage])
# 0x01D - Controller Error
controllerError = cantools.database.can.Signal("Controller_Error", 0, 32)
controllerErrorMsg = cantools.database.can.Message(
0x01D, "Get_Controller_Error", 8, [controllerError]
)
db = cantools.database.can.Database(
[
heartbeatMsg,
@@ -189,7 +195,8 @@ db = cantools.database.can.Database(
setLinearCountMsg,
setPosGainMsg,
setVelGainsMsg,
getADCVoltageMsg
getADCVoltageMsg,
controllerErrorMsg,
]
)
+8 -1
View File
@@ -125,12 +125,18 @@ BO_ 27 Set_Vel_gains: 8 Vector__XXX
SG_ Vel_Integrator_Gain : 32|32@1+ (1,0) [0|0] "" Vector__XXX
SG_ Vel_Gain : 0|32@1+ (1,0) [0|0] "" Vector__XXX
BO_ 28 Get_ADC_Voltage: 8 Vector__XXX
SG_ ADC_Voltage : 0|32@1+ (1,0) [0|0] "" Vector__XXX
BO_ 29 Get_Controller_Error: 8 Vector__XXX
SG_ Controller_Error : 0|32@1+ (1,0) [0|0] "" Vector__XXX
BA_DEF_ BO_ "GenMsgCycleTime" INT 0 65535;
BA_DEF_DEF_ "GenMsgCycleTime" 0;
SIG_VALTYPE_ 9 Pos_Estimate : 1;
@@ -153,5 +159,6 @@ SIG_VALTYPE_ 23 Vbus_Voltage : 1;
SIG_VALTYPE_ 26 Pos_Gain : 1;
SIG_VALTYPE_ 27 Vel_Gain : 1;
SIG_VALTYPE_ 27 Vel_Integrator_Gain : 1;
SIG_VALTYPE_ 28 ADC_Voltage : 1;