I am making a same pendulum as the simple foc examples:
but there is something wrong with my pendulum when i testing it.
i used 2 as5600 to replace the encoder, and both of them used I2C port. and to keep the weight as close as possible to the example, i fixed 2 batterys on the wheel(it costs too much time if set infill 70% with 3d printer)…
when i run the motor, the pendulum always run over the stable position, and seems never goona stop circuling… below is my test video.
if i grab the arm of pendulum, and try different angle of the pendulum, i can found that the steady postion is not the 90 degree standing position, but about 45 degree away from the stand.
i was wondering if it has any connection with as5600’s absolut position ? the controller take the absolute positon as the beginning postion?
By the way, anybody can share that if my wheel’s weight is different from example, how to change the the target_voltage to adapt to the weight?
and each time you read the pendulum angle you subtract the zero_offset. Just make sure to keep the pendulum facing down on the beginning.
I don’t remember the weight any more but it should be more or less as yours with batteries. you can tweak this 0.4 number to get better performance. There are also other algorithms to do this more optimally, this one is really simple.
I would suggest you to stabilize the pendulum fist and make sure it works and then to try to tweak the swing-up parameters.
And also, try fix the pendulum a bit more sturdy for now until you have good results.