Robot programming involves writing computer programs that enable a robot to perceive its environment, make plans and decisions, and execute tasks. For example, programming a ground robot to navigate autonomously inside a building requires sensing and perception, localization and mapping, path planning and path following, actuator controls, and other tasks. Robot programming generally involves:
When starting with robot programming, engineers often develop a state machine diagram of the robot’s intended behavior. Further, programming languages such as C/C++, Python®, Java®, and MATLAB® are used for algorithm development, and middleware such as robot operating system (ROS) is used for hardware abstraction, low-level device control, message-passing between processes, and hardware deployment.
An error in one step can often affect the entire robot programming workflow. Modeling and simulation in software help to eliminate the implementation errors by identifying problems during prototyping instead of when robots are being produced or, even worse, in use in the real-world environment. Simulating the system also helps engineers refine the system design by tuning control parameters, without worrying about platform dependencies or having access to robot hardware.
MATLAB provides several built-in algorithms and functions for robot programming. For example, with just a few lines of out-of-the-box deep learning algorithms in MATLAB, robots can identify objects in the environment. Simulink® provides prebuilt blocks for using modeling and simulation with Model-Based Design for robot programming. The ROS blocks in Simulink, for example, enable robot programmers to subscribe to sensor data and publish robot commands over a ROS network without writing code.
Using MATLAB and Simulink for robot programming, you can build a scalable robot simulation to prototype, test concept models, and debug inexpensively. Then you can use the high-fidelity models for validation while keeping the rest of the algorithms in the same simulation environment. Once the desired result is obtained in the robot simulation, you can generate standalone executable code for the embedded system from the Simulink model in common programming languages.
Using the ROS connectivity from MATLAB and Simulink to a ROS network, you can generate C++ ROS nodes directly from MATLAB and Simulink to test and verify applications on ROS-enabled robots and robot simulators such as Gazebo. For more details about robot programming, see Robotics System Toobox™, Navigation Toolbox™, ROS Toolbox, MATLAB, and Simulink.