What is the best way to replace the position PID controller with a custom controller?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-05-14 03:42 PM
My company is looking to modernize our positioner electronics and have been prototyping with a NUCLEO-G431RB and an IHM07M1 in 3-shunt mode.
While the nested velocity + position PID strategy might work for our positioner given enough tuning, we have already developed a functionally equivalent position controller with well-tested performance for our existing positioner + electronics and would like to use it instead of the provided position PID.
I ported our controller over, instantiated it, added a pointer to it to PosCtrl_Handle_t, and am calling its update function instead of PID_Controller() to generate torque commands in TC_PositionRegulation(). I'm also bypassing most of the trajectory controller functionality since we don't really want/need it.
This works fine, but the issues are:
- TC_PositionRegulation() isn't declared weak, so it can't be overridden with our own implementation in a different file
- Inserting our own position controller requires modifying some core functions and data structures; these changes are overwritten any time the code is generated again from CubeMX
Is there a better/recommended way to do this?
- Labels:
-
STM32 Motor Control
-
STM32G4 series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2021-05-24 12:32 AM
Hi Edward. weak prefix point to Compiler that other fuction implementation with out WEAK must be compiled and linked to firmware, so juct make oun inplimentation of Pos controller.