Programming Robotics 101
What is robotics?
Robotics is the art of combining engineering & computer science; but also other disciplines in order to design, construct and use machines to complete tasks.
Robotics can be as simple as putting a motor on something like a toothbrush, to a dog.
How does robotics work?
Robots == computers, but why:
Input quantified by sensory detectors -> input is processed by designed logic -> output functions
The reading of sensors is done through software designed for processing data.
Depending on the software and sensory input type, different approaches may need to be taken for the processing of sensor readings.
A big challenge in robotics is a robot is only as good as its sensors.
What do you need for robotics?
- A microcontroller
- Raspberry Pi — A single-board computer
- A Robot Operating System (ROS)
- Matlab — Used for data analytics, used in conjunction with ROS
What language should you learn?
The programming language depends on what the robot needs to accomplish.
The most popular languages for robotics is:
- C/ C++
- Industrial Robot Languages
C and C++ are some of the popular choices for robotics; due to the ability to produce real-time results. It is more difficult than some other languages. C++ is the more popular choice due to having more functionality.
<Sample code for C++ — driving a robot using a joystick>
Python is also a popular choice. The reason being its capabilities with artificial intelligence.
<A sample python code for making a machine go forward and backwards>
How to start programming:
- Decide the logic of the program utilizing pseudo-code
- Let’s move with Arduino (-or use a simulator)
Download the Arduino IDE
- Open up the IDE then configure board & port
- Let’s make a simple led light blink:
- Complex programs can use different loops
- Click the upload button
The Arduino language may seem simple but the format is similar to most programs.
The Arduino IDE even creates the setup and loop function for you when you start a new file.
For more Arduino functions you can check out the Arduino’s library for more functions.