Fawkes API Fawkes Development Version
navgraph_adapter.h
1
2/***************************************************************************
3 * navgraph_adapter.h - PLEXIL adapter for the NavGraph
4 *
5 * Created: Sun Aug 19 20:49:49 2018
6 * Copyright 2006-2018 Tim Niemueller [www.niemueller.de]
7 ****************************************************************************/
8
9/* This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Library General Public License for more details.
18 *
19 * Read the full text in the LICENSE.GPL file in the doc directory.
20 */
21
22#ifndef __PLUGINS_PLEXIL_NAVGRAPH_ADAPTER_H_
23#define __PLUGINS_PLEXIL_NAVGRAPH_ADAPTER_H_
24
25#include <core/utils/lockptr.h>
26
27#include <InterfaceAdapter.hh>
28#include <Value.hh>
29#include <functional>
30#include <map>
31#include <string>
32
33namespace fawkes {
34class BlackBoard;
35class Logger;
36class NavGraph;
37class Position3DInterface;
38} // namespace fawkes
39
40/** Interface adapter to provide logging facilities. */
41class NavGraphPlexilAdapter : public PLEXIL::InterfaceAdapter
42{
43public:
44 NavGraphPlexilAdapter(PLEXIL::AdapterExecInterface &execInterface);
45 NavGraphPlexilAdapter(PLEXIL::AdapterExecInterface &execInterface, pugi::xml_node const xml);
46
47 /// @cond DELETED
48 NavGraphPlexilAdapter() = delete;
50 NavGraphPlexilAdapter &operator=(const NavGraphPlexilAdapter &) = delete;
51 /// @endcond
52
53 virtual ~NavGraphPlexilAdapter();
54
55 virtual bool initialize();
56 virtual bool start();
57 virtual bool stop();
58 virtual bool reset();
59 virtual bool shutdown();
60
61 void executeCommand(PLEXIL::Command *cmd);
62 void invokeAbort(PLEXIL::Command *cmd);
63
64private:
65 void navgraph_get_nodes(PLEXIL::Command *cmd);
66 void navgraph_cost_to(PLEXIL::Command *cmd);
67 void navgraph_cost_between(PLEXIL::Command *cmd);
68
69private:
70 fawkes::Logger * logger_;
71 fawkes::BlackBoard * blackboard_;
73
75
76 std::map<std::string, std::function<void(PLEXIL::Command *)>> commands_;
77};
78
79extern "C" {
80void initNavGraphAdapter();
81}
82
83#endif
Interface adapter to provide logging facilities.
virtual bool shutdown()
Shut adapter down.
virtual bool start()
Start adapter.
NavGraphPlexilAdapter(PLEXIL::AdapterExecInterface &execInterface)
Constructor.
void invokeAbort(PLEXIL::Command *cmd)
Abort currently running execution.
virtual bool reset()
Reset adapter.
virtual bool initialize()
Initialize adapter.
void executeCommand(PLEXIL::Command *cmd)
Perform given command.
virtual bool stop()
Stop adapter.
virtual ~NavGraphPlexilAdapter()
Destructor.
The BlackBoard abstract class.
Definition: blackboard.h:46
Interface for logging.
Definition: logger.h:42
Position3DInterface Fawkes BlackBoard Interface.
Fawkes library namespace.