From db4486ae87a4f6f040068599b7b5a7c5fbc98186 Mon Sep 17 00:00:00 2001 From: Jacopo Date: Thu, 8 Jun 2023 10:11:41 +0200 Subject: [PATCH] Add check on invertdirection value --- .../icubmod/embObjMotionControl/embObjMotionControl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libraries/icubmod/embObjMotionControl/embObjMotionControl.cpp b/src/libraries/icubmod/embObjMotionControl/embObjMotionControl.cpp index 7993d7253b..fae9d10774 100644 --- a/src/libraries/icubmod/embObjMotionControl/embObjMotionControl.cpp +++ b/src/libraries/icubmod/embObjMotionControl/embObjMotionControl.cpp @@ -2095,6 +2095,13 @@ bool embObjMotionControl::setCalibrationParametersRaw(int j, const CalibrationPa calib.params.type14.invertdirection = (uint8_t)U_32(params.param3); calib.params.type14.rotation = (int32_t)S_32(params.param4); + if (calib.params.type14.invertdirection != 0 && calib.params.type14.invertdirection != 1) + { + yError() << "Error in param3 of calibartion type 14 for joint " << j << "Admitted values are: 0=FALSE and 1=TRUE"; + return false; + } + + if(!checkCalib14RotationParam(calib.params.type14.rotation)) { yError() << "Error in param4 of calibartion type 14 for joint " << j << "Admitted values are: 0, 32768, 16384, -16384 [0, 180, 90, -90] in iCubDegree";