Skip to content

[BUG] absoluteZeroSearch not moving the motor to seek for the encoder zero #518

@F00LM1N4

Description

@F00LM1N4

This is a simplified template, feel free to change it if it does not fit your case.

Describe the bug
I have configured the encoder as an ABI with Zero index feature.
During the initFOC() function the motor should try to find the zero index position in open-loop mode,
but it doesn't move so it will never find it. See the logs:

MOT:Monitor enabled!
MOT:Init
MOT:Enable driver.
MOT:Align sensor.
MOT:Index search...
ERR-MOT:Not found!
ERR-MOT:Init FOC fail

If I am quick enough and move the motor shaft manually when i see MOT:Index search... then the motor registers the zero position and goes on. See logs:

MOT:Monitor enabled! 
MOT:Init 
MOT:Enable driver. 
MOT:Align sensor. 
MOT:Index search... 
MOT:Success! 
MOT:sensor dir: CCW

That got me curious and reading the absoluteZeroSearch function it seems that the while loop that should
search for the zero position on the encoder only calls angleOpenloop(1.5f*_2PI); which to me seems to
only setup some variables to prepare for a movement doesn't actually perform one.

I tried blindly mimicking what's done inside the move() function in the case when the MotionControlType corresponds to angle_openloop then calling loopFOC all insid the while loop of absoluteZeroSearch,
but all I got was a vibrating motor not a movement.

I'm just starting to investigate this project so I'm sorry if this is not a bug but just me being a noob.

Describe the hardware setup
For us it is very important to know what is the hardware setup you're using in order to be able to help more directly

  • Which motor: No name 1000KV motor
  • Which driver: B-G431B-ESC1
  • Which microcontroller: STM32G431CB
  • Which position sensor: generic ABI encoder
  • Current sensing used? NO

IDE you are using

  • Platformio

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions