OctomapInterface.h
Go to the documentation of this file.
1 // OctomapSensorSystem.h
3 //
4 // Created on: Jan 24, 2014
5 // Author: mklingen
7 
8 #ifndef OCTOMAPSENSORSYSTEM_H_
9 #define OCTOMAPSENSORSYSTEM_H_
10 
11 #include <openrave/openrave.h>
12 #include <octomap_server/OctomapServer.h>
13 #include <ros/ros.h>
14 #include <ros/node_handle.h>
15 #include <ros/callback_queue.h>
16 #include <boost/thread/mutex.hpp>
17 
18 #include <std_msgs/ColorRGBA.h>
19 
20 namespace or_octomap
21 {
22  class OctomapCollisionChecker;
23  class OctomapInterface : public OpenRAVE::SensorSystemBase, public octomap_server::OctomapServer
24  {
25  public:
26  OctomapInterface(ros::NodeHandle& nodeHandle, OpenRAVE::EnvironmentBasePtr env);
27  virtual ~OctomapInterface();
28 
29  virtual bool SendCommand(std::ostream &os, std::istream &is);
30  virtual void Reset();
31 
32  void SetEnabled(bool enabled);
33  inline bool IsEnabled() { return m_isEnabled; }
34 
35  octomap::OcTree* GetTree() { return m_octree; }
36 
37  // Not implemented virtual functions.
38  virtual void AddRegisteredBodies(const std::vector< OpenRAVE::KinBodyPtr > &vbodies) { }
39  virtual OpenRAVE::KinBody::ManageDataPtr AddKinBody(OpenRAVE::KinBodyPtr pbody,
40  OpenRAVE::XMLReadableConstPtr pdata)
41  {
42  return OpenRAVE::KinBody::ManageDataPtr();
43  }
44  virtual bool RemoveKinBody(OpenRAVE::KinBodyPtr pbody) { return false; }
45  virtual bool IsBodyPresent(OpenRAVE::KinBodyPtr pbody) { return false;}
46  virtual bool EnableBody(OpenRAVE::KinBodyPtr pbody, bool bEnable) { return false; }
47  virtual bool SwitchBody (OpenRAVE::KinBodyPtr pbody1, OpenRAVE::KinBodyPtr pbody2) { return false; }
48 
49  bool TogglePause(std::ostream &os, std::istream &i) { m_isPaused = !m_isPaused; return true;}
50  bool Enable(std::ostream &os, std::istream &i) { SetEnabled(true); return true;}
51  bool Disable(std::ostream &os, std::istream &i) { SetEnabled(false); return true; }
52  bool MaskObject(std::ostream &os, std::istream &i);
53  bool SaveTree(std::ostream &os, std::istream &i);
54  bool ResetTree(std::ostream &os, std::istream &i);
55  bool ResetTopic(std::ostream &os, std::istream &i);
56  bool ResetResolution(std::ostream &os, std::istream &i);
57  bool ResetFrame(std::ostream &os, std::istream &i);
58  boost::mutex & GetMutex(){return m_cloudQueueMutex;}
59 
60  void Spin();
61  void TestCollision();
62 
63  protected:
64  void InsertScans();
65  void InsertCloudWrapper(const sensor_msgs::PointCloud2::ConstPtr& cloud);
66  void CreateFakeBody();
67  void DestroyFakeBody();
70  ros::CallbackQueue m_queue;
72  boost::mutex m_cloudQueueMutex;
73  std::vector<sensor_msgs::PointCloud2ConstPtr> m_cloudQueue;
74  bool m_isPaused;
75 
76  void updateParam();
77  }; // end class OctomapInterface
78 }// end namespace or_octomap
79 #endif
virtual bool EnableBody(OpenRAVE::KinBodyPtr pbody, bool bEnable)
virtual void AddRegisteredBodies(const std::vector< OpenRAVE::KinBodyPtr > &vbodies)
bool MaskObject(std::ostream &os, std::istream &i)
virtual bool RemoveKinBody(OpenRAVE::KinBodyPtr pbody)
bool TogglePause(std::ostream &os, std::istream &i)
bool Disable(std::ostream &os, std::istream &i)
virtual bool SwitchBody(OpenRAVE::KinBodyPtr pbody1, OpenRAVE::KinBodyPtr pbody2)
bool ResetTopic(std::ostream &os, std::istream &i)
octomap::OcTree * GetTree()
virtual bool IsBodyPresent(OpenRAVE::KinBodyPtr pbody)
bool Enable(std::ostream &os, std::istream &i)
std::vector< sensor_msgs::PointCloud2ConstPtr > m_cloudQueue
bool ResetTree(std::ostream &os, std::istream &i)
OctomapCollisionChecker * m_collisionChecker
void InsertCloudWrapper(const sensor_msgs::PointCloud2::ConstPtr &cloud)
bool SaveTree(std::ostream &os, std::istream &i)
bool ResetFrame(std::ostream &os, std::istream &i)
virtual OpenRAVE::KinBody::ManageDataPtr AddKinBody(OpenRAVE::KinBodyPtr pbody, OpenRAVE::XMLReadableConstPtr pdata)
bool ResetResolution(std::ostream &os, std::istream &i)
OctomapInterface(ros::NodeHandle &nodeHandle, OpenRAVE::EnvironmentBasePtr env)
virtual bool SendCommand(std::ostream &os, std::istream &is)


or_octomap_plugin
Author(s): Yan Yu
autogenerated on Tue Oct 24 2017 18:02:48