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 <core/threading/thread.h>
27 #include <aspect/logging.h>
28 #include <aspect/configurable.h>
29 #include <plugins/clips/aspect/clips_feature.h>
30 #include <plugins/ros/aspect/ros.h>
31 
32 #include <clipsmm.h>
33 
34 #include <map>
35 #include <string>
36 
37 
39 : public fawkes::Thread,
40  public fawkes::LoggingAspect,
42  public fawkes::ROSAspect,
43  public fawkes::CLIPSFeature,
45 {
46  public:
48  virtual ~ClipsROSThread();
49 
50  virtual void init();
51  virtual void loop();
52  virtual void finalize();
53 
54  // for CLIPSFeature
55  virtual void clips_context_init(const std::string &env_name,
57  virtual void clips_context_destroyed(const std::string &env_name);
58 
59  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
60  protected: virtual void run() { Thread::run(); }
61 
62  private: // members
63  std::map<std::string, fawkes::LockPtr<CLIPS::Environment> > envs_;
64 
65  private: // methods
66  class RosNodeInfo {
67  public:
68  std::list<std::string> published;
69  std::list<std::string> subscribed;
70  std::list<std::string> services;
71  };
72 
73  void clips_ros_get_nodes(std::string env_name);
74  void clips_ros_get_topics(std::string env_name);
75  void clips_ros_get_topic_connections(std::string env_name);
76 
77 };
78 
79 #endif
ROS integration for CLIPS.
Thread aspect to provide a feature to CLIPS environments.
Definition: clips_feature.h:57
virtual void run()
Stub to see name in backtrace for easier debugging.
Thread aspect to get access to a ROS node handle.
Definition: ros.h:39
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 class encapsulation of pthreads.
Definition: thread.h:42
virtual void init()
Initialize the thread.
virtual void loop()
Code to execute in the thread.
virtual void clips_context_destroyed(const std::string &env_name)
Notification that a CLIPS environment has been destroyed.
virtual ~ClipsROSThread()
Destructor.
ClipsROSThread()
Constructor.
CLIPS feature maintainer.
Definition: clips_feature.h:41
Thread aspect to log output.
Definition: logging.h:35
Thread aspect to access configuration data.
Definition: configurable.h:35
virtual void finalize()
Finalize the thread.