This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Code Generation

Generate C/C++ code and MEX functions for algorithm acceleration and standalone ROS nodes

MATLAB® Coder™ generates standalone C/C++ code from Robotics System Toolbox™ functions and classes that have been enabled to support code generation. Using the toolbox with MATLAB Coder, you can generate ANSI-compliant C code or MEX functions.

Also, you can generate C++ code for a standalone ROS node from a Simulink® model. You can then transfer and run the generated C++ code in a Linux ROS environment, which is built and run independent of Simulink. See Generate a Standalone ROS Node from Simulink® for an example generating a standalone ROS node.

The listed functions, classes, and blocks support code generation with Robotics System Toolbox.


axang2quatConvert axis-angle rotation to quaternion
axang2rotmConvert axis-angle rotation to rotation matrix
axang2tformConvert axis-angle rotation to homogeneous transformation
eul2quatConvert Euler angles to quaternion
eul2rotmConvert Euler angles to rotation matrix
eul2tformConvert Euler angles to homogeneous transformation
quat2axangConvert quaternion to axis-angle rotation
quat2eulConvert quaternion to Euler angles
quat2rotmConvert quaternion to rotation matrix
quat2tformConvert quaternion to homogeneous transformation
rotm2axangConvert rotation matrix to axis-angle rotation
rotm2eulConvert rotation matrix to Euler angles
rotm2quatConvert rotation matrix to quaternion
rotm2tformConvert rotation matrix to homogeneous transformation
tform2axangConvert homogeneous transformation to axis-angle rotation
tform2eulExtract Euler angles from homogeneous transformation
tform2quatExtract quaternion from homogeneous transformation
tform2rotmExtract rotation matrix from homogeneous transformation
tform2trvecExtract translation vector from homogeneous transformation
angdiffDifference between two angles
cart2homConvert Cartesian coordinates to homogeneous coordinates
hom2cartConvert homogeneous coordinates to Cartesian coordinates
trvec2tformConvert translation vector to homogeneous transformation
transformScanTransform laser scan based on relative pose
lidarScanCreat object for storing 2-D lidar scan
matchScansEstimate pose between two laser scans


robotics.BinaryOccupancyGridCreate occupancy grid with binary values
robotics.InverseKinematicsCreate inverse kinematic solver
robotics.GeneralizedInverseKinematicsCreate multiconstraint inverse kinematics solver
robotics.OccupancyGridCreate occupancy grid with probabilistic values
robotics.PurePursuitCreate controller to follow set of waypoints
robotics.PRMCreate probabilistic roadmap path planner
robotics.RigidBodyTreeCreate tree-structured robot
robotics.VectorFieldHistogramAvoid obstacles using vector field histogram


Blank MessageCreate blank message using specified message type
Get ParameterGet values from ROS parameter server
PublishSend messages to ROS network
Pure PursuitLinear and angular velocity control commands
Set ParameterSet values on ROS parameter server
SubscribeReceive messages from ROS network
Vector Field HistogramAvoid obstacles using vector field histogram


Generate a Standalone ROS Node from Simulink®

This example shows you how to generate and build a standalone ROS node from a Simulink model.

Accelerate Robotics Algorithms with Code Generation

You can generate code for select Robotics System Toolbox algorithms to speed up their execution.

Generate Code to Manually Deploy a ROS Node from Simulink

This example shows you how to generate C++ code from a Simulink model to deploy as a standalone ROS node.

Enable External Mode for Robotics System Toolbox Models

External mode enables Simulink on your host computer to communicate with a deployed model on your robotics hardware during runtime.

Tune Parameters and View Signals on Deployed Robot Models Using External Mode

External mode enables Simulink models on your host computer to communicate with a deployed model on your robot hardware during runtime.

Code Generation from MATLAB Code

Several Robotics System Toolbox functions are enabled to generate C/C++ code.

Code Generation Support, Usage Notes and Limitations

To generate code from MATLAB code that contains Robotics System Toolbox functions, classes, or System objects, you must have the MATLAB Coder software.

Was this topic helpful?