Fawkes API  Fawkes Development Version
clips_ros_thread.h
1 
2 /***************************************************************************
3  * clips_ros_thread.h - ROS integration for CLIPS
4  *
5  * Created: Tue Oct 22 18:12:19 2013
6  * Copyright 2006-2013 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef _PLUGINS_CLIPS_ROS_CLIPS_ROS_THREAD_H_
24 #define _PLUGINS_CLIPS_ROS_CLIPS_ROS_THREAD_H_
25 
26 #include <aspect/configurable.h>
27 #include <aspect/logging.h>
28 #include <core/threading/thread.h>
29 #include <plugins/clips/aspect/clips_feature.h>
30 #include <plugins/ros/aspect/ros.h>
31 
32 #include <clipsmm.h>
33 #include <map>
34 #include <string>
35 
37  public fawkes::LoggingAspect,
39  public fawkes::ROSAspect,
40  public fawkes::CLIPSFeature,
42 {
43 public:
45  virtual ~ClipsROSThread();
46 
47  virtual void init();
48  virtual void loop();
49  virtual void finalize();
50 
51  // for CLIPSFeature
52  virtual void clips_context_init(const std::string & env_name,
54  virtual void clips_context_destroyed(const std::string &env_name);
55 
56  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
57 protected:
58  virtual void
59  run()
60  {
61  Thread::run();
62  }
63 
64 private: // members
65  std::map<std::string, fawkes::LockPtr<CLIPS::Environment>> envs_;
66 
67 private: // methods
68  class RosNodeInfo
69  {
70  public:
71  std::list<std::string> published;
72  std::list<std::string> subscribed;
73  std::list<std::string> services;
74  };
75 
76  void clips_ros_get_nodes(std::string env_name);
77  void clips_ros_get_topics(std::string env_name);
78  void clips_ros_get_topic_connections(std::string env_name);
79 };
80 
81 #endif
ROS integration for CLIPS.
virtual ~ClipsROSThread()
Destructor.
virtual void init()
Initialize the thread.
virtual void finalize()
Finalize the thread.
ClipsROSThread()
Constructor.
virtual void clips_context_destroyed(const std::string &env_name)
Notification that a CLIPS environment has been destroyed.
virtual void run()
Stub to see name in backtrace for easier debugging.
virtual void loop()
Code to execute in the thread.
virtual void clips_context_init(const std::string &env_name, fawkes::LockPtr< CLIPS::Environment > &clips)
Initialize a CLIPS context to use the provided feature.
Thread aspect to provide a feature to CLIPS environments.
Definition: clips_feature.h:58
CLIPS feature maintainer.
Definition: clips_feature.h:42
Thread aspect to access configuration data.
Definition: configurable.h:33
Thread aspect to log output.
Definition: logging.h:33
Thread aspect to get access to a ROS node handle.
Definition: ros.h:39
Thread class encapsulation of pthreads.
Definition: thread.h:46