Skip to content

Commit

Permalink
mOhms and uHenries
Browse files Browse the repository at this point in the history
  • Loading branch information
dzid26 committed Dec 1, 2023
1 parent d14105d commit 6014ca4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
7 changes: 3 additions & 4 deletions firmware/src/BSP/actuator_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@ float volatile current_to_actuatorTq;
const uint16_t rated_current = 1300; //mA
const uint16_t rated_torque = 45; //cNm

const uint16_t phase_R = 3; //ohm
const uint16_t phase_L = 3; //Henry
const uint16_t motor_k_bemf = 1765; // mV/(rev/s)

const uint16_t phase_R = 3000; // mOhm
const uint16_t phase_L = 3000; // uH
const uint16_t motor_k_bemf = 2965; // mV/(rev/s)

// specify gearing parameters here:
const float motor_gearbox_ratio = 5.0F+(2.0F/11.0F); // gearbox ratio - enter planetary gearbox tooth calculation for best accuracy
Expand Down
6 changes: 4 additions & 2 deletions firmware/src/BSP/actuator_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@

extern const uint16_t rated_current; //mA
extern const uint16_t rated_torque; //cNm
extern const uint16_t phase_R; //ohm
extern const uint16_t phase_L; //Henry
extern const uint16_t phase_R; //mOhm
extern const uint16_t phase_L; //uH
extern const uint16_t motor_k_bemf; // mV/(rev/s)

#define Ohm_to_mOhm 1000U

//calculate actuator parameters to be used by control_api
extern volatile float gearing_ratio;
extern volatile float actuatorTq_to_current;
Expand Down
2 changes: 1 addition & 1 deletion firmware/src/BSP/stepper_controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ static void StepperCtrl_desired_current_vector(int16_t loadAngle, int16_t curren

if(volt_control){
int16_t i_q = current_target;
int32_t v_q = ((int32_t)i_q * (int32_t) phase_R) + ((int32_t)motor_k_bemf * speed_slow / (int32_t)ANGLE_STEPS);//todo vq?
int32_t v_q = ((int32_t)i_q * (int32_t)phase_R / (int32_t)Ohm_to_mOhm) + ((int32_t)motor_k_bemf * speed_slow / (int32_t)ANGLE_STEPS);//todo vq?
apply_volt_command(absoluteMicrosteps, v_q, magnitude);
}else{
apply_current_command(absoluteMicrosteps, magnitude);
Expand Down

0 comments on commit 6014ca4

Please sign in to comment.