Main Content

massMatrix

Joint-space mass matrix

Description

H = massMatrix(robot) returns the joint-space mass matrix of the home configuration of a robot.

H = massMatrix(robot,configuration) returns the mass matrix for a specified robot configuration.

example

Examples

collapse all

Load a model of the Boston Dynamics Atlas® humanoid robot from the Robotics System Toolbox™ loadrobot, returned as a rigidBodyTree object. Ensure that the data format is set to "row". For all dynamics calculations, the data format must be either "row" or "column".

atlas = loadrobot("atlas", DataFormat="row", Gravity=[0 0 -9.81]);

Generate a random configuration for atlas.

q = randomConfiguration(atlas);

Get the mass matrix at configuration q.

H = massMatrix(atlas,q)
H = 30×30

    5.9158   -1.2431    0.6367    0.4879   -0.5435    0.1373    0.1765   -0.0007   -0.0072   -0.0003   -0.0001    0.9609    0.3663   -0.0521   -0.3232   -0.0269    0.0011    0.0001         0         0         0         0         0         0         0         0         0         0         0         0
   -1.2431   20.9002    0.5109   -0.5926    0.8585    0.1457   -0.0027   -0.0003    0.0018   -0.0002   -0.0018   -0.0413    0.2023    0.0525    0.1088    0.0236    0.0108   -0.0005         0         0         0         0         0         0         0         0         0         0         0         0
    0.6367    0.5109   19.4204    0.2148    0.6959   -0.3081   -0.2676    0.0004    0.0074    0.0004    0.0000    0.0330    0.9184    0.0043   -0.3224   -0.0142    0.0250    0.0002         0         0         0         0         0         0         0         0         0         0         0         0
    0.4879   -0.5926    0.2148    0.2945   -0.0589    0.0975    0.0317   -0.0013    0.0032   -0.0003         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
   -0.5435    0.8585    0.6959   -0.0589    0.5987   -0.0512    0.0887    0.0014   -0.0112    0.0002         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
    0.1373    0.1457   -0.3081    0.0975   -0.0512    0.2033   -0.0008   -0.0010    0.0090   -0.0004         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
    0.1765   -0.0027   -0.2676    0.0317    0.0887   -0.0008    0.3040    0.0009   -0.0276   -0.0000         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
   -0.0007   -0.0003    0.0004   -0.0013    0.0014   -0.0010    0.0009    0.0038   -0.0000    0.0005         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
   -0.0072    0.0018    0.0074    0.0032   -0.0112    0.0090   -0.0276   -0.0000    0.0070   -0.0000         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
   -0.0003   -0.0002    0.0004   -0.0003    0.0002   -0.0004   -0.0000    0.0005   -0.0000    0.0005         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
   -0.0001   -0.0018    0.0000         0         0         0         0         0         0         0    0.0205         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0         0
    0.9609   -0.0413    0.0330         0         0         0         0         0         0         0         0    0.3891    0.0220   -0.0175   -0.1197   -0.0076    0.0005    0.0001         0         0         0         0         0         0         0         0         0         0         0         0
    0.3663    0.2023    0.9184         0         0         0         0         0         0         0         0    0.0220    1.5669    0.0228   -0.4281   -0.0139   -0.0027    0.0002         0         0         0         0         0         0         0         0         0         0         0         0
   -0.0521    0.0525    0.0043         0         0         0         0         0         0         0         0   -0.0175    0.0228    0.0229    0.0179    0.0111   -0.0004   -0.0001         0         0         0         0         0         0         0         0         0         0         0         0
   -0.3232    0.1088   -0.3224         0         0         0         0         0         0         0         0   -0.1197   -0.4281    0.0179    0.2497    0.0183    0.0024   -0.0004         0         0         0         0         0         0         0         0         0         0         0         0
      ⋮

show(atlas,q);

Figure contains an axes object. The axes object with xlabel X, ylabel Y contains 169 objects of type patch, line. These objects represent pelvis, ltorso, mtorso, utorso, l_clav, l_scap, l_uarm, l_larm, l_ufarm, l_lfarm, l_hand, l_hand_force_torque, l_situational_awareness_camera_link, l_situational_awareness_camera_optical_frame, head, center_bottom_led_frame, center_top_led_frame, left_camera_frame, left_camera_optical_frame, left_led_frame, pre_spindle, pre_spindle_cal_x, pre_spindle_cal_y, pre_spindle_cal_z, pre_spindle_cal_roll, pre_spindle_cal_pitch, pre_spindle_cal_yaw, post_spindle, post_spindle_cal_x, post_spindle_cal_y, post_spindle_cal_z, post_spindle_cal_roll, post_spindle_cal_pitch, hokuyo_link, head_hokuyo_frame, right_camera_frame, right_camera_optical_frame, right_led_frame, r_clav, r_scap, r_uarm, r_larm, r_ufarm, r_lfarm, r_hand, r_hand_force_torque, r_situational_awareness_camera_link, r_situational_awareness_camera_optical_frame, l_uglut, l_lglut, l_uleg, l_lleg, l_talus, l_foot, r_uglut, r_lglut, r_uleg, r_lleg, r_talus, r_foot, ltorso_mesh, mtorso_mesh, utorso_mesh, l_clav_mesh, l_scap_mesh, l_uarm_mesh, l_larm_mesh, l_ufarm_mesh, l_lfarm_mesh, l_hand_force_torque_mesh, l_situational_awareness_camera_link_mesh, head_mesh, hokuyo_link_mesh, r_clav_mesh, r_scap_mesh, r_uarm_mesh, r_larm_mesh, r_ufarm_mesh, r_lfarm_mesh, r_hand_force_torque_mesh, r_situational_awareness_camera_link_mesh, l_uglut_mesh, l_lglut_mesh, l_uleg_mesh, l_lleg_mesh, l_talus_mesh, l_foot_mesh, r_uglut_mesh, r_lglut_mesh, r_uleg_mesh, r_lleg_mesh, r_talus_mesh, r_foot_mesh, pelvis_mesh.

Input Arguments

collapse all

Robot model, specified as a rigidBodyTree object. To use the massMatrix function, set the DataFormat property to either 'row' or 'column'.

Robot configuration, specified as a vector with positions for all nonfixed joints in the robot model. You can generate a configuration using homeConfiguration(robot), randomConfiguration(robot), or by specifying your own joint positions. To use the vector form of configuration, set the DataFormat property for the robot to either 'row' or 'column'.

Output Arguments

collapse all

Mass matrix of the robot, returned as a positive-definite symmetric matrix with size n-by-n, where n is the velocity degrees of freedom of the robot.

More About

collapse all

Extended Capabilities

expand all

Version History

Introduced in R2017a

expand all