Instructional Material: How do programming languages make robots work?

In the simple view, robots are mechanical devices controlled by embedded computers. Robots typically employ sensors, to obtain input about their environment and motors or other actuators that allow the robot to act in or alter that same environment. A necessary component of any robot will be a computer (also called a controller) which is running a program that takes the available input and translates it to an appropriate output. In a robot, output typically is physical action: moving a servo, spinning a motor, etc.

A computer in a robot is different than other computers in that the robot computer has hardware extensions that allow the computer to receive input from various hardware devices (like cameras, joysticks, encoders, touch sensors) and to control hardware devices (such as motors, servos, valves). A program on a PC is typically only looking at input from a keyboard or mouse (for instance) and deciding on an output which might be displaying characters on a screen. A program on a robot is typically looking at input from a joystick or environment sensor and deciding on a physical output, which might be setting a motor speed or opening a valve. The computer interacts with external hardware devices through reading or writing data to a port (or channel) which represents the actual physical connection (plugs and wires) between the controller computer and an external hardware device.

Typically any action a robot takes is the result of the instructions in the program running on the robot's controller responding to external stimuli. In order for a robot to complete its intended function, a programmer had to study the robots intended function and its physical (hardware) design and write the source code that maps all possible inputs to the appropriate outputs, enabling the robot to perform the intended function. A robot cannot function without a program to tell it what to do.

Normally when you program a computer, you will write your program and compile it on the same type of computer on which your program will execute. For instance, when developing for Windows, you will do your programming on a Windows computer and run the resulting program on a Windows computer. Programming robots is different because you will typically develop your program on a different computer than it will be executed on. For your robotics work you will most likely develop your program on a Windows PC and then transfer the program file to a robot's controller (deploying). When you run your robot program on the EV3, Tetrix or RoboRio platform, your program is actually running on a form of Linux. It is good to keep this concept in mind when programming robots, but the Java language has specific features that minimize this as a concern. We will discuss this a bit later.

 

Material Type: 
Lecture/Presentation
Education Level: 
Middle School
High School
Focus Subject: 
Computing / Computer Science
Robotics Hardware
Robotics Software
HW Platform: 
EV3
RoboRIO
Tetrix
SW Platform: 
Java
Interactivity Style: 
Mixed
Audience: 
Learner