You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/02/18 08:35:53 UTC

[GitHub] [incubator-nuttx-apps] raiden00pl commented on a change in pull request #1001: industry/foc: add support for angle from sensorless observer

raiden00pl commented on a change in pull request #1001:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1001#discussion_r809766523



##########
File path: include/industry/foc/float/foc_angle.h
##########
@@ -136,6 +150,12 @@ struct foc_hall_cfg_f32_s
 extern struct foc_angle_ops_f32_s g_foc_angle_ol_f32;
 #endif
 
+#ifdef CONFIG_INDUSTRY_FOC_ANGLE_OBSERVER
+/* oberver angle operations (float) */
+
+extern struct foc_angle_ops_f32_s g_foc_angle_ob_f32;
+#endif
+

Review comment:
       ```suggestion
   #ifdef CONFIG_INDUSTRY_FOC_ANGLE_ONFO
   /* NFO oberver angle operations (float) */
   
   extern struct foc_angle_ops_f32_s g_foc_angle_onfo_f32;
   #endif
   
   #ifdef CONFIG_INDUSTRY_FOC_ANGLE_OSMO
   /* SMO oberver angle operations (float) */
   
   extern struct foc_angle_ops_f32_s g_foc_angle_osmo_f32;
   #endif
   ```

##########
File path: industry/foc/Makefile
##########
@@ -36,6 +36,9 @@ CSRCS += float/foc_routine.c
 ifeq ($(CONFIG_INDUSTRY_FOC_ANGLE_OPENLOOP),y)
 CSRCS += float/foc_ang_openloop.c
 endif
+ifeq ($(CONFIG_INDUSTRY_FOC_ANGLE_OBSERVER),y)
+CSRCS += float/foc_ang_observer.c
+endif

Review comment:
       
   ```suggestion
   ifeq ($(CONFIG_INDUSTRY_FOC_ANGLE_ONFO),y)
   CSRCS += float/foc_ang_onfo.c
   endif
   ifeq ($(CONFIG_INDUSTRY_FOC_ANGLE_OSMO),y)
   CSRCS += float/foc_ang_osmo.c
   endif
   ```

##########
File path: industry/foc/Kconfig
##########
@@ -58,6 +58,27 @@ config INDUSTRY_FOC_ANGLE_OPENLOOP
 	---help---
 		Enable support for open-loop angle handler
 
+config INDUSTRY_FOC_ANGLE_OBSERVER
+	bool "FOC angle observer handler"
+	default n
+	---help---
+		Enable support for observer angle handler
+
+if INDUSTRY_FOC_ANGLE_OBSERVER
+
+choice
+	prompt "FOC observer type selection"
+
+config INDUSTRY_FOC_OBSERVER_SLID
+	bool "Enable slidmode observer"
+
+config INDUSTRY_FOC_OBSERVER_FLUX
+	bool "Enable fluxlink observer"
+
+endchoice # FOC observer type selection
+
+endif # INDUSTRY_FOC_ANGLE_OBSERVER
+

Review comment:
       Let's make this like for vel observers:
   ```suggestion
   config INDUSTRY_FOC_ANGLE_OSMO
   	bool "Enable slidmode observer"
   	default n
   
   config INDUSTRY_FOC_ANGLE_ONFO
   	bool "Enable fluxlink observer"
           default n
   ```

##########
File path: include/industry/foc/float/foc_angle.h
##########
@@ -106,6 +106,20 @@ struct foc_openloop_cfg_f32_s
 };
 #endif  /* CONFIG_INDUSTRY_FOC_ANGLE_OPENLOOP */
 
+#ifdef CONFIG_INDUSTRY_FOC_ANGLE_OBSERVER
+struct foc_observer_cfg_f32_s
+{
+  float per;            /* Controller period */
+  float k_slide;        /* Bang-bang controller gain */
+  float err_max;        /* Linear mode threshold */
+
+  float gain;
+  float gain_slow;
+
+  struct motor_phy_params_f32_s phy;
+};
+#endif
+

Review comment:
       ```suggestion
   #ifdef CONFIG_INDUSTRY_FOC_ANGLE_ONFO
   struct foc_angle_onfo_cfg_f32_s
   {
     float per;            /* Controller period */
     float gain;
     float gain_slow;
     struct motor_phy_params_f32_s phy;
   };
   #endif
   
   #ifdef CONFIG_INDUSTRY_FOC_ANGLE_OSMO
   struct foc_angle_osmo_cfg_f32_s
   {
     float per;            /* Controller period */
     float k_slide;        /* Bang-bang controller gain */
     float err_max;        /* Linear mode threshold */
     struct motor_phy_params_f32_s phy;
   };
   #endif
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org