Re-homing from a python file associated to a glade interface

More
26 Nov 2018 03:27 #121359 by Nico2017
Hi,
I am building a glade interface for linuxcnc for a specific project. I would like toobtain a home button feature which can actually act as a rehome button if the axis is already homed. I struggle to find the good sequence of command to send for the re home case. Here is the ini file section for one axis (X and values are identical for Y)
[AXIS_X]
MAX_VELOCITY = 100.0
MAX_ACCELERATION = 100.0
MIN_LIMIT = -100
MAX_LIMIT = 500
[JOINT_0]
TYPE = LINEAR
MAX_VELOCITY = 50
MAX_ACCELERATION = 500.0
BACKLASH = 0.000
INPUT_SCALE = 1.000
OUTPUT_SCALE = 1.000
MIN_LIMIT = -100
MAX_LIMIT = 500
FERROR = 0.050
MIN_FERROR = 0.010
#Homing type immediate
#Homing on the fly or manual, when pressing homing or sensor triggered
HOME_SEARCH_VEL = 0
HOME_LATCH_VEL = 0
HOME_USE_INDEX = NO
HOME_SEQUENCE = 0
#HOME_SEQUENCE = -1
#HOME = 0.000
HOME = 0
HOME_OFFSET = 0.0
HOME_IGNORE_LIMITS = NO
#HOME_IS_SHARED = 1

I would like a homing sequence of homing type immediate, which take the value in a spin box ( here NameGladeInterface.hal_spinbuttonXManualHomeModePos-f) and set this value for the the associated axis (X or Y). So from the hal I am actually doing:
net XValueHomePosition NameGladeInterface.hal_spinbuttonXManualHomeModePos-f => ini.0.home ini.0.home_offset
net YValueHomePosition NameGladeInterface.hal_spinbuttonYManualHomeModePos-f => ini.1.home ini.1.home_offset

I defined an action linked to the button on my glade interface:

def on_hal_SetCurrentY_clicked(self, widget, data=None):
print 'Homing Y axis clicked.'
if self.status.homed[1]:
print 'Axis Y already home, unhoming then homing again'
#self.c.teleop_enable(1)
#self.c.wait_complete() # wait until the teleop mode is disable
self.c.unhome(1)
self.c.wait_complete() # wait until joint 0 is unhomed
self.c.home(1)
self.c.wait_complete() # wait until joint 0 is homed
self.c.teleop_enable(0)
self.c.wait_complete() # wait until trajectory mode back to Free mode (used for jogging)
else:
print 'Homing axis Y.'
self.c.home(1)
self.c.wait_complete() # wait until joint 0 homed

This work well when I home for the first time. However this does not when I try to re-home for a second time. The question being what should be the sequence of command to do a correct re home.

Thank you

Nicolas

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

More
29 Nov 2018 22:27 #121611 by newbynobi
Did you jog away from the homing switch prior to start the rehoming?
You home pos is null, so is the home offset. If you do not move away, it might be that it does not work.

Norbert
The following user(s) said Thank You: Nico2017

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

More
11 Dec 2018 04:27 #122180 by Nico2017
Hi,
thanks for your answer. So the sequence that is working for me is this one, where you actually have to force the teleop mode before rehoming as shown in:

if self.status.homed[0]:
print 'Axis X already homed, unhoming then homing again'
self.c.teleop_enable(0)
self.c.wait_complete() # wait until the teleop mode is disable
self.c.unhome(0)
self.c.wait_complete() # wait until joint 0 is unhomed
self.c.home(0)
self.c.wait_complete() # wait until joint 0 is homed
else:
print 'Homing axis X.'
self.c.home(0)
self.c.wait_complete() # wait until joint 0 homed, ie when the joint has been to the home location.

FYI, I am also using a home position and home offset identical to force homing to the position which is defined by this value. It works fine when my joint position feedback is using the joint pos-cmd but I am struggling when I am actually using a real encoder information to the joint pos fb.

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

More
11 Dec 2018 08:52 #122188 by pl7i92
rehoome has changed in halui as from 2.7.12
be aware only selected axis is to be rehomed now

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

Time to create page: 0.086 seconds
Powered by Kunena Forum