Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Run Sequeneces in Parallel

Hi,

I’m using the Mini Maestro 12 servo controller. Is there a way in the Maestro Control Center to program to run two sequences in parallel? Possibly in the script?

I have a robot strumming a guitar on one servo and I want that to continue happening in one sequence. While simultaneously on the other sequence, I move the body of the robot at a slower duration.

I cant have these on the same sequence because the hand moves back and forth multiple times while the robot body is finishing its frame of movement.

The current code I have plays the first sequence (Guitarstrum) and then once complete, plays seconds sequence (Bodymove)…


### Sequence subroutines: ###

# Guitarstrum
sub Guitarstrum
  500 0 0 0 0 0 0 
  0 3200 0 0 0 0 frame_0..11 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  500 3200 frame_7 # Frame 0
  500 5632 frame_7 # Frame 1
  
# Bodymove
sub Bodymove
  1000 4693 5321 7154 0 0 0 
  0 5632 0 4224 8192 0 frame_0..11 # 0.0
  2500 6738 frame_0 # 0.1
  2500 2823 frame_0 # 0.2
  2200 6477 5303 7508 3200 frame_0..2_7 # Frame 2
  2000 3323 5225 6278 0 0 0 frame_0..2_7_9_10 # Frame 3
  2500 5469 8552 frame_1_2 # Frame 4
  2500 6716 5221 5812 frame_0..2 # Frame 5c
  2500 5259 5386 8533 4224 8192 frame_0..2_9_10 # Frame 5
  2500 4954 4825 5737 7104 6912 frame_0..2_9_10 # Frame 6
  2500 4650 5434 7210 4224 8192 frame_0..2_9_10 # Frame 7last
  

sub frame_0..11
  11 servo
  10 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_7
  7 servo
  delay
  return

sub frame_0
  0 servo
  delay
  return

sub frame_0..2_7
  7 servo
  2 servo
  1 servo
  0 servo
  delay
  return

sub frame_0..2_7_9_10
  10 servo
  9 servo
  7 servo
  2 servo
  1 servo
  0 servo
  delay
  return

sub frame_1_2
  2 servo
  1 servo
  delay
  return

sub frame_0..2
  2 servo
  1 servo
  0 servo
  delay
  return

sub frame_0..2_9_10
  10 servo
  9 servo
  2 servo
  1 servo
  0 servo
  delay
  return

Thank you,

-Austin

Hello, Austin.

The Maestro does not have built-in support for running multiple sequences in parallel like that, but I am not sure I understand why you say they can not be on the same sequence. The Maestro’s sequencer essentially takes a snapshot of the target positions on each channel, so if you do not want that channel to change on a given frame, you do not have to move it.

As a short example, lets say you want to move a “body” servo back and forth every 2000ms and a “guitar strumming” servo every 500ms. Your frames could look like this:

frame 0 (500ms duration): move the body servo to the left, and move the guitar strumming servo down.
frame 1 (500ms duration): leave the body servo where it is, move the guitar strumming servo up.
frame 2 (500ms duration): leave the body servo where it is, move the guitar strumming servo down.
frame 3 (500ms duration): leave the body servo where it is, move the guitar strumming servo up.
frame 4 (500ms duration): since 2000ms has passed, move the body servo to the right, move the guitar strumming servo down.

It is okay if frames 1, 2, and 3 start before the body actually reaches the left position. The sequencer just sets the target positions of your servos, and each servo will obey your speed and acceleration limits as it tries to reach that target.

Brandon

Brandon,

Thank you that worked well. Parrallel would have been nice so I didnt need to create soo many frames in one sequence, but it’s Ok.

What is the limit on these Maestro’s for frames, script lines, or maximum duration?

Thank you,

The sequences and sequencer are a feature of the Maestro Control Center, which is not limited in length by the Maestro itself (since it is just software running on the computer). However, if you are converting the sequence to a script, then it can be limited by the memory of the Maestro.

The Maestro script is stored on your computer, so there is practically no limit to the number of lines you can have in your script. You can add whitespace and comments without taking up memory on your Maestro. There is no specific limit to the number of frames or the duration of sequences that can be stored in a Maestro script, but each frame does occupy some of the Maestro’s limited memory. The Micro Maestro has 1 KB available for holding the compiled form of your script, while the Mini Maestros have 8 KB. If size of your script (which is displayed for you near the top of the Script tab) becomes an issue for you, the “Compressing the sequence” subsection of the “Example Scripts” section of the Maestro user’s guide could be helpful.

Brandon

1 Like