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

Pololu Forum

How to call several subroutines created with a maestro controller by using a raspberry pi

Hello,please i need help in executing my created sequences. I created multiple sequences for my hexapod by simply using the maestro control centre. My question is, if they is any way possible that I can call those subroutine sequences by using a raspberry pi to execute a desired movement.

for instance, if I want to control the robot wirelessly with a Bluetooth controller and move it forward for 5 seconds turn left for 3 seconds then stop.

I discovered that they are no direct way to connect the USB device directly to the maestro controller.

Any suggestions will be gratefully appreciated.

sub button_front
0 get_position 500 less_than
Return 
sub button_left
1 get_position 500 less_than
return
sub button_right
2 get_position 500 less_than
return
sub button_up
3 get_position 500 less_than
Return 
sub button_down
4 get_position 500 less_than
return
sub button_back
5 get_position 500 less_than
Return 

sub Sequence_0 #front
begin
  200 6820 5964 6982 0 6982 3968 
  4966 0 6000 6472 6000 0 
  6000 6000 5316 0 6982 5964 
  6982 0 6982 3968 4966 0 frame_0..23 # frame 0
  200 4461 8000 6982 0 4966 4966 
  4966 0 6000 6472 6000 0 
  6000 6000 5316 0 4946 8000 
  6982 0 4966 4966 4966 0 frame_0..23 # frame 1
  200 4461 8000 6980 0 4966 4962 
  4966 0 6960 5984 6492 0 
  6980 6000 4964 0 4946 8000 
  6982 0 4966 4966 4966 0 frame_0..23 # frame 2
  200 6820 5964 6982 0 6982 3968 
  4966 0 6000 6472 6000 0 
  6000 6000 5316 0 6982 5964 
  6982 0 6982 3968 4966 0 frame_0..23 # frame 3
500 delay
repeat
sub Sequence_1 #left
begin
  200 5664 6980 6980 0 8000 3968 
  4964 0 8000 8000 6980 0 
  6000 4964 4964 0 6000 6980 
  6980 0 8000 3968 3968 0 frame_0..23 # Frame 0
  200 5664 8000 6980 0 8000 4964 
  4964 0 8000 6000 6000 0 
  6000 4964 3968 0 6000 8000 
  6980 0 8000 6000 6000 0 frame_0..23 # Frame 1
500 delay
repeat

sub Sequence_2 #right
begin
  200 5664 6980 6980 0 3968 3968 
  4964 0 3968 8000 6980 0 
  6000 4964 4964 0 6000 6980 
  6980 0 3968 3968 3968 0 frame_0..23 # frame 0
  200 5664 8000 6980 0 3968 4964 
  4964 0 3968 6000 6000 0 
  6000 4964 3968 0 6000 8000 
  6980 0 3968 6000 6000 0 frame_0..23 # frame 1
500 delay
repeat

sub Sequence_3 #up
begin
  200 5664 3968 3968 0 6000 8000 
  8000 0 6000 3968 3968 0 
  6000 8000 8000 0 6000 3968 
  3968 0 6000 8000 8000 0 frame_0...23 
500 delay
repeat

sub Sequence_4  #down
begin
  200 5664 7000 7000 0 6000 4964 
  4964 0 6000 7000 7000 0 
  6000 4964 4964 0 6000 7000 
  7000 0 6000 4964 4964 0 frame_0...23 
500 delay
repeat

sub Sequence_5 #back
begin
  200 6820 5964 6982 0 6982 3968 
  4966 0 6000 6472 6000 0 
  6000 6000 5316 0 6982 5964 
  6982 0 6982 3968 4966 0 frame_0..23 # frame 0
  200 6820 5964 6982 0 6982 3968 
  4966 0 6000 6472 6000 0 
  6000 6000 5316 0 6982 5964 
  6982 0 6982 3968 4966 0 frame_0..23 # frame 3
  200 4461 8000 6980 0 4966 4962 
  4966 0 6960 5984 6492 0 
  6980 6000 4964 0 4946 8000 
  6982 0 4966 4966 4966 0 frame_0..23 # frame 2
  200 4461 8000 6982 0 4966 4966 
  4966 0 6000 6472 6000 0 
  6000 6000 5316 0 4946 8000 
  6982 0 4966 4966 4966 0 frame_0..23 # frame 1
500 delay
Repeat

Hello.

The Maestro can be controlled from the Raspberry Pi either through the USB or TTL Serial interface. To tell the Maestro to run a specific subroutine, you can use the “Restart script at subroutine” command. You can find details about this command in the “Serial Script Commands” section of the Maestro user’s guide.

Can you clarify what you are trying to do and what all you are using? You mentioned wanting to control the Maestro wirelessly, but you also talk about some kind of USB device, a Bluetooth controller, and controlling it from a Raspberry Pi. What devices are you using and how are you trying to use them together?

Brandon