@@ -142,6 +142,8 @@ bool FineCalibrationChecker::open(yarp::os::Searchable& config)
142142 }
143143 }
144144
145+ _withGui = property.check (" withGui" , yarp::os::Value (false )).asBool ();
146+
145147 yCDebug (FineCalibrationCheckerCOMPONENT) << _deviceName << " Initialized device driver" ;
146148 _deviceStatus = deviceStatus::INITIALIZED ;
147149
@@ -232,7 +234,7 @@ bool FineCalibrationChecker::threadInit()
232234 yCError (FineCalibrationCheckerCOMPONENT) << _deviceName << " Unable to open encoders interface. Aborting..." ;
233235 return false ;
234236 }
235-
237+
236238
237239 if (!_remappedControlBoardDevice->view (remappedControlBoardInterfaces._ienc ) || remappedControlBoardInterfaces._ienc == nullptr )
238240 {
@@ -288,7 +290,7 @@ void FineCalibrationChecker::run()
288290 if (_deviceStatus == deviceStatus::CONFIGURED )
289291 {
290292 auto now = std::chrono::steady_clock::now ();
291- if (std::chrono::duration_cast<std::chrono::milliseconds>(now - lastTimerLog).count () > 1000 )
293+ if (std::chrono::duration_cast<std::chrono::milliseconds>(now - lastTimerLog).count () > 1000 )
292294 {
293295 yCDebug (FineCalibrationCheckerCOMPONENT) << _deviceName << " Device configured, waiting for attachAll() to be called." ;
294296 lastTimerLog = now;
@@ -350,7 +352,7 @@ void FineCalibrationChecker::run()
350352 else if (_deviceStatus == deviceStatus::CHECK_COMPLETED )
351353 {
352354 auto now = std::chrono::steady_clock::now ();
353- if (std::chrono::duration_cast<std::chrono::milliseconds>(now - shoutdownTimer).count () > 5000 )
355+ if (std::chrono::duration_cast<std::chrono::milliseconds>(now - shoutdownTimer).count () > 5000 )
354356 {
355357 yCDebug (FineCalibrationCheckerCOMPONENT) << _deviceName << " Operation completed successfully. Waiting yarprobotinterface to stop the thread..." ;
356358 // shoutdownTimer = now;
@@ -529,7 +531,7 @@ void FineCalibrationChecker::evaluateHardStopPositionDelta(const std::string& ke
529531 // are stored in a vector whose legth is joints_number*3, where each sub-array is made such
530532 // [raw_val_primary_enc, raw_val_secondary_enc, rraw_val_auxiliary_enc]
531533 // and we want the first value for each joint
532- rescaledPos = rawPosition * ICUB_DEGREES_RANGE / resolution; // Rescale the encoder raw position to iCubDegrees
534+ rescaledPos = rawPosition * ICUB_DEGREES_RANGE / resolution; // Rescale the encoder raw position to iCubDegrees
533535 delta = std::abs (goldPosition - rescaledPos) / (ICUB_DEGREES_RANGE /360 ) - homePositions[i]; // Calculate the delta in degrees
534536 delta = std::abs (delta) + static_cast <int64_t >(calibrationDelta[i]); // Add the calibration delta to the delta
535537 yCDebug (FineCalibrationCheckerCOMPONENT) << " GP:" << goldPosition << " HP:" << homePositions[i] << " RSP:" << rescaledPos << " RWP:" << rawPosition << " DD:" << delta;
@@ -553,8 +555,10 @@ void FineCalibrationChecker::evaluateHardStopPositionDelta(const std::string& ke
553555
554556 outFile.close ();
555557 yCDebug (FineCalibrationCheckerCOMPONENT) << " Output CSV written to:" << outputPath.string ();
556-
557- generateOutputImage (1800 , 400 , sampleItems);
558+ // Generate output image
559+ if (_withGui) {
560+ generateOutputImage (1800 , 400 , sampleItems);
561+ }
558562}
559563
560564void FineCalibrationChecker::generateOutputImage (int frameWidth, int frameHeight, const std::vector<ItemData>& items)
0 commit comments