Open petertumfart opened 1 year ago
Hello, was the reference search implemented for module 6214?
Hi. There is no TMCL command that triggers some kind of homing routine (reference search). Something like this only exists for the CANopen firmware variant. With the TMCL firmware the host system must command such a procedure. Alternatively one could implement a homing routine with a TMCL script.
Sorry, this was not correct, the TMCM-6214 does implement the RFS command.
Hi you have to call it via the interface, not via the motor (which was kind of unintuitive to me).
interface.reference_search(0, axis_nr)
starts the reference search
interface.reference_search(1, axis_nr)
stops the reference search
interface.reference_search(2, axis_nr)
returns the status
motor[i].set_axis_parameter(motor.AP.ReferenceSearchMode, val)
Sets the homing mode
Right, this is not very nice.
This is how it would look like in a minimal script:
from pytrinamic.connections import ConnectionManager
from pytrinamic.modules import TMCM6214
connectionManager = ConnectionManager("--interface kvaser_tmcl")
with connectionManager.connect() as myInterface:
module = TMCM6214(myInterface)
for i, motor in enumerate(module.motors):
motor.set_axis_parameter(motor.AP.ReferenceSearchMode, 2) # Search right stop switch, then search left stop switch.
module.interface.reference_search(0, i) # Start reference search
We could add a per motor function like with the TMCM-3110: TMCM3110.py#L42, to make it look better.
Thank you both for the support. It would be great to have it implemented as a per motor function.
Hi, there is no command for the reference search implemented for module 6214.