From 292b0cbc2839e8baf2e7df8ad718d1ff20fe9268 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Sun, 15 Oct 2023 16:34:21 +0200 Subject: [PATCH] examples/foc: change the velocity ramp parameters scale to x1 controlling the ramp with greather accuracy makes no practical sense --- examples/foc/Kconfig | 6 +++--- examples/foc/foc_cfg.h | 6 +++--- examples/foc/foc_motor_b16.c | 4 ++-- examples/foc/foc_motor_f32.c | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/foc/Kconfig b/examples/foc/Kconfig index f48d53db3..517c304bb 100644 --- a/examples/foc/Kconfig +++ b/examples/foc/Kconfig @@ -568,15 +568,15 @@ config EXAMPLES_FOC_IDQ_KI endif #EXAMPLES_FOC_CONTROL_PI config EXAMPLES_FOC_RAMP_THR - int "FOC velocity ramp threshold [x1000]" + int "FOC velocity ramp threshold [x1]" default 0 config EXAMPLES_FOC_RAMP_ACC - int "FOC velocity ramp acc [x1000]" + int "FOC velocity ramp acc [x1]" default 0 config EXAMPLES_FOC_RAMP_DEC - int "FOC velocity ramp dec [x1000]" + int "FOC velocity ramp dec [x1]" default 0 config EXAMPLES_FOC_HAVE_ALIGN diff --git a/examples/foc/foc_cfg.h b/examples/foc/foc_cfg.h index b8b0bad24..d2e8632cb 100644 --- a/examples/foc/foc_cfg.h +++ b/examples/foc/foc_cfg.h @@ -116,7 +116,7 @@ /* Velocity ramp configuration */ -#define RAMP_CFG_THR (CONFIG_EXAMPLES_FOC_RAMP_THR / 1000.0f) +#define RAMP_CFG_THR (CONFIG_EXAMPLES_FOC_RAMP_THR / 1.0f) #ifdef CONFIG_EXAMPLES_FOC_STATE_USE_MODEL_PMSM @@ -237,8 +237,8 @@ struct foc_thr_cfg_s #endif #ifdef CONFIG_EXAMPLES_FOC_HAVE_VEL uint32_t velmax; /* Velocity max (x1000) */ - uint32_t acc; /* Acceleration (x1000) */ - uint32_t dec; /* Deceleration (x1000) */ + uint32_t acc; /* Acceleration (x1) */ + uint32_t dec; /* Deceleration (x1) */ #endif #ifdef CONFIG_EXAMPLES_FOC_HAVE_POS uint32_t posmax; /* Position max (x1000) */ diff --git a/examples/foc/foc_motor_b16.c b/examples/foc/foc_motor_b16.c index 06e79555f..64f26240c 100644 --- a/examples/foc/foc_motor_b16.c +++ b/examples/foc/foc_motor_b16.c @@ -307,8 +307,8 @@ static int foc_motor_configure(FAR struct foc_motor_b16_s *motor) ret = foc_ramp_init_b16(&motor->ramp, motor->per, ftob16(RAMP_CFG_THR), - ftob16((motor->envp->cfg->acc / 1000.0f)), - ftob16((motor->envp->cfg->dec / 1000.0f))); + ftob16((motor->envp->cfg->acc / 1.0f)), + ftob16((motor->envp->cfg->dec / 1.0f))); if (ret < 0) { PRINTF("ERROR: foc_ramp_init failed %d\n", ret); diff --git a/examples/foc/foc_motor_f32.c b/examples/foc/foc_motor_f32.c index 795b5e82c..95026e9d7 100644 --- a/examples/foc/foc_motor_f32.c +++ b/examples/foc/foc_motor_f32.c @@ -307,8 +307,8 @@ static int foc_motor_configure(FAR struct foc_motor_f32_s *motor) ret = foc_ramp_init_f32(&motor->ramp, motor->per, RAMP_CFG_THR, - (motor->envp->cfg->acc / 1000.0f), - (motor->envp->cfg->dec / 1000.0f)); + (motor->envp->cfg->acc / 1.0f), + (motor->envp->cfg->dec / 1.0f)); if (ret < 0) { PRINTF("ERROR: foc_ramp_init failed %d\n", ret);