Domain Error on Robotics System Toolbox

1 visualización (últimos 30 días)
Daniel Jacobs
Daniel Jacobs el 1 de Abr. de 2019
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');
% Add Gravity
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];
% Add Body 1
addBody(RR_robot,body1,'base')
% 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];
% Add Body 2
addBody(RR_robot, body2, 'body1')
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 comentario
Lasitha Weerakoon
Lasitha Weerakoon el 8 de Jun. de 2019
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

Iniciar sesión para comentar.

Respuestas (1)

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

Categorías

Más información sobre Robotics en Help Center y File Exchange.

Productos


Versión

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by