Skip to content

Commit

Permalink
Sten updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven authored and Sven committed May 6, 2014
1 parent 99fca89 commit e605570
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion applications/app_sten.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "stm32f4xx_conf.h"
#include "servo_dec.h"
#include "mcpwm.h"
#include "utils.h"
#include <math.h>

// Threads
Expand Down Expand Up @@ -175,8 +176,9 @@ static msg_t sten_thread(void *arg) {
}

// Use duty cycle control when running slowly, otherwise use current control.
if (fabsf(mcpwm_get_rpm()) < 2500 && fabsf(servo_val) > MCPWM_MIN_DUTY_CYCLE) {
if (fabsf(mcpwm_get_rpm()) < 4500 && fabsf(servo_val) > MCPWM_MIN_DUTY_CYCLE) {
if (servo_val > 0.0) {
utils_truncate_number(&servo_val, 0.1, 0.3);
mcpwm_set_duty(servo_val);
} else {
mcpwm_set_duty(0.0);
Expand Down
3 changes: 2 additions & 1 deletion conf_general.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
/*
* Select only one motor configuration
*/
#define MCCONF_OUTRUNNER1
//#define MCCONF_OUTRUNNER1
#define MCCONF_OUTRUNNER2
//#define MCCONF_RCCAR1
//#define MCCONF_STEN

Expand Down
8 changes: 4 additions & 4 deletions mcconf/mcconf_sten.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
/*
* Parameters
*/
#define MCPWM_CURRENT_MAX 60.0 // Current limit in Amperes (Upper)
#define MCPWM_CURRENT_MIN -60.0 // Current limit in Amperes (Lower)
#define MCPWM_CURRENT_MAX 40.0 // Current limit in Amperes (Upper)
#define MCPWM_CURRENT_MIN -40.0 // Current limit in Amperes (Lower)
#define MCPWM_IN_CURRENT_MAX 25.0 // Input current limit in Amperes (Upper)
#define MCPWM_IN_CURRENT_MIN -25.0 // Input current limit in Amperes (Lower)
#define MCPWM_RPM_MAX 29000.0 // The motor speed limit (Upper)
Expand All @@ -39,7 +39,7 @@

// Sensorless settings
#define MCPWM_IS_SENSORLESS 1 // Use sensorless commutation
#define MCPWM_MIN_RPM 250 // Auto-commutate below this RPM
#define MCPWM_MIN_RPM 300 // Auto-commutate below this RPM
#define MCPWM_CYCLE_INT_LIMIT_LOW 250.0 // Flux integrator limit 0 ERPM
#define MCPWM_CYCLE_INT_LIMIT_HIGH 30.0 // Flux integrator limit 50K ERPM

Expand All @@ -50,7 +50,7 @@
#define MCPWM_PID_MIN_RPM 1200.0 // Minimum allowed RPM

// Current control parameters
#define MCPWM_CURRENT_CONTROL_GAIN 0.0002 // Current controller error gain
#define MCPWM_CURRENT_CONTROL_GAIN 0.0016 // Current controller error gain
#define MCPWM_CURRENT_CONTROL_MIN 1.0 // Minimum allowed current

#endif /* MCCONF_STEN_H_ */

0 comments on commit e605570

Please sign in to comment.