Hi,
In a forever while loop after assigning a particular input position, if I check if the input pos is equal to that assigned position, this returns false and if I print out the value it shows that the value set previously was reset. Not sure what’s going on here?
Also in the position control mode, if a new Input Pos is set while the motor is moving, I get a OVER CURRENT error. (The new value is in the same direction as the movement of the motor and far from the setpoint)
Please provide some examples of what you’re writing vs what you’re reading.
Also, what is your controller.config.input_mode
setting?
I’m in the pass through input mode, basically controller.config.input_mode = 1
Here’s my function:
def MoveToSetpoint(self,Pos,CurrAngle,TargetAngle,retry = 1):
if self.CheckDeadBand(CurrAngle, TargetAngle): # Allows movement if outside deadband range
if self.get_error() == 0:
if self.axis.requested_state != AXIS_STATE_CLOSED_LOOP_CONTROL:
self.axis.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL
while retry != 0:
if int(self.controller.input_pos) not in range(int(self.Pos)-2,int(self.Pos)+2):
self.EndTime = tim.StartTimer(‘1s’)
if tim.TimerElapsed(self.EndTime):
print('Entered '+ str(self.controller.input_pos))
self.controller.input_pos = self.Pos
self.TargetAngleSet[TargetAngle] = True
time.sleep(0.25)
retry = retry - 1
else:
return True
return False
This function receives, Pos inputs in a forever while loop, I have a check the prevents the same Pos from being set as controller.input_pos over and over again.
Here’s the debug output:
Pos:7411
Entered -8.438212535111234e-05
Pos:7764
Entered 490.2388000488281
There are two issues here:
- The controller.input_pos before being written to should’ve reported 7411, but it is reporting 490.238 which is likely the odrive’s current position
- The moment the Pos 7764 is written to controller.input_pos, there is a CURRENT_LIMIT VIOLATION ERROR that pops up. Basically I can’t write new input_pos values in the same direction of rotation. I have to wait till the odrive comes to a stop. Is that normal?
No that’s not normal. You want to go to 7000 rotations position? Make sure vel limit and current limit and torque limit all look ok