Programming is a set of instructions that the computer follows to control a process. For example, a recipe is a ‘program’ for cooking something. If you have all the proper ingredients and equipment, then follow the recipe’s instructions, you should get an edible treat.
In robotics, programming is what controls the robot. There are two parts to programming a robot for a FIRST competition. There is an autonomous part where actions are completely done by the robot without any assistance or input from drivers. Then there is the tele-operated part, where driver’s use a control board to send signals by radio to the robot to direct its actions. Both autonomous and tele-op require programs.
Programs interact with or control the physical parts of the robot. Programs send output signals to switches to turn parts on or off or may increase or decrease power to a motor to change speeds. Programs also read input signals. Input comes from sensors that look for a specific condition. For example a rotation sensor can read how many turns a wheel takes. That value can be compared to a value in the program and when it matches an action could be started or stopped. This is one way to make the robot travel a specific distance. Tele-op uses input from the radio connection to the driver controllers to initiate programs that control the robots actions.
Programs follow what is called a logic path. It can be a straight or sequential path, or it may divide or even loop in a circle. One way a program path divides is to use a true/false statement. This is where the program looks for a specified condition (like the value from a sensor). If the condition matches the one looked for then it is ‘true’ and the program continues on the ‘true’ path. If it does not match, then the program continues on the ‘false’ path. When logic paths circle, it is called a loop, or while loop. This is when a set of commands is repeated until a condition is met, then it continues.
Some programs are based on a special ‘language’ or set of commands, like C+ or Basic. Some programs are graphical and use picture symbols to represent the objects it is controlling, like LabVIEW.
Example of LabVIEW program.
- A primitive data type having one of two values: true or false.
- A specific task the robot will have to follow.
- Actions occurring apparently simultaneously.
- A feature which performs different computations or actions depending on whether a programmer-specified boolean condition evaluates to true or false.
- A collection of facts from which conclusions may be drawn.
- if, then condition
- The if statement allows you to control if a program enters a section of code or not based on whether a given condition is true or false.
- Something you put in to a system to get an output.
- logic path
- Steps followed according to the program.
- loop or while loop
- A repeated pattern of commands that the robot uses.
- The finished product or information when many inputs are recieved by a system.
- A device that acts like the senses of the robot: touch, sight, and hearing.
- Actions occuring step by step,completed in order.
- Similar data or commands arranged in order.
- true, false condition
- A way to split the logic path of a program. A value is checked and if it matches the programmed value the condition is true, if it does not match the condition is false. Different action is taken dependent on the programming for true or false values.
- A single piece of data. May be a number or string.
If you wish to experiment with programming concepts you can try this game: Robozzle