centerOfMass

Center of mass position and Jacobian

Description

example

com= centerOfMass(robot)computes the center of mass position of the robot model at its home configuration, relative to the base frame.

com= centerOfMass(robot,configuration)computes the center of mass position of the robot model at the specified joint configuration, relative to the base frame.

[com,comJac] = centerOfMass(robot,configuration)also returns the center of mass Jacobian, which relates the center of mass velocity to the joint velocities.

Examples

collapse all

Load a predefined KUKA LBR robot model, which is specified as aRigidBodyTreeobject.

loadexampleRobots.matlbr

Set the data format to'row'. For all dynamics calculations, the data format must be either'row'or'column'.

lbr.DataFormat ='row';

Compute the center of mass position and Jacobian at the home configuration of the robot.

[comLocation,comJac] = centerOfMass(lbr);

Input Arguments

collapse all

Robot model, specified as arigidBodyTreeobject. To use thecenterOfMassfunction, set theDataFormatproperty 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 usinghomeConfiguration(robot),randomConfiguration(robot), or by specifying your own joint positions. To use the vector form ofconfiguration, set theDataFormatproperty for therobotto either'row'or'column'.

Output Arguments

collapse all

Center of mass location, returned as an[x y z]vector. The vector describes the location of the center of mass for the specifiedconfigurationrelative to the body frame, in meters.

Center of mass Jacobian, returned as a 3-by-nmatrix, wherenis the robot velocity degrees of freedom.

Introduced in R2017a