gravityTorque

Joint torques that compensate gravity

Description

gravTorq = gravityTorque(robot) computes the joint torques required to hold the robot at its home configuration.

example

gravTorq = gravityTorque(robot,configuration) specifies a joint configuration for calculating the gravity torque.

Examples

collapse all

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

load exampleRobots.mat lbr

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

lbr.DataFormat = 'row'; 
lbr.Gravity = [0 0 -9.81];

Get a random configuration for lbr.

q = randomConfiguration(lbr);

Compute the gravity-compensating torques for each joint.

gtau = gravityTorque(lbr,q);

Input Arguments

collapse all

Robot model, specified as a rigidBodyTree object. To use the gravityTorque 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

Gravity-compensating torque for each joint, returned as a vector.

Introduced in R2017a