Skip to content

Commit

Permalink
[DQ_VrepInterface.m] Fixed error messages of 'get_center_of_mass()', …
Browse files Browse the repository at this point in the history
…'get_mass()', and 'get_inertia_matrix()'.
  • Loading branch information
ffasilva committed Aug 29, 2024
1 parent 241d3dc commit c95ecf5
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions interfaces/vrep/DQ_VrepInterface.m
Original file line number Diff line number Diff line change
Expand Up @@ -803,8 +803,13 @@ function set_object_pose(obj,objectname,pose,reference_frame,opmode)
end

if(return_code ~= 0)
formatSpec = 'Script function `get_center_of_mass` returned with error code %i.\n';
fprintf(formatSpec, return_code);
if nargin <= 3
formatSpec = 'Script function `get_center_of_mass` returned with error code %i.\n';
fprintf(formatSpec, return_code);
else
formatSpec = 'Script function %s returned with error code %i.\n';
fprintf(formatSpec, function_name, return_code);
end
error('Failed calling script function!');
else % ensure cast to double
center_of_mass = double(center_of_mass);
Expand Down Expand Up @@ -849,8 +854,13 @@ function set_object_pose(obj,objectname,pose,reference_frame,opmode)
end

if(return_code ~= 0)
formatSpec = 'Script function %s returned with error code %i.\n';
fprintf(formatSpec, function_name, return_code);
if nargin == 2
formatSpec = 'Script function `get_mass` returned with error code %i.\n';
fprintf(formatSpec, return_code);
else
formatSpec = 'Script function %s returned with error code %i.\n';
fprintf(formatSpec, function_name, return_code);
end
error('Failed calling script function!');
else % ensure cast to double
mass = double(mass);
Expand Down Expand Up @@ -913,8 +923,13 @@ function set_object_pose(obj,objectname,pose,reference_frame,opmode)
end

if(return_code ~= 0)
formatSpec = 'Script function %s returned with error code %i.\n';
fprintf(formatSpec, function_name, return_code);
if nargin <= 3
formatSpec = 'Script function `get_inertia` returned with error code %i.\n';
fprintf(formatSpec, return_code);
else
formatSpec = 'Script function %s returned with error code %i.\n';
fprintf(formatSpec, function_name, return_code);
end
error('Failed calling script function!');
else % ensure cast to double and reshape the 1x9 vector to a 3x3 matrix
inertia_tensor = double(reshape(inertia_tensor,3,3));
Expand Down

0 comments on commit c95ecf5

Please sign in to comment.