Main Content

gravityTorque

Joint torques that compensate gravity

Description

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

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

example

Examples

collapse all

Load a Techman™ TM12 from the Robotics System Toolbox™ loadrobot. The robot is specified as a rigidBodyTree object.

robot = loadrobot("tm12");

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

robot.DataFormat = "row"; 
robot.Gravity = [0 0 -9.81];

Get a random configuration for the robot.

q = randomConfiguration(robot);

Compute the gravity-compensating torques for each joint.

gtau = gravityTorque(robot,q)
gtau = 1×6

    0.0000   60.4466   16.4834   -2.2469    0.6922         0

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.

More About

collapse all

References

[1] Featherstone, Roy. Rigid Body Dynamics Algorithms. Springer US, 2008. DOI.org (Crossref), doi:10.1007/978-1-4899-7560-7.

Extended Capabilities

expand all

Version History

Introduced in R2017a

expand all