cancel
Showing results for 
Search instead for 
Did you mean: 

Quadcopter Simulation with Matlab and NX

Experimenter
Experimenter

Hello, 

 

Looking to run this code:

% load PlantIO.m

motion_1_Solution_1_PlantIO;

%One process

nx_client;


%Remove comments to initialize plant to auto-load workspace variables

set_param(gcb, 'MaskInitialization', 'motion_1_Solution_1_PlantIO' );

//

 

Motion_1_Solution_1_PlantIO.m:

% the directory where the cosimulation files are installed
addpath('C:\Program Files\Siemens\NX 10.0\mech\cosim');

% the directory where the application to launch the client is installed.
NXMotion='C:\Program Files\Siemens\NX 10.0\ugii\';

% the directory where the model file exists.
NXMotion_model='C:\Users\100486826\Desktop\Y5S2\capstone\New folder\Final-CAD-New\Final CAD\Scaled Frame Build';
%C:\Users\100486826\Desktop\Y5S2\capstone\New folder\Final-CAD-New\Final CAD\Scaled Frame Build
%C:\Users\100485599\Desktop\Final CAD\Scaled Frame Build\motion_1.sim
NXMotion_solution='Solution_1';

% the size of NXMotion solution name
r_temp___=size(NXMotion_solution);
NXMotion_solution_n=r_temp___(2);
% the size of the directory of the application
r_temp___=size(NXMotion);
NXMotion_n=r_temp___(2);
% the size of the full path of the model
r_temp___=size(NXMotion_model);
NXMotion_model_n=r_temp___(2);
if(exist(NXMotion_model))
NXMotion_inputs = 'Torque_1!Torque_2!Torque_3!Torque_Prop4!Torque_5!Torque_6!Torque_7!Torque_8';

NXMotion_outputs = 'Propeller_1_Output!Prop_2_output!Prop_3_output!Prop_4_output!Shaft_1_output!Shaft_2_Output!Shaft_3_output!Shaft_4_output';

NXMotion_io_ids = [ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ];

NXMotion_controltimestep = 0.001;

Plant_inputs = Rearrange_io( NXMotion_inputs );

Plant_outputs = Rearrange_io( NXMotion_outputs );

r_temp___=size(Plant_inputs);

Plant_inputs_num=r_temp___(1);

r_temp___=size(Plant_outputs);

Plant_outputs_num=r_temp___(1);

r_temp___=version;

Matlab_version =str2double(r_temp___(1));

disp('');

disp('===== NXMotion & Matlab/SIMULINK ==========');

disp('%%% INFO : NXMotion plant actuators names :');

disp([int2str(1:size(Plant_inputs,1)),blanks(size(Plant_inputs,1))',Plant_inputs]);

disp('%%% INFO : NXMotion plant sensors names :');

disp([int2str(1:size(Plant_outputs,1)),blanks(size(Plant_outputs,1))',Plant_outputs]);

disp( '=============================================' ) ;

disp( ' ' ) ;

 

else

disp('');

disp('%%% ERROR : missing NXMotion plant model file !!!');

disp('');

end

clear r_temp___;

 

Getting the following error--anyone knows what could be the issue( I looked into horzcat but couldn't really figure it out...any help will be much appreciated )

 

Thank you for your reply.

Regards,

Rohit (rohitg@live.ca) Error.PNG