examples/foc: change the velocity ramp parameters scale to x1

controlling the ramp with greather accuracy makes no practical sense
This commit is contained in:
raiden00pl 2023-10-15 16:34:21 +02:00 committed by Xiang Xiao
parent 8568439b80
commit 292b0cbc28
4 changed files with 10 additions and 10 deletions

View File

@ -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

View File

@ -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) */

View File

@ -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);

View File

@ -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);