Wait for AX-12 action
AGCB
Posts: 327
in Propeller 1
I've been playing w/ a Dynamixel servo and have found that if the servo action is slowed down and the program doesn't have a long enough WAITCNT in it, the program over rides w/ a new instruction and does not finish the previous.
Is there a way to let the servo finish before a new action is started"
There is a register in RAM called MOVING $2E, but I'm unsure how to use it.
This is my attempt (inserted after
Thanks
Aaron
Is there a way to let the servo finish before a new action is started"
There is a register in RAM called MOVING $2E, but I'm unsure how to use it.
This is my attempt (inserted after
dy.setsrvpos(id,position)
PUB waitax | c waitcnt(clkfreq/8+cnt) 'let movement be started c:=1 'initialize c to non zero repeat until c==0 'wait till not moving c:=dy.ReadData(1, $2e, 1) 'read $2E (MOVING) registerThe program seems to end too soon though.
Thanks
Aaron
Comments
BTW, you can avoid needing to set a variable to a value prior to a loop by placing the condition at the end of the loop.
The above code could have been written:
Or:
But in light of what I just said, I'd use:
Sorry, but I don't recall if register $2E is really doing what you want. I think you're using it correctly but I'm not sure.
I would do something like this: By using quit you break out of the wait loop as soon as the P_MOVING register is $00.
I thought I learned you shouldn't be sending commands to the Dynamixels more frequently than 50Hz from you?
I was wrong about 50Hz. Here's the quote I was thinking of:
I've gotten it working but with an occasional hiccup. That timing could be the trick. I'll try it.
Aaron