Homing with absolute encoders

  • PKM
  • PKM's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
09 May 2021 14:18 - 09 May 2021 17:12 #208374 by PKM
Homing with absolute encoders was created by PKM
Hello!
I am building a machine with absolute encoders.
So I would like to understand the homing.
linuxcnc.org/docs/html/config/ini-homing...ome_absolute_encoder says:

When a request is made to home the joint, the current joint position is set to the [JOINT_n]HOME_OFFSET value.

Say, I run the machine, encoder positions are read from the drives and passed to joint.N.motor-pos-fb
But why set the current position to [JOINT_n]HOME_OFFSET while it's reasonable to add some pre-defined offset to the motor position instead?
I.e., how is it different from an incremental encoder?
Last edit: 09 May 2021 17:12 by PKM.

Please Log in or Create an account to join the conversation.

  • andypugh
  • andypugh's Avatar
  • Away
  • Moderator
  • Moderator
More
10 May 2021 22:48 #208504 by andypugh
Replied by andypugh on topic Homing with absolute encoders
I don't think that is actually what happens. ie, I suspect that the documentation is wrong.

I don't have actual absolute encoders, but I do have HOME_ABSOLUTE_ENCODER set because there is a way to fake it with single-turn absolute and the position.txt file.

And, what happens, is that the axis position becomes the encoder output position.

Please Log in or Create an account to join the conversation.

  • PKM
  • PKM's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
23 May 2021 16:16 - 23 May 2021 17:30 #209920 by PKM
Replied by PKM on topic Homing with absolute encoders
I have some troubles with this setting.
Either it doesn't work as supposed or I don't understand something.
I tested at the machine with actual absolute encoders, but it works the same in sim.
Say, edit a [JOINT_0] section in axis_mm config like this
HOME = 10.00
HOME_OFFSET = 10.00
HOME_ABSOLUTE_ENCODER = 2
Then start the machine, home, close the machine. Repeat a few times. Note the axes values. Correspondingly joint.0.motor-offset is decreasing by 10 each time, why?
Last edit: 23 May 2021 17:30 by PKM.

Please Log in or Create an account to join the conversation.

  • andypugh
  • andypugh's Avatar
  • Away
  • Moderator
  • Moderator
More
23 May 2021 19:54 #209947 by andypugh
Replied by andypugh on topic Homing with absolute encoders
I think that HOME_OFFSET needs to be zero.

Please Log in or Create an account to join the conversation.

  • PKM
  • PKM's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
25 May 2021 10:23 #210211 by PKM
Replied by PKM on topic Homing with absolute encoders
Not working well either.
Each start of the machine (even doing nothing at all) the joint 0 position gets increased by joint.0.motor-pos-fb value.

Please Log in or Create an account to join the conversation.

  • andypugh
  • andypugh's Avatar
  • Away
  • Moderator
  • Moderator
More
25 May 2021 11:02 #210214 by andypugh
Replied by andypugh on topic Homing with absolute encoders
github.com/LinuxCNC/linuxcnc/blob/master...motion/homing.c#L649

Goes straight to
github.com/LinuxCNC/linuxcnc/blob/master...motion/homing.c#L988

Which looks like (with an offset of zero) it should be doing the right thing.

github.com/LinuxCNC/linuxcnc/blob/2e75b0...otion/control.c#L376

Is where joint->pos_fb is updated. I haven't found anywhere in the code that joint->motor_offset is given a non-zero value. There is a command, but as far as I can see it is never called.

github.com/LinuxCNC/linuxcnc/blob/2e75b0...ask/taskintf.cc#L208

Please Log in or Create an account to join the conversation.

  • PKM
  • PKM's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
25 May 2021 13:35 - 25 May 2021 13:35 #210223 by PKM
Replied by PKM on topic Homing with absolute encoders
This looks like a suspect

github.com/LinuxCNC/linuxcnc/blob/2e58fb...motion/homing.c#L997

I compiled from source, so I can try to change something...
Last edit: 25 May 2021 13:35 by PKM.

Please Log in or Create an account to join the conversation.

  • PKM
  • PKM's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
25 May 2021 13:57 #210225 by PKM
Replied by PKM on topic Homing with absolute encoders
Oh.
I mentioned that the position changed even without homing.
So it must be somewhere else, right?

Please Log in or Create an account to join the conversation.

  • andypugh
  • andypugh's Avatar
  • Away
  • Moderator
  • Moderator
More
25 May 2021 15:22 #210232 by andypugh
Replied by andypugh on topic Homing with absolute encoders

This looks like a suspecthttps://github.com/LinuxCNC/linuxcnc/blob/2e58fb153ca8197d5a2149313fbc7cb300ca0b2f/src/emc/motion/homing.c#L997


That line shouldn't execute if HOME_ABSOLUTE_ENCODER is set.

Please Log in or Create an account to join the conversation.

  • PKM
  • PKM's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
25 May 2021 16:03 - 25 May 2021 16:04 #210236 by PKM
Replied by PKM on topic Homing with absolute encoders
I understand that it should not...
Anyways, it changes even without homing.
Is the offset kept somewhere when the machine is off? The problem might be there
Last edit: 25 May 2021 16:04 by PKM.

Please Log in or Create an account to join the conversation.

Time to create page: 0.085 seconds
Powered by Kunena Forum