Pololu 6 servo controller - moving_wait not working

Hi forum,
I have looked through the topics and have seen a couple of instances of this moving_wait difficulty and I’ve applied all advised code into my code however it is not working - the code gets “stuck” in moving_wait even though nothing is moving and speed and acceleration are set. Any ideas please (not much hair left to pull)
Code below:

2018 5 max
1719 5 min
30 3 acceleration
30 5 acceleration
20 3 speed
20 5 speed
begin
  1075 3 servo
moving_wait
  2000 3 servo
moving_wait
1075 3 servo
moving_wait
1719 5 servo
moving_wait
2018 5 servo
moving_wait
1719 5 servo  
repeat 
sub moving_wait
  begin
    get_moving_state
  while
    repeat
  return

uh and Merry Christmas to all.

Hello.

I moved your post to the “Servo controllers and servos” section of our forum since it seems more appropriate.

Thank you for posting your script. It looks like the target position values you are using with your servo commands are in units of microseconds; they should be in quarter-microseconds in your script, so you will need to multiply them by 4. I suspect that is the main cause of the problem. If you want to keep the values in your script in units of microseconds (for readability) you could add 4 times after each target position value (e.g. 2000 4 times 3 servo).

By the way, it also looks like you are trying to use the min and max command incorrectly. These commands are mathematical commands that takes two arguments from the stack and puts either the minimum or maximum of those two values back on the stack. It looks like you are trying to use it to set the minimum and maximum target value for a specific servo channel. There is no script command for doing this (since those values are stored on the Maestro and have a limited number of erase/write cycles). You can adjust those settings in the “Channel Settings” tab of the Maestro Control Center.

Brandon

Thank you Brandon,
very helpful
D6

However …
following your advice and correcting as per your suggestions - it still sticks in the moving_wait loop.
I have tried adjusting the min and max in the Channel Settings however they either do not accept changes or simply revert to their previous setting upon my clicking save.

Also, the times 4 business was not mentioned (I don’t think) in the help file for Maestro and my code was to all intents and purposes the same and so even though I’ve changed it to your suggestion, I’m not sure this is correct or useful.

My code now looks like this:

30 3 acceleration
30 5 acceleration
20 3 speed
20 5 speed
begin
  1075 4 times 3 servo
moving_wait
  2000 4 times 3 servo
moving_wait
1075 4 times 3 servo
moving_wait
1719 4 times 5 servo
moving_wait
2018 4 times 5 servo
moving_wait
1719 4 times 5 servo  
repeat 
sub moving_wait
  begin
    get_moving_state
  while
    repeat
  return

thank you
Best Wishes for the New Year
D6

What are your min and max values for servo channels 3 and 5 set to? I suspect you might be running into a scenario with the Micro Maestro where the target value commanded is outside of the valid range configured in the “Channel Settings” tab, so get_moving_state still returns 1 instead of 0.

I recommend trying to figure out why you can not change the min and max settings first, since fixing that should fix the problem. Did you change any other settings in the “Channel Settings” tab such as the “Period” or “Servos available”? Can you post your Maestro settings file? You can save your settings file by selecting the “Save settings file…” option within the “File” drop-down menu of the Maestro Control Center.

Brandon

1 Like

Bang-on Brandon - I was trying to get the servo to move to a position beyond the min/max bounds.
Thank you. I have now corrected this and all is working happily.

2 Likes