Skip to content

Commit 8e9ccd6

Browse files
authored
ds402: Remove set_new_home functionality from BaseNode402.homing(). (#250)
The homing() method will try to manipulate the Home Offset (0x607C) parameter by default. That's not the way the parameter is intended to work. After a successful homing procedure, the drive should set the Actual Position (0x6063) to the Home Offset (0x607C) by itself. By default that is zero, so the selected reference switch flank will mark the new zero position. The library's default behavior here is backwards, and can only work with absolute position encoders. The whole point of homing is to find a physical reference and align the logical coordinate system to it. Trying to determine the desired offset from the value which an unreferenced encoder had at the physical reference point actually destroys that logical alignment. The functionality of set_new_home=True is trivial to do from the application, so remove it completely from homing().
1 parent 4b95870 commit 8e9ccd6

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

canopen/profiles/p402.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,10 @@ def is_homed(self, restore_op_mode=False):
295295
self.op_mode = previous_op_mode
296296
return homingstatus in ('TARGET REACHED', 'ATTAINED')
297297

298-
def homing(self, timeout=TIMEOUT_HOMING_DEFAULT, set_new_home=True):
298+
def homing(self, timeout=TIMEOUT_HOMING_DEFAULT):
299299
"""Execute the configured Homing method on the node.
300300
301301
:param int timeout: Timeout value (default: 30).
302-
:param bool set_new_home:
303-
Defines if the node should set the home offset object (0x607C) to the current
304-
position after the homing procedure (default: true).
305302
:return: If the homing was complete with success.
306303
:rtype: bool
307304
"""
@@ -326,10 +323,6 @@ def homing(self, timeout=TIMEOUT_HOMING_DEFAULT, set_new_home=True):
326323
time.sleep(self.INTERVAL_CHECK_STATE)
327324
if time.monotonic() > t:
328325
raise RuntimeError('Unable to home, timeout reached')
329-
if set_new_home:
330-
actual_position = self.sdo[0x6063].raw
331-
self.sdo[0x607C].raw = actual_position # Home Offset
332-
logger.info('Homing offset set to {0}'.format(actual_position))
333326
logger.info('Homing mode carried out successfully.')
334327
return True
335328
except RuntimeError as e:

0 commit comments

Comments
 (0)