Text Overlay icon Text Overlay — Overlay a variable on a processed camera image at X/Y coordinates; name the variable and attach to a specific or any available camera Try it →
 

Servo

Move servos and read them. Positions normally run from 1 to 180, kept inside each servo's minimum and maximum limits. Velocity sets how fast a servo moves to its next position and acceleration how gently it starts; release lets a servo go limp. Servos on an EZB's d0 to d23 ports and virtual ports v0 and up (used by servo driver robot skills such as Dynamixel) are moved the same way.

Where to find it: type Servo. in a Python script, or open the ARCx API view of the script editor and expand Servo


Commands

Command What it does
Servo.Decrement Moves a servo down by a number of positions from the last position it was told to move to.
Servo.GetAcceleration Gets the last acceleration set for a servo.
Servo.GetFineTuneOffset Gets the fine tune offset of a servo, which is added to every position sent to it.
Servo.GetPosition Gets the last position a servo was told to move to.
Servo.GetPositionRealtime Asks a servo for its actual position, for servos that can report it (such as smart servos driven by a robot skill).
Servo.GetVelocity Gets the last velocity (speed) set for a servo, where 0 is fastest.
Servo.Increment Moves a servo up by a number of positions from the last position it was told to move to.
Servo.IsReleased Checks whether a servo is released (not holding a position).
Servo.Release Releases a servo so it stops holding its position and goes limp.
Servo.ReleaseAll Releases every servo on the first EZB, including virtual ones, so they stop holding their positions and go limp.
Servo.SetAcceleration Sets how quickly a servo speeds up and slows down, for servo drivers that support it (such as smart servo robot skills).
Servo.SetFineTuneOffset Sets a fine tune offset for a servo, which is added to every position sent to it to correct small mounting errors.
Servo.SetMaxPositionLimit Sets the highest position a servo is allowed to go.
Servo.SetMinPositionLimit Sets the lowest position a servo is allowed to go.
Servo.SetPosition Moves a servo to a position.
Servo.SetPositionRandom Moves a servo to a random position from lowPosition to highPosition, both included, trying not to repeat the last random number.
Servo.SetVelocity Sets how fast a servo moves to its next positions.
Servo.WaitForMove Pauses the script until a servo is told to move to a different position than it had when this was called, checking every 100 ms.
Servo.WaitForPositionEquals Pauses the script until a servo's last commanded position equals the given position, checking every 100 ms.
Servo.WaitForPositionHigher Pauses the script until a servo's last commanded position is higher than the given position, checking every 100 ms.
Servo.WaitForPositionLower Pauses the script until a servo's last commanded position is lower than the given position, checking every 100 ms.

Details

Servo.Decrement

Moves a servo down by a number of positions from the last position it was told to move to. The move is kept inside the servo's limits and the script does not wait for it to arrive.

Servo.Decrement(port, count)
Servo.Decrement(port, count, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
count int How many positions to subtract, such as 5.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Gives back: int. The position that was asked for, before the servo's limits are applied.

Servo.GetAcceleration

Gets the last acceleration set for a servo.

Servo.GetAcceleration(port)
Servo.GetAcceleration(port, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Gives back: int. The last acceleration set, or -1 if none has been set since the EZB connected.

Servo.GetFineTuneOffset

Gets the fine tune offset of a servo, which is added to every position sent to it.

Servo.GetFineTuneOffset(port)
Servo.GetFineTuneOffset(port, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Gives back: int. The fine tune offset, or 0 when none is set.

Servo.GetPosition

Gets the last position a servo was told to move to. This is remembered by ARCx, not read from the servo, so it is 0 if the servo has not been moved since the EZB connected.

Servo.GetPosition(port)
Servo.GetPosition(port, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Gives back: int. The last position the servo was moved to, or 0 if it has not been moved yet.

Servo.GetPositionRealtime

Asks a servo for its actual position, for servos that can report it (such as smart servos driven by a robot skill). Other servos give the last position they were told to move to.

Servo.GetPositionRealtime(port)
Servo.GetPositionRealtime(port, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Gives back: int. The servo's actual position, or its last commanded position when it cannot be read.

Servo.GetVelocity

Gets the last velocity (speed) set for a servo, where 0 is fastest.

Servo.GetVelocity(port)
Servo.GetVelocity(port, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Gives back: int. The last velocity set, or -1 if none has been set since the EZB connected.

Servo.Increment

Moves a servo up by a number of positions from the last position it was told to move to. The move is kept inside the servo's limits and the script does not wait for it to arrive.

Servo.Increment(port, count)
Servo.Increment(port, count, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
count int How many positions to add, such as 5.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Gives back: int. The position that was asked for, before the servo's limits are applied.

Servo.IsReleased

Checks whether a servo is released (not holding a position). Servos start released when the EZB connects and stop being released once they are moved.

Servo.IsReleased(port)
Servo.IsReleased(port, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Gives back: bool. Whether the servo is released.

Servo.Release

Releases a servo so it stops holding its position and goes limp. Moving it again makes it hold its position again.

Servo.Release(port)
Servo.Release(port, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Servo.ReleaseAll

Releases every servo on the first EZB, including virtual ones, so they stop holding their positions and go limp.

Servo.ReleaseAll()
Servo.ReleaseAll(ezbIndex)
Value Type What it is
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Servo.SetAcceleration

Sets how quickly a servo speeds up and slows down, for servo drivers that support it (such as smart servo robot skills). Standard servos on an EZB's d0 to d23 ports ignore it.

Servo.SetAcceleration(port, acceleration)
Servo.SetAcceleration(port, acceleration, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
acceleration int The acceleration; its range depends on the servo driver, and -1 is ignored.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Servo.SetFineTuneOffset

Sets a fine tune offset for a servo, which is added to every position sent to it to correct small mounting errors. Does not move the servo; it takes effect on the next move.

Servo.SetFineTuneOffset(port, offset)
Servo.SetFineTuneOffset(port, offset, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
offset int How many positions to shift by, negative or positive, such as -3 or 2.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Servo.SetMaxPositionLimit

Sets the highest position a servo is allowed to go. Later moves above it stop at this limit; the servo is not moved now.

Servo.SetMaxPositionLimit(port, position)
Servo.SetMaxPositionLimit(port, position, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
position int The highest allowed position, such as 150.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Servo.SetMinPositionLimit

Sets the lowest position a servo is allowed to go. Later moves below it stop at this limit; the servo is not moved now.

Servo.SetMinPositionLimit(port, position)
Servo.SetMinPositionLimit(port, position, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
position int The lowest allowed position, such as 30.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Servo.SetPosition

Moves a servo to a position. The script carries on straight away without waiting for the servo to arrive, and the position is kept inside the servo's min and max limits.

Servo.SetPosition(port, position)
Servo.SetPosition(port, position, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
position int The position to move to, normally 1 to 180 (the project's max servo position).
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Servo.SetPositionRandom

Moves a servo to a random position from lowPosition to highPosition, both included, trying not to repeat the last random number. The script does not wait for the servo to arrive.

Servo.SetPositionRandom(servo, lowPosition, highPosition)
Servo.SetPositionRandom(servo, lowPosition, highPosition, ezbIndex)
Value Type What it is
servo int The servo port, such as d0 or v0.
lowPosition int The lowest position that can be chosen.
highPosition int The highest position that can be chosen.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Gives back: int. The random position that was chosen.

Servo.SetVelocity

Sets how fast a servo moves to its next positions. For servos on an EZB's d0 to d23 ports, 0 is fastest and 20 is slowest; other servo types pass the value to their own driver.

Servo.SetVelocity(port, velocity)
Servo.SetVelocity(port, velocity, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
velocity int The speed, 0 being fastest; 0 to 20 for servos on d0 to d23, and -1 is ignored.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Servo.WaitForMove

Pauses the script until a servo is told to move to a different position than it had when this was called, checking every 100 ms.

Servo.WaitForMove(port)
Servo.WaitForMove(port, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Gives back: int. The servo's new position, or -1 if the script was stopped while waiting.

Servo.WaitForPositionEquals

Pauses the script until a servo's last commanded position equals the given position, checking every 100 ms. Also returns if the script is stopped while waiting.

Servo.WaitForPositionEquals(port, position)
Servo.WaitForPositionEquals(port, position, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
position int The position to wait for.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Servo.WaitForPositionHigher

Pauses the script until a servo's last commanded position is higher than the given position, checking every 100 ms. It watches the position servos are told to go to, not a reading from the servo.

Servo.WaitForPositionHigher(port, position)
Servo.WaitForPositionHigher(port, position, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
position int The position the servo has to go above.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Gives back: int. The servo's position once it is higher, or -1 if the script was stopped while waiting.

Servo.WaitForPositionLower

Pauses the script until a servo's last commanded position is lower than the given position, checking every 100 ms. It watches the position servos are told to go to, not a reading from the servo.

Servo.WaitForPositionLower(port, position)
Servo.WaitForPositionLower(port, position, ezbIndex)
Value Type What it is
port int The servo port, such as d0 or v0.
position int The position the servo has to go below.
ezbIndex int Optional. Which EZB to use, 0 being the first one.

Gives back: int. The servo's position once it is lower, or -1 if the script was stopped while waiting.