Fail to homing (mechanical switch + index pulse)

More
13 years 2 weeks ago #39814 by mayo
Hi guys,
I'm newbie in linuxcnc and I have just subscribed to the forum,
I ask your help cause i cannot perform homing correctly (the homing procedure appear to be not correct).
Following I give you details:

For semplicity suppose:
  • using only X axis;
  • IO is done with 5i23 MESA board
  • axis is moved by a servo (DELTA) using step/dir command
  • DELTA driver tell to MESA board when index-pulse has been detected via its IO
  • other encoder signal (channels A and B ) are not wired from DELTA to MESA
  • halscope correctly detect axis.0.index-enable logic states
  • HOME and HOME_OFFSET are both set to zero in INI file
  • HOME_USE_INDEX is set to "YES"

so, practically the following behaviour occur:
  1. I switch on drive and emc (axis) software
  2. suppose axis could be anywhere in the working area (just supppose it is in X=XSTART coordinate where XSTART could be any value between axis limits)
  3. since any absolute encoder is connected axis show me that coordinates are 0,0 and it notify me that no home procedure has been carried out
  4. i perform homing
  5. axis X go back looking for mechanical home switch with searchvel velocity
  6. axis X hits mech switch
  7. axis X go forward (ascending X coordinates) looking for index pulse with latchvel velocity
  8. axis X find index pulse
  9. axis X "should" stop on index pulse since HOME and HOME_OFFSET have been set to zero
  10. but... instead stopping, axis X continue going to the original position XSTART with home_final_vel velocity

What could be?
Where is the mistake?
Does this kind of homing procedure use encoder counts (that I've not connected..)?

Thank you all!!

Please Log in to join the conversation.

More
13 years 2 weeks ago #39826 by andypugh
Did we discuss this on IRC last night, or are you someone else with exactly the same problem?

The issue is that index-homing assumes that the encoder counter is inside LinuxCNC HAL and that it is zeroed when the index is seen and index-enable goes false.
This is not the case here, because you are running a step-dir system and the encoder counter is inside the drive.

Because the index-enable pin of the Mesa encoder counter is an IO pin, it is not trivial to connect it correctly in HAL in the way that it needs to be connected.

I think that the solution is a simple custom HAL component.
Code:
component index_toggle "extends the limit switch area to the next index pulse"; pin io bit index-enable "connect to the index-enable of an encoder counter"; pin in bit home-sw-in "connect to the home switch input pin"; pin out bit home-sw-out "connnect to the the motion controller home switch input" function _; license "GPL"; ;; static int old_sw = 0; if (( ! old_sw ) && home_sw_in) index_enable = 1; home_sw_out = index_enable; old_sw = home_sw_in;

Please Log in to join the conversation.

More
13 years 2 weeks ago #39932 by mayo
Thanks a lot andypugh,
the component works very well!

Please Log in to join the conversation.

More
9 years 8 months ago #88175 by Feliciano
Sorry for my question but what's the procedure to make this component available?

I've never use a custom component in linuxCNC before and using the "The Hal component generator" I was enable even to find the folder "linuxcnc/src", so if you guys that already worked on that could help on this one.

Thanks

Please Log in to join the conversation.

More
9 years 8 months ago #88270 by andypugh
Save the code above to a plain text file called index_toggle.comp
Then use the command "sudo halcompile --install index_toggle.comp"

Please Log in to join the conversation.

More
9 years 6 days ago #100794 by Lcvette
Andy, this is fantastic assistance!! And will be put to good use!! Thank you for sharing!

Chris

Please Log in to join the conversation.

More
8 years 8 months ago #105358 by CNCCustoms
Thank you SOO much Andy!
My axes repeat to within 1.5 TENTHS now! (0.004mm) And better on Y and Z

So thankful.
Clint

Please Log in to join the conversation.

More
8 years 4 months ago #111607 by CNCCustoms
Hi Andy

So after some testing I figured out that the homing was indeed not working. It seems every time the machine is restarted, the home position changes. All depending on where the machine was on startup. I usually left my machine at the home switches when shut down so didn't notice this at first. But it didn't take too long to see something was up. I had work to do so I disabled index homing again.. until now.

The story is as follows when using index homing:
When I startup with my axes in arbitrary places, the machine moves toward the home switches and then homes to where the machine started... REGARDLESS of my homing setting. With the index homing disabled, it homes perfectly no matter what (accuracy is just not great at 0.05 mm)

When I did some scratching, I discovered that at first homing of the machine (Index homing enabled) , a pin called encoder.nn.position-latched is written with the axis current encoder position. The homing begins as usual, switch is tripped, then the index-enable goes on and then off and then the machine moves the axis to the axis encoder position of encoder.nn.position-latched position.

I hope that makes sense? When I searched for what this encoder.nn.position-latched is used for, the documentation says it is not in use.

SO it seems the index-toggle is working... at least I think so?

What could be the problem and what can I try to figure this out?

your help is HUGELY appreciated as always!

Clint

Please Log in to join the conversation.

More
8 years 4 months ago #111613 by andypugh

CNCCustoms wrote: When I did some scratching, I discovered that at first homing of the machine (Index homing enabled) , a pin called encoder.nn.position-latched is written with the axis current encoder position. The homing begins as usual, switch is tripped, then the index-enable goes on and then off and then the machine moves the axis to the axis encoder position of encoder.nn.position-latched position.


Can you attach your HAL and INI files?

Please Log in to join the conversation.

More
8 years 4 months ago #111654 by CNCCustoms
Here you go Andy

I upgraded yesterday and then things went pear shaped. Linux crashed for the first time ever. Restarted and all my settings were gone. All the changes I made to the .var file (stores my tool change info)... all gone. Then Linux started to disable for no apparent reason. No message box... very strange.

It was working perfectly before the upgrade. Feel stupid for doing it really.

Well I'm going to start fresh. Im re-installing the image and I will start with a fresh, cleaned up version of my HAL and INI files.

If you can see something in these that may help with the index homing then please do.

Thanks a million!
Clint

Attachment not found

Attachment not found

Please Log in to join the conversation.

Time to create page: 0.312 seconds
Powered by Kunena Forum