Skip to content

Commit 3505570

Browse files
authored
Merge pull request #117 from openUC2/mergemaster
fixing issue with the motor position
2 parents ca2a5a2 + de70004 commit 3505570

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

uc2rest/motor.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ def __init__(self, parent=None):
2323
self.minStep = np.ones((self.nMotors))*(-np.inf)
2424
self.currentDirection = np.zeros((self.nMotors))
2525
self.currentPosition = np.zeros((self.nMotors))
26-
self._position = np.zeros((self.nMotors)) # position from the last motor status update
2726

2827
self.minPosX = -np.inf
2928
self.minPosY = -np.inf
@@ -84,9 +83,9 @@ def _callback_motor_status(self, data):
8483
for iMotor in range(nSteppers):
8584
stepperID = data["steppers"][iMotor]["stepperid"]
8685
# FIXME: smart to re-update this variable? Will be updated by motor-sender too
87-
self._position[stepperID] = data["steppers"][iMotor]["position"] * stepSizes[stepperID] - offSets[stepperID]
86+
self.currentPosition[stepperID] = data["steppers"][iMotor]["position"] * stepSizes[stepperID] - offSets[stepperID]
8887
if callable(self._callbackPerKey[0]):
89-
self._callbackPerKey[0](self._position) # we call the function with the value
88+
self._callbackPerKey[0](self.currentPosition) # we call the function with the value
9089
except Exception as e:
9190
print("Error in _callback_motor_status: ", e)
9291

uc2rest/state.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def pairBT(self, timeout=1):
5555

5656
def espRestart(self,timeout=1):
5757
# if isController =True=> only PS jjoystick will be accepted
58+
# {"task":"/state_act", "restart":1}
5859
path = "/state_act"
5960
payload = {
6061
"restart":1

0 commit comments

Comments
 (0)