Pololu code help

I have a anamatronic robot that is using 8 servos using a 12ch Maistro Polulo.
The Polulo is running a continuous script that moves all the servos.
I would like to ask for someone more experienced then I to write a code or script that will stop a single servo on Ch 3 from moving when a switch is closed on Ch 10. Then resume moving normally when the switch is open.
Is this possible to do?

Hello.

There are a couple of ways you could do something like that. Probably the simplest would be using an IF statement to check the input on channel 10 before each servo command that updates channel 3. If you try implementing something like that yourself and run into problems, you can post the script you have so far here, and I would be happy to take a look.

Brandon

Brandon,
Thank you for the reply. I’m not sure what a IF statement is.
I did change #10 into an input.

Could you type a script that looks at the state of Ch10 and turns off/on ch 3?
From what I’ve learned I should be able to paste that script into my existing script and hopefully it all should work.
Thanks!
-Robert

Hello.

You can disable channel 3 by setting the target position to 0 (i.e. 0 3 servo). Enabling it will happen automatically when you give it a non-zero target position. So, code to check the input on channel 10 before setting the target for channel 3 to your desired position (6000 in this example) would look something like this:

10 get_position 512 less_than if #check if the input on channel 10 is less than 512 (i.e. low)
  0 3 servo #if it was low, disable channel 3
else
  6000 3 servo #otherwise, set channel 3 to your desired target position
endif 

If you try modifying your script and have problems, you can post what you have so far and I would be happy to take a look.

Brandon

Thank you. I’ll look into this and try it.
Appreciate your support!

Brandon,
Below is my entire script.
Unless i did something wrong, the code you wrote for me didn’t work. Ch 3 is still moving when the Switch is pressed.
Ch 10 is set to Input and the cursor moves between 0 and 255.75 when the switch is pressed.

# DJR3X
begin
  500 6023 6395 1792 8000 8000 5984 
  5925 5944 0 0 0 frame_0..9_11 # Frame 2
  500 5435 5631 frame_0_3 # Frame 3
  500 5905 7980 8000 8000 3987 frame_0_2_3_5_7 # Frame 4
  500 5514 5514 7334 frame_0_3_6 # Frame 5
  500 6003 8000 3968 8000 frame_0_3_5_7 # Frame 6
  500 5612 1792 5631 frame_0_2_3 # Frame 7
  500 5964 3968 7980 3968 frame_0_2..4 # Frame 8
  500 5631 8000 5514 frame_0_2_3 # Frame 9
  500 6003 8000 8000 frame_0_3_4 # Frame 10
  500 5631 5416 8000 4607 frame_0_3_5_7 # Frame 11
  500 6081 8000 4604 frame_0_3_7 # Frame 12
  500 5651 6590 5514 4803 frame_0_1_3_7 # Frame 12
  500 6003 6492 8000 3968 frame_0_1_3_7 # Frame 13
  500 5592 6395 5572 3968 9566 frame_0_1_3_5_7 # Frame 14
  500 6238 1792 8000 3968 frame_0_2_3_7 # Frame 15
  500 5572 5455 8000 frame_0_3_5 # Frame 16
  500 6023 8000 8000 frame_0_2_3 # Frame 19
  500 5651 5612 frame_0_3 # Frame 20
repeat

sub frame_0..9_11
  11 servo
  9 servo
  8 servo
  7 servo
  6 servo
  5 servo
  4 servo
  3 servo
  2 servo
  1 servo
  0 servo
  delay
  return

sub frame_0_3
  3 servo
  0 servo
  delay
  return

sub frame_0_2_3_5_7
  7 servo
  5 servo
  3 servo
  2 servo
  0 servo
  delay
  return

sub frame_0_3_6
  6 servo
  3 servo
  0 servo
  delay
  return

sub frame_0_3_5_7
  7 servo
  5 servo
  3 servo
  0 servo
  delay
  return

sub frame_0_2_3
  3 servo
  2 servo
  0 servo
  delay
  return

sub frame_0_2..4
  4 servo
  3 servo
  2 servo
  0 servo
  delay
  return

sub frame_0_3_4
  4 servo
  3 servo
  0 servo
  delay
  return

sub frame_0_3_7
  7 servo
  3 servo
  0 servo
  delay
  return

sub frame_0_1_3_7
  7 servo
  3 servo
  1 servo
  0 servo
  delay
  return

sub frame_0_1_3_5_7
  7 servo
  5 servo
  3 servo
  1 servo
  0 servo
  delay
  return

sub frame_0_2_3_7
  7 servo
  3 servo
  2 servo
  0 servo
  delay
  return

sub frame_0_3_5
  5 servo
  3 servo
  0 servo
  delay
  return

10 get_position 512 less_than if #check if the input on channel 10 is less than 512 (i.e. low)
  0 3 servo #if it was low, disable channel 3
else
  6000 3 servo #otherwise, set channel 3 to your desired target position
endif

To clarify, the code I wrote was an example of what you could do each time you wanted to update the position of servo channel 3, so simply putting it at the end of your code will not do anything. However, since you are updating channel 3 in so many different places in your code, I recommend adding a subroutine like this to the end of your code:

sub channel3_servo
  10 get_position 512 less_than if #check if the input on channel 10 is less than 512 (i.e. low)
    0 3 servo #if it was low, disable channel 3 
    drop
  else
    3 servo 
  endif
  return

Then, you can replace all instances of 3 servo in your other subroutines to channel3_servo. For example, this frame_0..9_11 subroutine:

sub frame_0..9_11
  11 servo
  9 servo
  8 servo
  7 servo
  6 servo
  5 servo
  4 servo
  3 servo
  2 servo
  1 servo
  0 servo
  delay
  return

would become:

sub frame_0..9_11
  11 servo
  9 servo
  8 servo
  7 servo
  6 servo
  5 servo
  4 servo
  channel3_servo
  2 servo
  1 servo
  0 servo
  delay
  return

That way, the channel3_servo subroutine will be called any time you are trying to update channel 3. It will check if the switch is pressed and if it is, the position will be overwritten by turning off channel 3 instead. Otherwise, it will update the servo normally. (Please note that some digital servos will continue to hold their last valid position when the signal cuts out.)

Brandon

Brandon,
Thank you for the info. I’ll try this out tonight and let you know.

-Robert

Brandon,
Thank you! this worked exactly as I’d like it to.
One thing I did forget though…Can you modify the code so servo 0 also stops? (so both servo 0 and servo 3 stop moving when the relay is closed)

Thank you again!
-Robert

You could probably do something more complicated to have a single subroutine to handle both channels, but at this point it would probably be easiest to make a copy of the channel3_servo subroutine and modify it to be for channel 0. So you would have both subroutines like this:

sub channel0_servo
  10 get_position 512 less_than if #check if the input on channel 10 is less than 512 (i.e. low)
    0 0 servo #if it was low, disable channel 3 
    drop
  else
    0 servo 
  endif
  return

sub channel3_servo
  10 get_position 512 less_than if #check if the input on channel 10 is less than 512 (i.e. low)
    0 3 servo #if it was low, disable channel 3 
    drop
  else
    3 servo 
  endif
  return

And you would replace all instances of 0 servo in your other subroutines with channel0_servo.

Brandon

That’s what I was thinking too.
Thank you for your ongoing assistance. I’ll post a link to the project that I’m working on so you can see how it turned out.
Thanks again!

-Robert

1 Like

Brandon,
Thank you! This is exactly what I wanted to achieve.
Below is a link to a video on FB. Hopefully the link works so you can see what you helped me achieve.

Redirecting...?

-Robert

Good afternoon, I have one more question. On some occasions Servo #4 and Servo #9 seem to jolt suddenly almost violently. Can you please look over the code and see if you see anything suspicious? Thank you again!

<!--Pololu Maestro servo controller settings file, http://www.pololu.com/catalog/product/1350-->
<UscSettings version="1">
  <NeverSuspend>false</NeverSuspend>
  <SerialMode>UART_FIXED_BAUD_RATE</SerialMode>
  <FixedBaudRate>9600</FixedBaudRate>
  <SerialTimeout>0</SerialTimeout>
  <EnableCrc>false</EnableCrc>
  <SerialDeviceNumber>12</SerialDeviceNumber>
  <SerialMiniSscOffset>0</SerialMiniSscOffset>
  <Channels MiniMaestroServoPeriod="80000" ServoMultiplier="1">
    <!--Period = 20 ms-->
    <!--Channel 0-->
    <Channel name="VISOR" mode="Servo" min="3968" max="8000" homemode="Off" home="3968" speed="25" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 1-->
    <Channel name="HEAD NOD" mode="Servo" min="3968" max="8000" homemode="Off" home="3968" speed="0" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 2-->
    <Channel name="HEAD L-R" mode="Servo" min="1792" max="11200" homemode="Off" home="1792" speed="60" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 3-->
    <Channel name="HEAD U-D" mode="Servo" min="3968" max="8000" homemode="Off" home="3968" speed="0" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 4-->
    <Channel name="TOP RING" mode="Servo" min="2560" max="10048" homemode="Off" home="2560" speed="25" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 5-->
    <Channel name="BOTTOM RING" mode="Servo" min="3584" max="8448" homemode="Off" home="3584" speed="46" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 6-->
    <Channel name="ARM" mode="Servo" min="3968" max="8000" homemode="Off" home="3968" speed="25" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 7-->
    <Channel name="WRIST" mode="Servo" min="2944" max="9664" homemode="Off" home="2944" speed="50" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 8-->
    <Channel name="" mode="Servo" min="3968" max="8000" homemode="Off" home="3968" speed="0" acceleration="0" neutral="6000" range="1905" />
    <!--Channel 9-->
    <Channel name="TROTTLE ARM" mode="Servo" min="3968" max="8000" homemode="Ignore" home="3968" speed="15" acceleration="0" neutral="3968" range="1905" />
    <!--Channel 10-->
    <Channel name="INPUT SW" mode="Input" min="0" max="1024" homemode="Ignore" home="0" speed="0" acceleration="0" neutral="1024" range="1905" />
    <!--Channel 11-->
    <Channel name="" mode="Servo" min="3968" max="8000" homemode="Off" home="3968" speed="0" acceleration="0" neutral="6000" range="1905" />
  </Channels>
  <Sequences>
    <Sequence name="DJR3X" useSpeedAndAcceleration="false">
      <Frame name="Frame 2" duration="500">6023 6395 1792 8000 8000 5984 5925 5944 0 0 0 0 s 25 0 60 0 25 25 25 50 0 0 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 3" duration="500">5435 6395 1792 5631 8000 5984 5925 5944 0 0 0 0 s 25 0 60 0 25 25 25 50 0 0 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 4" duration="500">5905 6395 7980 8000 8000 8000 5925 3987 0 0 0 0 s 25 0 60 0 25 25 25 50 0 0 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 5" duration="500">5514 6395 7980 5514 8000 8000 7334 3987 0 0 0 0 s 25 0 60 0 25 25 25 50 0 0 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 6" duration="500">6003 6395 7980 8000 8000 3968 7334 8000 0 0 0 0 s 25 0 60 0 25 25 25 50 0 0 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 7" duration="500">5612 6395 5445 5631 8000 3968 7334 8000 0 0 1023 0 s 25 0 60 0 25 46 25 50 0 0 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 8" duration="500">5964 6395 3968 7980 2560 3968 7334 8000 0 0 1023 0 s 25 0 60 0 25 46 25 50 0 0 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 9" duration="500">5631 6395 8000 5514 2596 3968 7334 8000 0 0 1023 0 s 25 0 60 0 25 46 25 50 0 0 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 10" duration="500">6003 6395 8000 8000 10048 3968 7334 8000 0 0 1023 0 s 25 0 60 0 25 46 25 50 0 0 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 11" duration="500">5631 6395 8000 5416 10048 8448 7334 4607 0 0 1023 0 s 25 0 60 0 25 46 25 50 0 0 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 12" duration="500">6081 6395 8000 8000 8000 8000 7334 4604 0 0 0 0 s 25 0 60 0 25 25 25 50 0 0 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 12" duration="500">5651 6590 8000 5514 8000 8000 7334 4803 0 0 0 0 s 25 0 25 0 25 25 25 45 0 0 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 13" duration="500">6003 6492 8000 8000 8000 8000 7334 3968 0 0 0 0 s 25 0 60 0 25 25 25 50 0 0 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 14" duration="500">5592 6395 8000 5572 8000 3584 7334 9566 0 0 1023 0 s 25 0 60 0 25 46 25 50 0 0 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 15" duration="500">6238 6395 1792 8000 8000 3968 7334 3968 0 0 0 0 s 25 0 25 0 25 25 25 50 0 0 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 16" duration="500">5572 6395 1792 5455 8000 8000 7334 3968 0 0 0 0 s 25 0 60 0 25 25 25 50 0 0 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 19" duration="500">6023 6395 1792 8000 8000 8000 7334 3968 0 0 1023 0 s 25 0 60 0 25 46 25 50 0 0 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 20" duration="500">5651 6395 3207 5612 8000 8000 7334 3968 0 0 1023 0 s 25 0 60 0 25 46 25 50 0 0 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
    </Sequence>
    <Sequence name="DJREX 2" useSpeedAndAcceleration="true">
      <Frame name="Frame 0" duration="600">5520 6473 4669 4653 6594 8000 7334 4542 0 6000 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 1" duration="600">6101 6395 4669 8000 10048 8000 7334 4604 0 6000 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 2" duration="600">5523 6395 4669 4007 10048 8000 7334 4604 0 6000 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 3" duration="600">5984 6395 4669 8000 10048 3607 6238 6304 0 6000 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 4" duration="600">5523 6395 10286 4007 10048 3607 7119 6206 0 7119 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 5" duration="600">6238 6395 1792 8000 10048 3607 7119 6206 0 7119 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 6" duration="600">5552 6395 6404 4046 10048 8424 7119 8032 0 6238 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 7" duration="600">6042 6395 11154 8000 10048 3584 7119 6467 0 6238 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 8" duration="600">5651 6395 11154 3968 10048 3584 7119 6467 0 6238 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 9" duration="600">6062 6395 1883 7902 2560 3584 7119 8098 0 6238 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 10" duration="600">5612 6395 1883 3968 2560 8448 7119 6467 0 7354 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 11" duration="600">6179 6590 1883 7941 2560 8448 7119 6467 0 7354 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 12" duration="600">5612 6590 1792 3968 2560 8448 7119 6467 0 7354 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 13" duration="600">5984 6590 11200 8000 10048 8448 7119 3465 0 7354 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 14" duration="600">5572 6590 11200 3987 10048 3584 5964 6304 0 7354 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 15" duration="600">6160 6590 5399 8000 10048 3584 5964 4705 0 6571 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 16" duration="600">5514 6590 5399 3987 10048 3584 5964 7576 0 6571 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 17" duration="600">6081 6590 11200 7980 3580 8448 5964 8293 0 6571 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 18" duration="600">5572 6590 11200 3968 3580 8448 5964 7576 0 5964 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 19" duration="600">6003 6590 11200 7980 3580 5732 7099 6206 0 5964 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 20" duration="600">5533 6590 4943 3968 3580 5732 7099 6206 0 7354 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 21" duration="600">6023 6590 4943 8000 5358 5732 6258 4509 0 7354 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 22" duration="600">5553 6590 4943 4007 5358 3584 6258 4509 0 6355 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 23" duration="600">6179 6590 4943 8000 5358 3584 6258 4509 0 6355 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 24" duration="600">5533 6590 4943 3968 2560 8448 6258 8424 0 6355 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 25" duration="600">6101 6590 11200 8000 2560 8448 6258 6075 0 6355 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 26" duration="600">5553 6590 11200 3968 10048 8448 6258 3661 0 6355 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 27" duration="600">5886 6590 11200 7960 10048 8448 6258 6075 0 7295 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 28" duration="600">5631 6590 11200 4222 10048 8448 6258 4248 0 7295 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 29" duration="600">6042 6590 11200 7628 10048 8448 6258 5879 0 7295 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 30" duration="600">5651 6590 11200 4046 10048 8448 6258 7478 0 7295 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 31" duration="600">6297 6590 8688 7941 10048 8448 6258 5129 0 7295 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 32" duration="600">5572 6590 5399 4065 10048 8448 6258 7967 0 7295 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 33" duration="600">6218 6590 5399 7960 10048 8448 6258 5129 0 7295 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 34" duration="600">5572 6590 5399 4105 10048 8000 7334 5912 0 7295 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 35" duration="600">6101 6590 5399 7941 10048 8000 7334 4183 0 7295 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 36" duration="600">5553 6590 5399 4144 8194 8000 7334 5129 0 7295 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
      <Frame name="Frame 37" duration="600">6121 6590 5399 7823 7140 8000 7334 7184 0 7295 1023 0 s 25 0 60 0 25 46 25 50 0 7 0 0 a 0 0 0 0 0 0 0 0 0 0 0 0</Frame>
    </Sequence>
  </Sequences>
  <Script ScriptDone="false"># DJREX 2
begin
  25 0 0 1 60 2 0 3 25 4 46 5
  25 6 50 7 0 8 7 9 0 11 speed
  speed speed speed speed speed speed
  speed speed speed speed
  0 0 0 1 0 2 0 3 0 4 0 5
  0 6 0 7 0 8 0 9 0 11 acceleration
  acceleration acceleration acceleration acceleration acceleration acceleration
  acceleration acceleration acceleration acceleration
  600 5520 6473 4669 4653 6594 8000 
  7334 4542 0 6000 0 frame_0..9_11 # Frame 0
  600 6101 6395 8000 10048 4604 frame_0_1_3_4_7 # Frame 1
  600 5523 4007 frame_0_3 # Frame 2
  600 5984 8000 3607 6238 6304 frame_0_3_5..7 # Frame 3
  600 5523 10286 4007 7119 6206 7119 frame_0_2_3_6_7_9 # Frame 4
  600 6238 1792 8000 frame_0_2_3 # Frame 5
  600 5552 6404 4046 8424 8032 6238 frame_0_2_3_5_7_9 # Frame 6
  600 6042 11154 8000 3584 6467 frame_0_2_3_5_7 # Frame 7
  600 5651 3968 frame_0_3 # Frame 8
  600 6062 1883 7902 2560 8098 frame_0_2..4_7 # Frame 9
  600 5612 3968 8448 6467 7354 frame_0_3_5_7_9 # Frame 10
  600 6179 6590 7941 frame_0_1_3 # Frame 11
  600 5612 1792 3968 frame_0_2_3 # Frame 12
  600 5984 11200 8000 10048 3465 frame_0_2..4_7 # Frame 13
  600 5572 3987 3584 5964 6304 frame_0_3_5..7 # Frame 14
  600 6160 5399 8000 4705 6571 frame_0_2_3_7_9 # Frame 15
  600 5514 3987 7576 frame_0_3_7 # Frame 16
  600 6081 11200 7980 3580 8448 8293 frame_0_2..5_7 # Frame 17
  600 5572 3968 7576 5964 frame_0_3_7_9 # Frame 18
  600 6003 7980 5732 7099 6206 frame_0_3_5..7 # Frame 19
  600 5533 4943 3968 7354 frame_0_2_3_9 # Frame 20
  600 6023 8000 5358 6258 4509 frame_0_3_4_6_7 # Frame 21
  600 5553 4007 3584 6355 frame_0_3_5_9 # Frame 22
  600 6179 8000 frame_0_3 # Frame 23
  600 5533 3968 2560 8448 8424 frame_0_3..5_7 # Frame 24
  600 6101 11200 8000 6075 frame_0_2_3_7 # Frame 25
  600 5553 3968 10048 3661 frame_0_3_4_7 # Frame 26
  600 5886 7960 6075 7295 frame_0_3_7_9 # Frame 27
  600 5631 4222 4248 frame_0_3_7 # Frame 28
  600 6042 7628 5879 frame_0_3_7 # Frame 29
  600 5651 4046 7478 frame_0_3_7 # Frame 30
  600 6297 8688 7941 5129 frame_0_2_3_7 # Frame 31
  600 5572 5399 4065 7967 frame_0_2_3_7 # Frame 32
  600 6218 7960 5129 frame_0_3_7 # Frame 33
  600 5572 4105 8000 7334 5912 frame_0_3_5..7 # Frame 34
  600 6101 7941 4183 frame_0_3_7 # Frame 35
  600 5553 4144 8194 5129 frame_0_3_4_7 # Frame 36
  600 6121 7823 7140 7184 frame_0_3_4_7 # Frame 37
repeat

sub frame_0..9_11
  11 servo
  9 servo
  8 servo
  7 servo
  6 servo
  5 servo
  4 servo
  channel3_servo
  2 servo
  1 servo
  channel0_servo
  delay
  return

sub frame_0_1_3_4_7
  7 servo
  4 servo
  channel3_servo
  1 servo
  channel0_servo
  delay
  return

sub frame_0_3
  channel3_servo
  channel0_servo
  delay
  return

sub frame_0_3_5..7
  7 servo
  6 servo
  5 servo
  channel3_servo
  channel0_servo
  delay
  return

sub frame_0_2_3_6_7_9
  9 servo
  7 servo
  6 servo
  channel3_servo
  2 servo
  channel0_servo
  delay
  return

sub frame_0_2_3
  channel3_servo
  2 servo
  channel0_servo
  delay
  return

sub frame_0_2_3_5_7_9
  9 servo
  7 servo
  5 servo
  channel3_servo
  2 servo
  channel0_servo
  delay
  return

sub frame_0_2_3_5_7
  7 servo
  5 servo
  channel3_servo
  2 servo
  channel0_servo
  delay
  return

sub frame_0_2..4_7
  7 servo
  4 servo
  channel3_servo
  2 servo
  channel0_servo
  delay
  return

sub frame_0_3_5_7_9
  9 servo
  7 servo
  5 servo
  channel3_servo
  channel0_servo
  delay
  return

sub frame_0_1_3
  channel3_servo
  1 servo
  channel0_servo
  delay
  return

sub frame_0_2_3_7_9
  9 servo
  7 servo
  channel3_servo
  2 servo
  channel0_servo
  delay
  return

sub frame_0_3_7
  7 servo
  channel3_servo
  channel0_servo
  delay
  return

sub frame_0_2..5_7
  7 servo
  5 servo
  4 servo
  channel3_servo
  2 servo
  channel0_servo
  delay
  return

sub frame_0_3_7_9
  9 servo
  7 servo
  channel3_servo
  channel0_servo
  delay
  return

sub frame_0_2_3_9
  9 servo
  channel3_servo
  2 servo
  channel0_servo
  delay
  return

sub frame_0_3_4_6_7
  7 servo
  6 servo
  4 servo
  channel3_servo
  channel0_servo
  delay
  return

sub frame_0_3_5_9
  9 servo
  5 servo
  channel3_servo
  channel0_servo
  delay
  return

sub frame_0_3..5_7
  7 servo
  5 servo
  4 servo
  channel3_servo
  channel0_servo
  delay
  return

sub frame_0_2_3_7
  7 servo
  channel3_servo
  2 servo
  channel0_servo
  delay
  return

sub frame_0_3_4_7
  7 servo
  4 servo
  channel3_servo
  channel0_servo
  delay
  return

sub channel0_servo
  10 get_position 512 less_than if #check if the input on channel 10 is less than 512 (i.e. low)
    0 0 servo #if it was low, disable channel 0 
    drop
  else
    0 servo 
  endif
  return

sub channel3_servo
  10 get_position 512 less_than if #check if the input on channel 10 is less than 512 (i.e. low)
    0 3 servo #if it was low, disable channel 3 
    drop
  else
    3 servo 
  endif
  return</Script>
</UscSettings>

I didn’t notice anything obvious from your settings. I ran your script while monitoring the “Status” tab to see what the Maestro does with the servos, and none of the movements on those two servos looks particularly jarring or sudden.

A sudden jitter or unpredictable behavior like that can sometimes be a sign of a power issue or an underpowered servo. You might try running each of the problematic servos in isolation (e.g. disconnecting all servos except servo 4, then doing the same for servo 9) and seeing if the issue persists. I recommend running your script as well as moving the slider around manually to see how it behaves. If the problem still persists in isolation, you can try removing the load on the servos and testing them again.

Brandon

Brandon,
What’s odd is you never see any issues when plugged into the PC. It only acts strangely when the code is run on the Pololu itself. With no PC.
I also noticed something wrong. The 8 bit neutral for one of the servos was 1248 instead of the 1500 that all the other servos are.

The 8-bit neutral values are only relevant when using the 8-bit commands (i.e. the Mini SSC Protocol), so that difference shouldn’t have any affect.

If it only happens when disconnected from USB, that could be another sign of a power issue (i.e. the voltage dropping when under load). So, I still recommend trying the tests I described in my previous post. Also, could you monitor the servo power line with an oscilloscope while running your script to get a better understanding of what it is doing?

Brandon