raiden00pl commented on PR #10902:
URL: https://github.com/apache/nuttx/pull/10902#issuecomment-1761171634

   > I understand the idea but I feel that it became a kind of god object anti 
pattern...
   The whole motor interface works with a different mindset like start and 
stop. Moreover, what if one need to control a stepper and a bldc? Both 
interface will be mixed in the code no?
   
   If you want control stepper motor with PWM peripheral, for example to use 
`CONFIG_PWM_PULSECOUNT` functionality then you need start and stop. In your 
case you are directly controlling the GPIO, but the same can be achieved with 
PWM if your chip can precisely generate pulses or you just want to control the 
motor shaft speed.
   
   When you have different types of motors to control, then the motor 
'lower-half' logic can just ignore parameters that are not needed (e.g. stepper 
motor in step mode doesn't care about 'float position;'). This probably 
requires some modifications to the "upper-half" motor driver, but the interface 
itself will not be a problem here.
   
   You say it's mixing interfaces and anti pattern, I say it's creating a 
generic motor solution. Depends on how you look at the problem :)
   
   > About your last point, if one want to control a stepper as a motor, it 
have to implement a specific control in the motor interface and not in the 
stepper one (to match this mindset). I'm pretty sure that it is NOT possible to 
implement FOC control for stepper with a stepper driver like the A4988.
   
   Correct, FOC is definitely not possible with A4988, my comment was more 
about the fact that a stepper motor doesn't necessarily have to be controlled 
in 'steps' unit. Someone may even prefer control stepper with `float position;` 
where the motor shaft movement is in radian.
   


-- 
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-unsubscr...@nuttx.apache.org

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

Reply via email to