Q: Report position and smooth stop in the middle of process
Opened this issue · 1 comments
Hi! I'm having some problems with library. Right now I can init, start, stop motors, with smooth acceleration/deceleration (with Python on Raspberry Pi). Unfortunately, there are 2 things which don't work yet for me.
-
Report position. Code snippets attached. Returned position is always "0". Looks like coded something wrong. If you have samples how to properly use "report position" it would be great.
-
Smooth stop command when move is still NOT complete. I have no idea if its possible to reset (re-init) number of steps while motor still spinning. If this is technically possible, report position feature is required (p 1).
Thanks in advance for any help.
PS. Unfortunately googling "firmata accelstepper example" yields nothing useful.
def accStepFmt_Step(brd, dev_no, num_steps):
cmd = bytearray([acc.ACCELSTEPPER_STEP, dev_no])
cmd.extend(ecn.encodeIntTo7bitSysex(num_steps))
brd.send_sysex(acc.ACCELSTEPPER_DATA, cmd)
def accStepFmt_ReportPosRequest(brd, dev_no):
cmd = bytearray([acc.ACCELSTEPPER_REPORT_POSITION, dev_no])
return brd.send_sysex(acc.ACCELSTEPPER_DATA, cmd)
def accStepFmt_ReportPosReply(brd, dev_no):
sb = bytearray([0] * 5)
cmd = bytearray([acc.ACCELSTEPPER_REPORT_POSITION, dev_no, sb[0], sb[1], sb[2], sb[3], sb[4]])
brd.send_sysex(acc.ACCELSTEPPER_DATA, cmd)
return ecn.bytesToInt(sb)
This is actually follow-up of this bug report
#99
Anyway, if someone can provide sample how to properly implement ACCELSTEPPER_REPORT_POSITION
in Python on RapPi it would be very nice. Main doesn't work and vice versa.