From c95ecf5f70f66024dd655262aadcc1eff71210cb Mon Sep 17 00:00:00 2001 From: Frederico Afonso <frederico.fernandes.afonso@gmail.com> Date: Thu, 29 Aug 2024 14:58:50 +0100 Subject: [PATCH] [DQ_VrepInterface.m] Fixed error messages of 'get_center_of_mass()', 'get_mass()', and 'get_inertia_matrix()'. --- interfaces/vrep/DQ_VrepInterface.m | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/interfaces/vrep/DQ_VrepInterface.m b/interfaces/vrep/DQ_VrepInterface.m index ef88bd9b..35ec3892 100644 --- a/interfaces/vrep/DQ_VrepInterface.m +++ b/interfaces/vrep/DQ_VrepInterface.m @@ -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); @@ -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); @@ -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));