examples/foc: get velocity from observer if sensored mode

This commit is contained in:
raiden00pl 2023-11-08 18:42:33 +01:00 committed by Petro Karashchenko
parent c5314b54a4
commit eeacbdde3a
2 changed files with 10 additions and 2 deletions

@ -1230,7 +1230,7 @@ static int foc_motor_vel_get(FAR struct foc_motor_b16_s *motor)
UNUSED(vout);
motor->vel_el = motor->vel.set;
#elif defined(CONFIG_EXAMPLES_FOC_VELOBS)
#elif defined(CONFIG_EXAMPLES_FOC_VELOBS) && defined(CONFIG_EXAMPLES_FOC_SENSORLESS)
if (motor->openloop_now == FOC_OPENLOOP_DISABLED)
{
/* Get electrical velocity from observer if we are in closed-loop */
@ -1243,6 +1243,10 @@ static int foc_motor_vel_get(FAR struct foc_motor_b16_s *motor)
motor->vel_el = motor->vel.set;
}
#elif defined(CONFIG_EXAMPLES_FOC_VELOBS) && defined(CONFIG_EXAMPLES_FOC_SENSORED)
/* Get electrical velocity from observer in sensored mode */
motor->vel_el = motor->vel_obs;
#else
/* Need electrical velocity source here - raise assertion */

@ -1217,7 +1217,7 @@ static int foc_motor_vel_get(FAR struct foc_motor_f32_s *motor)
UNUSED(vout);
motor->vel_el = motor->vel.set;
#elif defined(CONFIG_EXAMPLES_FOC_VELOBS)
#elif defined(CONFIG_EXAMPLES_FOC_VELOBS) && defined(CONFIG_EXAMPLES_FOC_SENSORLESS)
if (motor->openloop_now == FOC_OPENLOOP_DISABLED)
{
/* Get electrical velocity from observer if we are in closed-loop */
@ -1230,6 +1230,10 @@ static int foc_motor_vel_get(FAR struct foc_motor_f32_s *motor)
motor->vel_el = motor->vel.set;
}
#elif defined(CONFIG_EXAMPLES_FOC_VELOBS) && defined(CONFIG_EXAMPLES_FOC_SENSORED)
/* Get electrical velocity from observer in sensored mode */
motor->vel_el = motor->vel_obs;
#else
/* Need electrical velocity source here - raise assertion */