Robot Programming

Program robots in MATLAB and Simulink

Robot programming involves writing computer programs that enable a robot to perceive its environment, make decisions, and execute a task. For example, programming a ground robot to navigate autonomously inside a building requires sensor processing, localization and mapping, path planning and path following, actuator controls, and other tasks.

Robot programming generally involves:

  • Enabling the robot to perceive the environment by using computer vision and deep learning algorithms for object detection and motion estimation
  • Enabling robot autonomy through algorithms for simultaneous localization and mapping (SLAM), motion, and path planning
  • Controlling the robot’s behavior by designing control systems such as model predictive control, computed torque control, and path following
  • Communicating and interfacing with sensors and actuators connected with different embedded platforms such as CPU, GPU, FPGA, and microcontrollers

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 ROS is used for hardware abstraction, low-level device control, message-passing between processes, and hardware deployment.

A common robot programming workflow.

An error in one step can often affect the entire robot programming workflow. Modeling and simulation help to eliminate the implementation errors by identifying problems during prototyping instead of the production phase. 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, and Simulink® provides prebuilt blocks for modeling and simulation with Model-Based Design. Once the desired result is obtained in the simulation, standalone executable code for the embedded system can be generated from the Simulink model in common programming languages. Using the connection from MATLAB and Simulink to a ROS network, ROS nodes in C++ can be generated directly from MATLAB and Simulink to test and verify applications on ROS-enabled robots and robot simulators such as Gazebo.

For more details, see Robotics System Toolbox™, MATLAB, and Simulink.

See also: Robotics and autonomous systems, Robotics System Toolbox documentation, mechatronics, Simscape Multibody, Control System Toolbox, Stateflow, Automated Driving System Toolbox, Computer Vision System Toolbox, Embedded Coder, MATLAB Coder, Simulink Coder, PID control

Programming for Industrial Robotics