mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-10 23:15:18 +00:00
industry/foc: make direction alignment configurable
for sensorless velocity controller (ESC) we don't need to align the direction, but we have to align the initial motor phase each time the motor start
This commit is contained in:
parent
768d5b29f1
commit
8ee684e586
5 changed files with 22 additions and 0 deletions
|
|
@ -118,7 +118,9 @@ static int foc_motor_align(FAR struct foc_motor_b16_s *motor, FAR bool *done)
|
|||
}
|
||||
|
||||
PRINTF("Aling results:\n");
|
||||
#ifdef CONFIG_INDUSTRY_FOC_ALIGN_DIR
|
||||
PRINTF(" dir = %.2f\n", b16tof(final.dir));
|
||||
#endif
|
||||
PRINTF(" offset = %.2f\n", b16tof(final.offset));
|
||||
|
||||
*done = true;
|
||||
|
|
|
|||
|
|
@ -118,7 +118,9 @@ static int foc_motor_align(FAR struct foc_motor_f32_s *motor, FAR bool *done)
|
|||
}
|
||||
|
||||
PRINTF("Aling results:\n");
|
||||
#ifdef CONFIG_INDUSTRY_FOC_ALIGN_DIR
|
||||
PRINTF(" dir = %.2f\n", final.dir);
|
||||
#endif
|
||||
PRINTF(" offset = %.2f\n", final.offset);
|
||||
|
||||
*done = true;
|
||||
|
|
|
|||
|
|
@ -135,6 +135,12 @@ config INDUSTRY_FOC_ALIGN
|
|||
|
||||
if INDUSTRY_FOC_ALIGN
|
||||
|
||||
config INDUSTRY_FOC_ALIGN_DIR
|
||||
bool "FOC alignment direction support"
|
||||
default n
|
||||
---help---
|
||||
Enable support for sensor direction alignment
|
||||
|
||||
config INDUSTRY_FOC_ALIGN_INDEX
|
||||
bool "FOC alignment index search support"
|
||||
default n
|
||||
|
|
|
|||
|
|
@ -75,7 +75,9 @@ enum foc_align_run_stage_e
|
|||
FOC_ALIGN_RUN_INDEX,
|
||||
#endif
|
||||
FOC_ALIGN_RUN_OFFSET,
|
||||
#ifdef CONFIG_INDUSTRY_FOC_ALIGN_DIR
|
||||
FOC_ALIGN_RUN_DIR,
|
||||
#endif
|
||||
FOC_ALIGN_RUN_IDLE,
|
||||
FOC_ALIGN_RUN_DONE
|
||||
};
|
||||
|
|
@ -347,6 +349,7 @@ errout:
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_INDUSTRY_FOC_ALIGN_DIR
|
||||
/****************************************************************************
|
||||
* Name: foc_align_dir_move_b16
|
||||
****************************************************************************/
|
||||
|
|
@ -663,6 +666,7 @@ errout:
|
|||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: foc_align_idle_run_b16
|
||||
|
|
@ -910,6 +914,7 @@ int foc_routine_align_run_b16(FAR foc_routine_b16_t *r,
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_INDUSTRY_FOC_ALIGN_DIR
|
||||
case FOC_ALIGN_RUN_DIR:
|
||||
{
|
||||
/* Align direction procedure */
|
||||
|
|
@ -930,6 +935,7 @@ int foc_routine_align_run_b16(FAR foc_routine_b16_t *r,
|
|||
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
case FOC_ALIGN_RUN_IDLE:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -75,8 +75,10 @@ enum foc_align_run_stage_e
|
|||
FOC_ALIGN_RUN_INDEX,
|
||||
#endif
|
||||
FOC_ALIGN_RUN_OFFSET,
|
||||
#ifdef CONFIG_INDUSTRY_FOC_ALIGN_DIR
|
||||
FOC_ALIGN_RUN_DIR,
|
||||
FOC_ALIGN_RUN_IDLE,
|
||||
#endif
|
||||
FOC_ALIGN_RUN_DONE
|
||||
};
|
||||
|
||||
|
|
@ -347,6 +349,7 @@ errout:
|
|||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_INDUSTRY_FOC_ALIGN_DIR
|
||||
/****************************************************************************
|
||||
* Name: foc_align_dir_move_f32
|
||||
****************************************************************************/
|
||||
|
|
@ -709,6 +712,7 @@ static int foc_align_idle_run_f32(FAR struct foc_align_f32_s *align,
|
|||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: foc_routine_align_init_f32
|
||||
|
|
@ -910,6 +914,7 @@ int foc_routine_align_run_f32(FAR foc_routine_f32_t *r,
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_INDUSTRY_FOC_ALIGN_DIR
|
||||
case FOC_ALIGN_RUN_DIR:
|
||||
{
|
||||
/* Align direction procedure */
|
||||
|
|
@ -951,6 +956,7 @@ int foc_routine_align_run_f32(FAR foc_routine_f32_t *r,
|
|||
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
case FOC_ALIGN_RUN_DONE:
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue