Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Model compile errors after using rigidBodyTree objects and functions

2 Ansichten (letzte 30 Tage)
lee c
lee c am 28 Dez. 2022
Geschlossen: lee c am 29 Dez. 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

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by