# Domain Error on Robotics System Toolbox

1 回表示 (過去 30 日間)
Daniel Jacobs 2019 年 4 月 1 日
I am trying to animate a simplar planar RR robot. The robot correctly finds the accelerations with the forward dynamics function in Matlab but the forward dynamics block in simulink returns the domain error.
Domain error. To compute complex results from real x, use 'sqrt(complex(x))'
A previous answer pointed to potential problems in requests to inverse trig functions (i.e. arccos and arcsin). Unfortunately, this code is part of the toolbox and is not modified by me.
My simple script for creating the robot is:
RR_robot = robotics.RigidBodyTree('DataFormat', 'Column');
RR_robot.Gravity = [0,-9.81, 0];
% Create body and add joint transform
body1 = robotics.RigidBody('body1');
jnt1 = robotics.Joint('jnt1','revolute');
jnt1.HomePosition = 0;
L1 = 1;
setFixedTransform(jnt1,[L1 0 0 0],'dh');
body1.Joint = jnt1;
% Set Mass and Inertia
body1.Mass = 1;
body1.CenterOfMass = [-L1/2 0 0];
body1.Inertia = 0.0001*[4 4 4 0 0 0];
% Create body and add joint transform
body2 = robotics.RigidBody('body2');
jnt2 = robotics.Joint('R2', 'revolute');
jnt.HomePosition = 0;
L2 = 1;
setFixedTransform(jnt2, [L2, 0, 0, 0], 'dh');
body2.Joint = jnt2;
% Set Mass and Inertia
body2.Mass = 2;
body2.CenterOfMass = [-L2/2 0 0];
body2.Inertia = 0.0001*[4 4 4 0 0 0];
forwardDynamics(RR_robot)
The forward dynamics returns [ -9.8120; 4.8991].
The robot is put into the simulink version of forward dynamics. The block asks for Nx1 vectors for config, joint vel and joint torque. They are all 2x1 arrays of zeros. Fext is the proper 6x2 of zeros.
Thanks
##### 1 件のコメント-1 件の古いコメントを表示-1 件の古いコメントを非表示
Lasitha Weerakoon 2019 年 6 月 8 日
Hi,
I also had the same problem. I figured out that the inertia defined for the robot links are the culprits for this issue. Wonder whether you got around this problem?
Thanks

サインインしてコメントする。

### 回答 (1 件)

Note this issue was fixed in R2019a - please update/install the R2019a and this issue with the block should be resolved.

サインインしてコメントする。

### カテゴリ

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

R2018b

### Community Treasure Hunt

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

Start Hunting!

Translated by