Movement
Drive the robot through whichever movement panel robot skill the project has, such as a continuous rotation servo panel, an H-bridge panel or a robot's own driver. Movements keep going until another movement or a stop, so a script can start the robot driving and carry on. Speeds run from 0 (stopped) to 255 (full speed). The wait commands pause until something, such as a joystick or another script, moves the robot that way.
Where to find it: type Movement. in a JavaScript script, or open the ARCx API view of the script editor and expand Movement
Commands
| Command | What it does |
|---|---|
| Movement.down | Makes a flying robot, such as a drone, go down through the project's movement panel. |
| Movement.forward | Drives the robot forward at the current speed through the project's movement panel. |
| Movement.fromString | Moves the robot in the direction named by the text: forward, reverse, left, right or stop, in any capitalisation, at the current speed. |
| Movement.getSpeed | Gets the robot's movement speed, from 0 (stopped) to 255 (full speed). |
| Movement.getSpeedLeft | Gets the speed of the left wheel that movements use, from 0 (stopped) to 255 (full speed). |
| Movement.getSpeedRight | Gets the speed of the right wheel that movements use, from 0 (stopped) to 255 (full speed). |
| Movement.land | Tells a flying robot, such as a drone, to land through the project's movement panel. |
| Movement.left | Turns the robot left at the current speed through the project's movement panel. |
| Movement.reverse | Drives the robot backward at the current speed through the project's movement panel. |
| Movement.right | Turns the robot right at the current speed through the project's movement panel. |
| Movement.rollLeft | Makes a flying robot, such as a drone, roll sideways to the left through the project's movement panel. |
| Movement.rollRight | Makes a flying robot, such as a drone, roll sideways to the right through the project's movement panel. |
| Movement.setSpeed | Sets the speed of both wheels, from 0 (stopped) to 255 (full speed). |
| Movement.setSpeedLeft | Sets the speed of the left wheel, from 0 (stopped) to 255 (full speed). |
| Movement.setSpeedRight | Sets the speed of the right wheel, from 0 (stopped) to 255 (full speed). |
| Movement.stop | Stops the robot's movement through the project's movement panel. |
| Movement.takeoff | Tells a flying robot, such as a drone, to take off through the project's movement panel. |
| Movement.up | Makes a flying robot, such as a drone, go up through the project's movement panel. |
| Movement.waitForDown | Pauses the script until the robot is moving down, checking every 100 ms. |
| Movement.waitForForward | Pauses the script until the robot is driving forward, checking every 100 ms. |
| Movement.waitForLeft | Pauses the script until the robot is turning left, checking every 100 ms. |
| Movement.waitForReverse | Pauses the script until the robot is driving backward, checking every 100 ms. |
| Movement.waitForRight | Pauses the script until the robot is turning right, checking every 100 ms. |
| Movement.waitForStop | Pauses the script until the robot is stopped, checking every 100 ms. |
| Movement.waitForUp | Pauses the script until the robot is moving up, checking every 100 ms. |
Details
Movement.down
Makes a flying robot, such as a drone, go down through the project's movement panel. It keeps going down until it is given another movement, and the script carries on straight away.
Movement.down()
Movement.forward
Drives the robot forward at the current speed through the project's movement panel. It keeps driving until it is given another movement, and the script carries on straight away.
Movement.forward()
Movement.forward(speed)
| Value | Type | What it is |
|---|---|---|
speed |
number | Optional. The speed for both wheels, 0 (stopped) to 255 (full speed). |
Movement.fromString
Moves the robot in the direction named by the text: forward, reverse, left, right or stop, in any capitalisation, at the current speed. Any other text is sent as a custom movement name for a movement panel that understands it.
Movement.fromString(movementString)
Movement.fromString(movementString, speed)
Movement.fromString(movementString, leftSpeed, rightSpeed)
| Value | Type | What it is |
|---|---|---|
movementString |
string | The direction, such as forward, reverse, left, right or stop, or a custom movement name. |
leftSpeed |
number | Only in some forms. The left wheel speed, 0 (stopped) to 255 (full speed). Ignored for stop. |
rightSpeed |
number | Only in some forms. The right wheel speed, 0 (stopped) to 255 (full speed). Ignored for stop. |
speed |
number | Only in some forms. The speed for both wheels, 0 (stopped) to 255 (full speed). Ignored for stop. |
Movement.fromString(movementString): Moves the robot in the direction named by the text: forward, reverse, left, right or stop, in any capitalisation, at the current speed. Any other text is sent as a custom movement name for a movement panel that understands it.Movement.fromString(movementString, speed): Moves the robot in the direction named by the text: forward, reverse, left, right or stop, in any capitalisation, with both wheels at the given speed, which also becomes the current speed. Any other text is sent as a custom movement name for a movement panel that understands it.Movement.fromString(movementString, leftSpeed, rightSpeed): Moves the robot in the direction named by the text: forward, reverse, left, right or stop, in any capitalisation, with separate left and right wheel speeds, which also become the current speeds. Any other text is sent as a custom movement name for a movement panel that understands it.
Movement.getSpeed
Gets the robot's movement speed, from 0 (stopped) to 255 (full speed). This is the left wheel's speed, which matches the right unless the wheels were given different speeds.
Movement.getSpeed()
Gives back: number. The speed, 0 to 255.
Movement.getSpeedLeft
Gets the speed of the left wheel that movements use, from 0 (stopped) to 255 (full speed).
Movement.getSpeedLeft()
Gives back: number. The left wheel speed, 0 to 255.
Movement.getSpeedRight
Gets the speed of the right wheel that movements use, from 0 (stopped) to 255 (full speed).
Movement.getSpeedRight()
Gives back: number. The right wheel speed, 0 to 255.
Movement.land
Tells a flying robot, such as a drone, to land through the project's movement panel. It has no effect without a movement panel that supports flying.
Movement.land()
Movement.left
Turns the robot left at the current speed through the project's movement panel. It keeps turning until it is given another movement, and the script carries on straight away.
Movement.left()
Movement.left(speed)
| Value | Type | What it is |
|---|---|---|
speed |
number | Optional. The speed for both wheels, 0 (stopped) to 255 (full speed). |
Movement.reverse
Drives the robot backward at the current speed through the project's movement panel. It keeps reversing until it is given another movement, and the script carries on straight away.
Movement.reverse()
Movement.reverse(speed)
| Value | Type | What it is |
|---|---|---|
speed |
number | Optional. The speed for both wheels, 0 (stopped) to 255 (full speed). |
Movement.right
Turns the robot right at the current speed through the project's movement panel. It keeps turning until it is given another movement, and the script carries on straight away.
Movement.right()
Movement.right(speed)
| Value | Type | What it is |
|---|---|---|
speed |
number | Optional. The speed for both wheels, 0 (stopped) to 255 (full speed). |
Movement.rollLeft
Makes a flying robot, such as a drone, roll sideways to the left through the project's movement panel. It keeps rolling until it is given another movement, and the script carries on straight away.
Movement.rollLeft()
Movement.rollRight
Makes a flying robot, such as a drone, roll sideways to the right through the project's movement panel. It keeps rolling until it is given another movement, and the script carries on straight away.
Movement.rollRight()
Movement.setSpeed
Sets the speed of both wheels, from 0 (stopped) to 255 (full speed). If the robot is driving forward, in reverse, left or right it changes straight away, otherwise it is kept for the next movement that does not give its own speed.
Movement.setSpeed(speed)
Movement.setSpeed(speedLeft, speedRight)
| Value | Type | What it is |
|---|---|---|
speedLeft |
number | Only in some forms. The left wheel speed, 0 to 255. |
speedRight |
number | Only in some forms. The right wheel speed, 0 to 255. |
speed |
number | Only in some forms. The speed for both wheels, 0 to 255. |
Movement.setSpeed(speed): Sets the speed of both wheels, from 0 (stopped) to 255 (full speed). If the robot is driving forward, in reverse, left or right it changes straight away, otherwise it is kept for the next movement that does not give its own speed.Movement.setSpeed(speedLeft, speedRight): Sets a separate speed for the left and right wheels, each from 0 (stopped) to 255 (full speed). If the robot is driving forward, in reverse, left or right it changes straight away, otherwise it is kept for the next movement that does not give its own speed.
Movement.setSpeedLeft
Sets the speed of the left wheel, from 0 (stopped) to 255 (full speed). If the robot is driving forward, in reverse, left or right it changes straight away, otherwise it is kept for the next movement that does not give its own speed.
Movement.setSpeedLeft(speed)
| Value | Type | What it is |
|---|---|---|
speed |
number | The left wheel speed, 0 to 255. |
Movement.setSpeedRight
Sets the speed of the right wheel, from 0 (stopped) to 255 (full speed). If the robot is driving forward, in reverse, left or right it changes straight away, otherwise it is kept for the next movement that does not give its own speed.
Movement.setSpeedRight(speed)
| Value | Type | What it is |
|---|---|---|
speed |
number | The right wheel speed, 0 to 255. |
Movement.stop
Stops the robot's movement through the project's movement panel.
Movement.stop()
Movement.takeoff
Tells a flying robot, such as a drone, to take off through the project's movement panel. It has no effect without a movement panel that supports flying.
Movement.takeoff()
Movement.up
Makes a flying robot, such as a drone, go up through the project's movement panel. It keeps going up until it is given another movement, and the script carries on straight away.
Movement.up()
Movement.waitForDown
Pauses the script until the robot is moving down, checking every 100 ms. Returns straight away if it already is, and gives up when the script is stopped.
Movement.waitForDown()
Movement.waitForForward
Pauses the script until the robot is driving forward, checking every 100 ms. Returns straight away if it already is, and gives up when the script is stopped.
Movement.waitForForward()
Movement.waitForLeft
Pauses the script until the robot is turning left, checking every 100 ms. Returns straight away if it already is, and gives up when the script is stopped.
Movement.waitForLeft()
Movement.waitForReverse
Pauses the script until the robot is driving backward, checking every 100 ms. Returns straight away if it already is, and gives up when the script is stopped.
Movement.waitForReverse()
Movement.waitForRight
Pauses the script until the robot is turning right, checking every 100 ms. Returns straight away if it already is, and gives up when the script is stopped.
Movement.waitForRight()
Movement.waitForStop
Pauses the script until the robot is stopped, checking every 100 ms. Returns straight away if it already is, and gives up when the script is stopped.
Movement.waitForStop()
Movement.waitForUp
Pauses the script until the robot is moving up, checking every 100 ms. Returns straight away if it already is, and gives up when the script is stopped.
Movement.waitForUp()