Robot API Robot Control Apps

API is a programming term that means 'Application Programming Interface'. It is the details of what commands to call (in this case) to drive the robot.

Robot API

The Robot API allows Robot Controller Apps to be run from ANY coding environment that supports a third-party web call (http). Programming an App using Java, Javascript, Python, C++, and more are all possible. However, the simplest way to get started is to use Code.org to develop your Robot Controller App using the Code.org App Lab (Which uses Javascript and also offers a block programming environment.)

A Sample App can be imported into a free Code.org account to quickly get started.

Code.org and the Sample App

If you are using the Code.org and the Sample App, then a Robot Command (described below) means calling the built-in function defined in the App as runRobotCommand which will send the Robot Instructions defined in the variable robotCommand to the Robots.

For example, the following line in the Code.org Sample App will cause the robot to move forward full speed for 3 seconds:

robotCommand = "FWD-255-3000"
runRobotCommand()

Robot Instructions

The following table outlines the available Robot Instructions to be used to control the robot's motion.

Note that XXX below refers to SPEED and must be between 0 (stopped) and 255 (full speed). YYY is the time for the motor to be on (in milliseconds, so 1000 is 1 seconds)

Motor CommandDescription
FWD-XXX-YYYGo Foward
BACK-XXX-YYYGo Back
TURNL-XXX-YYYTurn Left
TURNR-XXX-YYYTurn Right
TURNFWDL-XXX-YYYTurn Left (While Moving Forward)
TURNFWDR-XXX-YYYTurn Right (While Moving Forward)

Robot Commands

Participants are able to send one or more Robot Instructions with each Robot Command.

Depending on the Challenge Mode and Win Condition for a given challenge, it can be very advantageous to send multiple instructions in one command. For example, some challenges may be run where the winning team is the team that completes the challenge in the least number of commands (as opposed to the first who completes the challenge).

To send multiple Robot Instructions in one Robot Command, separate each instruction with a comma.

For example, the following Robot Command tells the Robot to perform a 'U-turn' by sending multiple instructions (5 in this case).

FWD-255-1000,TURNR-150-4000,FWD-255-1000,TURNR-150-4000,FWD-255-1000

Robot Instruction Calibration

These values are only examples and depend on the Robot Hardware and may need to be reviewed to determine appropriate values for the robots being used.
ExampleHow far robot moves
FWD-255-100017 cm forward
BACK-255-100017 cm backward
TURNL-150-4000Turns in place about 90 degrees
TURNR-150-4000Turns in place about 90 degrees
TURNFWDL-200-500
TURNFWDR-200-500
Edit this page on GitHub Updated at Wed, Feb 16, 2022