About the CenterOfMass property of rigidBodyTree

3 ビュー (過去 30 日間)
Yi Liu
Yi Liu 2023 年 10 月 28 日
回答済み: Aman 2024 年 8 月 20 日
The CenterOfMass property in the rigidBodyTree class seems to not work. The code is as follows
clear;
load exampleRobots.mat
% Set lbr robot dynamics input data format to 'column'
lbr.DataFormat = 'column';
lbr.Gravity=[0 0 -9.80665];
% Generate a random configuration for lbr
q = [0 0 0 0 0 0 0]';
dq = [0 0 0 0 0 0 0]';
ddq = [0.1 0 0 0 0 0 0]';
%
% Compute the required joint torques for lbr to
% statically hold that configuration
tau = inverseDynamics(lbr, q);
disp(tau);
lbr.Bodies{1}.CenterOfMass=[1000 0 0];
tau = inverseDynamics(lbr, q);
disp(tau);
No matter how I change the position of the center of mass, the moment always remains the same.It looks like the center of mass position or body mass is set to 0,
matlab version is 2022a.

回答 (1 件)

Aman
Aman 2024 年 8 月 20 日
Hi,
As per my understanding, you aren't seeing any change in the required joint torque even after changing the COM of a particular body.
This may happen if the body whose COM you change is not in a position where gravity or other forces significantly affect it; the joint torque might not change. You can refer to the below code where I have changed the COM of body 4, which is affecting the joint torque.
clear;
lbr = loadrobot("abbIrb120");
% Set lbr robot dynamics input data format to 'column'
lbr.DataFormat = 'column';
lbr.Gravity=[0 0 -9.80665];
% Generate a random configuration for lbr
q = [0 0 0 0 0 0 ]';
% Compute the required joint torques for lbr to
% statically hold that configuration
tau = inverseDynamics(lbr, q);
disp(tau);
0 -5.7190 -5.6891 0.0019 -0.0814 -0.0002
lbr.Bodies{1}.CenterOfMass=[1000 0 0];
tau = inverseDynamics(lbr, q);
disp(tau);
0 -5.7190 -5.6891 0.0019 -0.0814 -0.0002
lbr.Bodies{4}.CenterOfMass=[1000 0 0];
tau = inverseDynamics(lbr, q);
disp(tau);
1.0e+04 * 0 -2.8876 -2.8876 0.0000 -0.0000 -0.0000
Hope it helps!

カテゴリ

Help Center および File ExchangeManipulator Modeling についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by