the register of motor is 8ohm,current is 3A,so I change shunt registance to 20m ohm, and apply the patch as below, but I found a conflict between current_lim and vel_limit,
for example,
when I set vel_limit = 4000, current_lim = 5(motor type is 2,this mean 5V), motor only get 1V
when I set vel_limit = 80000, current_lim = 5(motor type is 2,this mean 5V), motor can get 5V
I want to know the relationship of vel_limit and current_lim?
diff --git a/Firmware/MotorControl/board_config_v3.h b/Firmware/MotorControl/board_config_v3.h
index 58a8b3e..03d7c09 100644
--- a/Firmware/MotorControl/board_config_v3.h
+++ b/Firmware/MotorControl/board_config_v3.h
@@ -15,7 +15,7 @@
#if HW_VERSION_MINOR <= 3
#define SHUNT_RESISTANCE (675e-6f)
#else
-#define SHUNT_RESISTANCE (500e-6f)
+#define SHUNT_RESISTANCE (20e-3f)
#endif
#endif
diff --git a/Firmware/MotorControl/controller.hpp b/Firmware/MotorControl/controller.hpp
index 7ffa25b..626275b 100644
--- a/Firmware/MotorControl/controller.hpp
+++ b/Firmware/MotorControl/controller.hpp
@@ -25,9 +25,9 @@ public:
struct Config_t {
ControlMode_t control_mode = CTRL_MODE_POSITION_CONTROL; //see: Motor_control_mode_t
float pos_gain = 20.0f; // [(counts/s) / counts]
- float vel_gain = 5.0f / 10000.0f; // [A/(counts/s)]
+ float vel_gain = 1.0f / 10000.0f; // [A/(counts/s)]
// float vel_gain = 5.0f / 200.0f, // [A/(rad/s)] <sensorless example>
- float vel_integrator_gain = 10.0f / 10000.0f; // [A/(counts/s * s)]
+ float vel_integrator_gain = 0.0f / 10000.0f; // [A/(counts/s * s)]
float vel_limit = 20000.0f; // [counts/s]
float vel_limit_tolerance = 1.2f; // ratio to vel_lim. 0.0f to disable
float vel_ramp_rate = 10000.0f; // [(counts/s) / s]
diff --git a/Firmware/MotorControl/motor.hpp b/Firmware/MotorControl/motor.hpp
index 9742835..1796490 100644
--- a/Firmware/MotorControl/motor.hpp
+++ b/Firmware/MotorControl/motor.hpp
@@ -59,15 +59,15 @@ public:
struct Config_t {
bool pre_calibrated = false; // can be set to true to indicate that all values here are valid
int32_t pole_pairs = 7;
- float calibration_current = 10.0f; // [A]
- float resistance_calib_max_voltage = 2.0f; // [V] - You may need to increase this if this voltage isn't sufficient to drive calibration_current through the motor.
+ float calibration_current = 0.5f; // [A]
+ float resistance_calib_max_voltage = 5.0f; // [V] - You may need to increase this if this voltage isn't sufficient to drive calibration_current through the motor.
float phase_inductance = 0.0f; // to be set by measure_phase_inductance
float phase_resistance = 0.0f; // to be set by measure_phase_resistance
int32_t direction = 1; // 1 or -1
MotorType_t motor_type = MOTOR_TYPE_HIGH_CURRENT;
// Read out max_allowed_current to see max supported value for current_lim.
// float current_lim = 70.0f; //[A]
- float current_lim = 10.0f; //[A]
+ float current_lim = 0.6f; //[A]
// Value used to compute shunt amplifier gains
float requested_current_range = 60.0f; // [A]
float current_control_bandwidth = 1000.0f; // [rad/s]