Fawkes API  Fawkes Development Version
execution_time_estimator_navgraph_thread.cpp
1 /***************************************************************************
2  * execution_time_estimator_navgraph_thread.cpp - Skill exec times from navgraph
3  *
4  * Created: Tue 07 Jan 2020 16:02:38 CET 16:02
5  * Copyright 2020 Till Hofmann <hofmann@kbsg.rwth-aachen.de>
6  ****************************************************************************/
7 
8 /* This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Library General Public License for more details.
17  *
18  * Read the full text in the LICENSE.GPL file in the doc directory.
19  */
20 
21 #include "execution_time_estimator_navgraph_thread.h"
22 
23 #include "navgraph_estimator.h"
24 
25 #include <interfaces/Position3DInterface.h>
26 
27 /** @class ExecutionTimeEstimatorNavgraphThread
28  * Get estimates for skill execution times from the navgraph.
29  */
30 
31 constexpr char ExecutionTimeEstimatorNavgraphThread::cfg_prefix_[];
32 
33 /** Constructor. */
35 : Thread("ExecutionTimeEstimatorNavgraphThread", Thread::OPMODE_WAITFORWAKEUP)
36 {
37 }
38 
39 /** Register the estimator. */
40 void
42 {
43  estimator_ = std::make_shared<fawkes::NavGraphEstimator>(navgraph, config, cfg_prefix_);
45  estimator_, config->get_int_or_default((std::string{cfg_prefix_} + "priority").c_str(), 0));
46 }
47 
48 /** Unregister the estimator. */
49 void
51 {
53 }
ExecutionTimeEstimatorNavgraphThread::finalize
void finalize()
Unregister the estimator.
Definition: execution_time_estimator_navgraph_thread.cpp:50
fawkes::ExecutionTimeEstimatorManager::register_provider
void register_provider(std::shared_ptr< ExecutionTimeEstimator > provider, int priority=0)
Add an execution time provider.
Definition: execution_time_estimator.cpp:58
fawkes::ExecutionTimeEstimatorManager::unregister_provider
void unregister_provider(std::shared_ptr< ExecutionTimeEstimator > provider)
Remove an execution time estimate provider.
Definition: execution_time_estimator.cpp:68
fawkes::ExecutionTimeEstimatorsAspect::execution_time_estimator_manager_
ExecutionTimeEstimatorManager * execution_time_estimator_manager_
The ExecutionTimeEstimatorManager that is used to manage the estimators.
Definition: execution_time_estimator.h:51
ExecutionTimeEstimatorNavgraphThread::init
void init()
Register the estimator.
Definition: execution_time_estimator_navgraph_thread.cpp:41
ExecutionTimeEstimatorNavgraphThread::ExecutionTimeEstimatorNavgraphThread
ExecutionTimeEstimatorNavgraphThread()
Constructor.
Definition: execution_time_estimator_navgraph_thread.cpp:34
fawkes::ConfigurableAspect::config
Configuration * config
This is the Configuration member used to access the configuration.
Definition: configurable.h:41
fawkes::NavGraphAspect::navgraph
fawkes::LockPtr< NavGraph > navgraph
NavGraph instance shared in framework.
Definition: navgraph.h:44
fawkes::Configuration::get_int_or_default
virtual int get_int_or_default(const char *path, const int &default_val)
Get value from configuration which is of type int, or the given default if the path does not exist.
Definition: config.cpp:716