Skip to content

Commit

Permalink
Add pos_gain and vel_gain messages to .dbc file
Browse files Browse the repository at this point in the history
  • Loading branch information
Wetmelon committed Sep 23, 2021
1 parent 965c0a1 commit e0aaa04
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tools/create_can_dbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@
position = cantools.database.can.Signal("Position", 0, 32, is_signed=True)
setLinearCountMsg = cantools.database.can.Message(0x019, "Set_Linear_Count", 8, [position])

# 0x01A - Set Pos gain
posGain = cantools.database.can.Signal("Pos_Gain", 0, 32, is_float=True)
setPosGainMsg = cantools.database.can.Message(0x01A, "Set_Pos_Gain", 8, [posGain])

# 0x01B - Set Vel Gains
velGain = cantools.database.can.Signal("Vel_Gain", 0, 32, is_float=True)
velIntGain = cantools.database.can.Signal("Vel_Integrator_Gain", 32, 32, is_float=True)
setVelGainsMsg = cantools.database.can.Message(0x01B, "Set_Vel_gains", 8, [velGain, velIntGain])

db = cantools.database.can.Database(
[
heartbeatMsg,
Expand All @@ -170,6 +179,8 @@
getVbusVMsg,
clearErrorsMsg,
setLinearCountMsg,
setPosGainMsg,
setVelGainsMsg
]
)

Expand Down
10 changes: 10 additions & 0 deletions tools/odrive-cansimple.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ BO_ 24 Clear_Errors: 0 Vector__XXX
BO_ 25 Set_Linear_Count: 8 Vector__XXX
SG_ Position : 0|32@1- (1,0) [0|0] "" Vector__XXX

BO_ 26 Set_Pos_Gain: 8 Vector__XXX
SG_ Pos_Gain : 0|32@1+ (1,0) [0|0] "" Vector__XXX

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




Expand All @@ -140,5 +147,8 @@ SIG_VALTYPE_ 20 Iq_Measured : 1;
SIG_VALTYPE_ 21 Sensorless_Pos_Estimate : 1;
SIG_VALTYPE_ 21 Sensorless_Vel_Estimate : 1;
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;


0 comments on commit e0aaa04

Please sign in to comment.