Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Model compile errors after using rigidBodyTree objects and functions

1 visualización (últimos 30 días)
lee c
lee c el 28 de Dic. de 2022
Cerrada: lee c el 29 de Dic. de 2022
Recently, I am using simulink to simulate a robot, and in order to compute the center of mass(com) of the robot, I use simscape to generate a rigidbodytree model and use 'writeAsFunction' function to make a m-file and the function works well.
Then, I use matlab function block in simulink to call it, but I get errors when I run the simulation, it seems to generate sfun, but I don't need sfun
These errors only happens after I use matlab function block to call these 'rigidbodytree' functions.
Could you please help me to find out why the simulation generate these errors?
Thanks a lot.
error pictures
The matlab function in simulink
function [angL,angR] = fcn(angHipL,angKneeL,angHipR,angKneeR)
persistent robot
if isempty(robot)
robot=wheelchairCodegen('row');
end
config=[angHipL angKneeL 0 0 angHipR angKneeR 0 0];
comLocation=centerOfMass(robot,config);
tform_wheel2baseL=getTransform(robot,config,'Body4','Base');
trVec_wheel2baseL=tform2trvec(tform_wheel2baseL);
vec_wheel2comL=trVec_wheel2baseL-comLocation;
tform_wheel2baseR=getTransform(robot,config,'Body8','Base');
trVec_wheel2baseR=tform2trvec(tform_wheel2baseR);
vec_wheel2comR=trVec_wheel2baseR-comLocation;
angL=atan2d(vec_wheel2comL(1),abs(vec_wheel2comL(3)));
angR=atan2d(vec_wheel2comR(1),abs(vec_wheel2comR(3)));
end

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by