beautypg.com

Get errors, Go home, F. serial script commands – Pololu Maestro User Manual

Page 44: Stop script, Restart script at subroutine

background image

This command is used to determine whether the servo outputs have reached their targets or are still changing and will
return 1 as long as there is at least one servo that is limited by a speed or acceleration setting still moving. Using
this command together with the Set Target command, you can initiate several servo movements and wait for all the
movements to finish before moving on to the next step of your program.

Get Errors

Compact protocol: 0xA1
Pololu protocol: 0xAA, device number, 0x21
Response: error bits 0-7, error bits 8-15

Use this command to examine the errors that the Maestro has detected.

Section 4.b

lists the specific errors that can

be detected by the Maestro. The error register is sent as a two-byte response immediately after the command is
received, then all the error bits are cleared. For most applications using serial control, it is a good idea to check errors
continuously and take appropriate action if errors occur.

Go Home

Compact protocol: 0xA2
Pololu protocol: 0xAA, device number, 0x22

This command sends all servos and outputs to their home positions, just as if an error had occurred. For servos and
outputs set to “Ignore”, the position will be unchanged.

Note: For servos marked “Off”, if you execute a Set Target command immediately after Go Home,
it will appear that the servo is not obeying speed and acceleration limits. In fact, as soon as the servo
is turned off, the Maestro has no way of knowing where it is, so it will immediately move to any new
target. Subsequent target commands will function normally.

5.f. Serial Script Commands

The Maestro has several serial commands for controlling the execution of the user script.

Stop Script

Compact protocol: 0xA4
Pololu protocol: 0xAA, device number, 0x24

This command causes the script to stop, if it is currently running.

Restart Script at Subroutine

Compact protocol: 0xA7, subroutine number
Pololu protocol: 0xAA, device number, 0x27, subroutine number

This command starts the script running at a location specified by the subroutine number argument. The subroutines
are numbered in the order they are defined in your script, starting with 0 for the first subroutine. The first subroutine
is sent as 0x00 for this command, the second as 0x01, etc. To find the number for a particular subroutine, click
the “View Compiled Code…” button and look at the list below. Subroutines used this way should not end with the
RETURN command, since there is no place to return to — instead, they should contain infinite loops or end with a
QUIT command.

Pololu Maestro Servo Controller User's Guide

© 2001–2014 Pololu Corporation

5. Serial Interface

Page 44 of 73