Skip to content

Commit 6e856a8

Browse files
committed
Add current limit to the limits message
1 parent 274225c commit 6e856a8

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

Firmware/communication/can/can_simple.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ void CANSimple::do_command(Axis& axis, const can_Message_t& msg) {
108108
case MSG_SET_CONTROLLER_MODES:
109109
set_controller_modes_callback(axis, msg);
110110
break;
111-
case MSG_SET_VEL_LIMIT:
112-
set_vel_limit_callback(axis, msg);
111+
case MSG_SET_LIMITS:
112+
set_limits_callback(axis, msg);
113113
break;
114114
case MSG_START_ANTICOGGING:
115115
start_anticogging_callback(axis, msg);
@@ -263,8 +263,9 @@ void CANSimple::set_controller_modes_callback(Axis& axis, const can_Message_t& m
263263
axis.controller_.config_.input_mode = static_cast<Controller::InputMode>(can_getSignal<int32_t>(msg, 32, 32, true));
264264
}
265265

266-
void CANSimple::set_vel_limit_callback(Axis& axis, const can_Message_t& msg) {
266+
void CANSimple::set_limits_callback(Axis& axis, const can_Message_t& msg) {
267267
axis.controller_.config_.vel_limit = can_getSignal<float>(msg, 0, 32, true);
268+
axis.motor_.config_.current_lim = can_getSignal<float>(msg, 32, 32, true);
268269
}
269270

270271
void CANSimple::start_anticogging_callback(const Axis& axis, const can_Message_t& msg) {

Firmware/communication/can/can_simple.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class CANSimple {
2222
MSG_SET_INPUT_POS,
2323
MSG_SET_INPUT_VEL,
2424
MSG_SET_INPUT_TORQUE,
25-
MSG_SET_VEL_LIMIT,
25+
MSG_SET_LIMITS,
2626
MSG_START_ANTICOGGING,
2727
MSG_SET_TRAJ_VEL_LIMIT,
2828
MSG_SET_TRAJ_ACCEL_LIMITS,
@@ -68,7 +68,7 @@ class CANSimple {
6868
static void set_input_vel_callback(Axis& axis, const can_Message_t& msg);
6969
static void set_input_torque_callback(Axis& axis, const can_Message_t& msg);
7070
static void set_controller_modes_callback(Axis& axis, const can_Message_t& msg);
71-
static void set_vel_limit_callback(Axis& axis, const can_Message_t& msg);
71+
static void set_limits_callback(Axis& axis, const can_Message_t& msg);
7272
static void set_traj_vel_limit_callback(Axis& axis, const can_Message_t& msg);
7373
static void set_traj_accel_limits_callback(Axis& axis, const can_Message_t& msg);
7474
static void set_traj_inertia_callback(Axis& axis, const can_Message_t& msg);

docs/can-protocol.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ CMD ID | Name | Sender | Signals | Start byte | Signal Type | Bits | Factor | Of
5050
0x00C | Set Input Pos | Master | Input Pos<br>Vel FF<br>Torque FF | 0<br>4<br>6 | IEEE 754 Float<br>Signed Int<br>Signed Int | 32<br>16<br>16 | 1<br>0.001<br>0.001 | 0<br>0<br>0 | Intel<br>Intel<br>Intel
5151
0x00D | Set Input Vel | Master | Input Vel<br>Torque FF | 0<br>4 | IEEE 754 Float<br>IEEE 754 Float | 32<br>32 | 1<br>1 | 0<br>0 | Intel<br>Intel
5252
0x00E | Set Input Torque | Master | Input Torque | 0 | IEEE 754 Float | 32 | 1 | 0 | Intel
53-
0x00F | Set Velocity Limit | Master | Velocity Limit | 0 | IEEE 754 Float | 32 | 1 | 0 | Intel
53+
0x00F | Set Limits | Master | Velocity Limit<br>Current Limit | 0<br>4 | IEEE 754 Float<br>IEEE 754 Float | 32<br> | 1<br>1 | 0<br>0 | Intel
5454
0x010 | Start Anticogging | Master | - | - | - | - | - | - | -
5555
0x011 | Set Traj Vel Limit | Master | Traj Vel Limit | 0 | IEEE 754 Float | 32 | 1 | 0 | Intel
5656
0x012 | Set Traj Accel Limits | Master | Traj Accel Limit<br>Traj Decel Limit | 0<br>4 | IEEE 754 Float<br>IEEE 754 Float | 32<br>32 | 1<br>1 | 0<br>0 | Intel<br>Intel

0 commit comments

Comments
 (0)