diff --git a/Firmware/communication/can/can_simple.cpp b/Firmware/communication/can/can_simple.cpp index 348afa6cd..fce871494 100644 --- a/Firmware/communication/can/can_simple.cpp +++ b/Firmware/communication/can/can_simple.cpp @@ -108,8 +108,8 @@ void CANSimple::do_command(Axis& axis, const can_Message_t& msg) { case MSG_SET_CONTROLLER_MODES: set_controller_modes_callback(axis, msg); break; - case MSG_SET_VEL_LIMIT: - set_vel_limit_callback(axis, msg); + case MSG_SET_LIMITS: + set_limits_callback(axis, msg); break; case MSG_START_ANTICOGGING: start_anticogging_callback(axis, msg); @@ -263,8 +263,9 @@ void CANSimple::set_controller_modes_callback(Axis& axis, const can_Message_t& m axis.controller_.config_.input_mode = static_cast(can_getSignal(msg, 32, 32, true)); } -void CANSimple::set_vel_limit_callback(Axis& axis, const can_Message_t& msg) { +void CANSimple::set_limits_callback(Axis& axis, const can_Message_t& msg) { axis.controller_.config_.vel_limit = can_getSignal(msg, 0, 32, true); + axis.motor_.config_.current_lim = can_getSignal(msg, 32, 32, true); } void CANSimple::start_anticogging_callback(const Axis& axis, const can_Message_t& msg) { diff --git a/Firmware/communication/can/can_simple.hpp b/Firmware/communication/can/can_simple.hpp index f2c2ebdf4..9c6ac96ce 100644 --- a/Firmware/communication/can/can_simple.hpp +++ b/Firmware/communication/can/can_simple.hpp @@ -22,7 +22,7 @@ class CANSimple { MSG_SET_INPUT_POS, MSG_SET_INPUT_VEL, MSG_SET_INPUT_TORQUE, - MSG_SET_VEL_LIMIT, + MSG_SET_LIMITS, MSG_START_ANTICOGGING, MSG_SET_TRAJ_VEL_LIMIT, MSG_SET_TRAJ_ACCEL_LIMITS, @@ -68,7 +68,7 @@ class CANSimple { static void set_input_vel_callback(Axis& axis, const can_Message_t& msg); static void set_input_torque_callback(Axis& axis, const can_Message_t& msg); static void set_controller_modes_callback(Axis& axis, const can_Message_t& msg); - static void set_vel_limit_callback(Axis& axis, const can_Message_t& msg); + static void set_limits_callback(Axis& axis, const can_Message_t& msg); static void set_traj_vel_limit_callback(Axis& axis, const can_Message_t& msg); static void set_traj_accel_limits_callback(Axis& axis, const can_Message_t& msg); static void set_traj_inertia_callback(Axis& axis, const can_Message_t& msg); diff --git a/docs/can-protocol.md b/docs/can-protocol.md index e90602774..36afa50af 100644 --- a/docs/can-protocol.md +++ b/docs/can-protocol.md @@ -50,7 +50,7 @@ CMD ID | Name | Sender | Signals | Start byte | Signal Type | Bits | Factor | Of 0x00C | Set Input Pos | Master | Input Pos
Vel FF
Torque FF | 0
4
6 | IEEE 754 Float
Signed Int
Signed Int | 32
16
16 | 1
0.001
0.001 | 0
0
0 | Intel
Intel
Intel 0x00D | Set Input Vel | Master | Input Vel
Torque FF | 0
4 | IEEE 754 Float
IEEE 754 Float | 32
32 | 1
1 | 0
0 | Intel
Intel 0x00E | Set Input Torque | Master | Input Torque | 0 | IEEE 754 Float | 32 | 1 | 0 | Intel -0x00F | Set Velocity Limit | Master | Velocity Limit | 0 | IEEE 754 Float | 32 | 1 | 0 | Intel +0x00F | Set Limits | Master | Velocity Limit
Current Limit | 0
4 | IEEE 754 Float
IEEE 754 Float | 32
| 1
1 | 0
0 | Intel 0x010 | Start Anticogging | Master | - | - | - | - | - | - | - 0x011 | Set Traj Vel Limit | Master | Traj Vel Limit | 0 | IEEE 754 Float | 32 | 1 | 0 | Intel 0x012 | Set Traj Accel Limits | Master | Traj Accel Limit
Traj Decel Limit | 0
4 | IEEE 754 Float
IEEE 754 Float | 32
32 | 1
1 | 0
0 | Intel
Intel