Loading [MathJax]/extensions/tex2jax.js
iCub-main
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
FineCalibrationCheckerModule.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2025 iCub Facility - Istituto Italiano di Tecnologia
3 * Author: Jacopo Losi
4 * email: jacopo.losi@iit.it
5 * Permission is granted to copy, distribute, and/or modify this program
6 * under the terms of the GNU General Public License, version 2 or any
7 * later version published by the Free Software Foundation.
8 *
9 * A copy of the license can be found at
10 * http://www.robotcub.org/icub/license/gpl.txt
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15 * Public License for more details
16*/
17// -*- mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
18
19// lib includes
20#include <yarp/os/Bottle.h>
21#include <yarp/os/Property.h>
22#include <yarp/os/LogStream.h>
23#include <yarp/os/Log.h>
24
25// APIs
27
28namespace
29{
30 YARP_LOG_COMPONENT(FineCalibrationCheckerModuleCOMPONENT, "yarp.device.fineCalibrationCheckerModule")
31}
32
33bool FineCalibrationCheckerModule::configure(yarp::os::ResourceFinder& rf)
34{
35 // Create the thread using std::make_unique
36 checkerThread = std::make_unique<FineCalibrationCheckerThread>(rf);
37
38 // Start the thread
39 if (!checkerThread->start()) {
40 yCError(FineCalibrationCheckerModuleCOMPONENT) << "Failed to start FineCalibrationCheckerThread.";
41 checkerThread.reset(); // Release the unique_ptr if starting fails
42 return false;
43 }
44
45 return true;
46}
47
49{
50 // Stop the thread if it exists
51 if (checkerThread)
52 {
53 checkerThread->stop();
54 checkerThread.reset(); // Automatically deletes the thread
55 }
56
57 return true;
58}
59
61{
62 // This method is called periodically by the RFModule
63 // You can add any periodic tasks here if needed
64 yCDebug(FineCalibrationCheckerModuleCOMPONENT) << "Module is running happily";
65 return true;
66}
67
69{
70 // Return the period for the module
71 return 1.0; // Example: 1 second
72}
73
bool configure(yarp::os::ResourceFinder &rf) override