Robot Programming

What Is Robot Programming?

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:

  • Enabling the robot to perceive the environment by using computer vision and deep learning algorithms for object detection, classification and tracking, and motion estimation
  • Enabling robot autonomy through algorithms for simultaneous localization and mapping (SLAM), collision avoidance, and motion 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 CPUs, GPUs, FPGAs, 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 robot operating system (ROS) is used for hardware abstraction, low-level device control, message-passing between processes, and hardware deployment.

A common robot programming workflow.

A common robot programming workflow.

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 ROS blocks to publish and subscribe messages in Simulink.

Using ROS blocks to publish and subscribe messages in Simulink. See example.

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 Toolbox™, Navigation Toolbox™, ROS ToolboxMATLAB, and Simulink.


Robot Programming Software Reference

See also: robotics and autonomous systems, mechatronics, Simscape Multibody, Control System Toolbox, Stateflow, Automated Driving Toolbox, Computer Vision Toolbox, Embedded Coder, MATLAB Coder, Simulink Coder, PID control, inverse kinematics, cloud robotics, Path Planning, Inertial Navigation System