Controlling torque and position

First of all, thanks for the awesome work !

Since many dynamic legged robot application require a true torque and position control, I wonder how or if this could be done with SimpleFOC.

If I understood it correctly, the torque control right now is implemented in a way where either torque or position can be the target setpoint.

Is it possible with SimpleFOC to have both, torque and position as a dynamics setpoint ?

Welcome @fish42

I think what you are asking for is position control with a torque limit, right?

I don’t think you can directly set a torque limit - but setting a current limit will lead similar results. There are a couple of other limits (velocity and ramp) which may mean you don’t reach the current limit during your angular movement.

Current sensing is still not widely supported - so many of us would use a voltage_limit as a rough way of limiting torque on boards without current sensing. Works pretty well at lower speeds.

thank you for your reply.

yes that will work, is SimpleFOC made in a way that we can update either current , velocity or ramp with the frequency of the FOC Loop ?

But im still confused how this will workout with the true Torque control using FOC Currents, since this is based on a given Current as a setpoint.

In the MIT Mini Cheetah Controller , they seem to determine the FOC Torque Setpoint like that :
Kpposition_error + Kdvelocity_error + feedforward_torque

last question, all examples with true torque control are based on Encoders, is there a specific reason for that or will it work with Magnetic Sensor in the same way ?

This one I feel I can answer: the magnetic sensor is absolute, the encoder is relative, but both serve the purpose of sensing the motor’s position. SimpleFOC’s implementation of the sensors means that after initialization of the motor, you can use them in the same way.

Yes, this is possible. Since there FOC-loop needs to execute very quickly, I think the move loop is sufficient for this, which can be a bit slower.