Plugin.cpp
Go to the documentation of this file.
1 // Plugin.cpp
3 //
4 // Created on: Jan 27, 2014
5 // Author: mklingen
7 #include "OctomapInterface.h"
8 #include <openrave/plugin.h>
9 #include <ros/ros.h>
10 #include <ros/node_handle.h>
11 #include <ros/param.h>
12 using namespace OpenRAVE;
13 using namespace or_octomap;
14 
15 
16 static char* argv[1] = {const_cast<char *>("or_octomap")};
17 static int argc = 1;
18 OpenRAVE::InterfaceBasePtr CreateInterfaceValidated(OpenRAVE::InterfaceType type,
19  const std::string& interfacename,
20  std::istream& sinput,
21  OpenRAVE::EnvironmentBasePtr penv)
22 {
23  if (type == OpenRAVE::PT_SensorSystem && interfacename == "or_octomap")
24  {
25  if (!ros::isInitialized())
26  {
27  ros::init(argc, argv, "or_octomap");
28  }
29  else
30  {
31  RAVELOG_DEBUG("Using existing ROS node '%s'\n", ros::this_node::getName().c_str());
32  }
33 
34  std::map<std::string, std::string> remaps;
35  remaps["/cloud_in"] = "/camera/depth/points";
36  ros::NodeHandle nodeHandle("~", remaps);
37 
38  double resolution = 0.05;
39  std::string frameID = "/map";
40  double maxRange = 2.0;
41  nodeHandle.param("resolution", resolution, resolution);
42  nodeHandle.param("frame_id", frameID, frameID);
43  nodeHandle.param("sensor_model/max_range", maxRange, maxRange);
44 
45  nodeHandle.setParam("resolution", resolution);
46  nodeHandle.setParam("frame_id", frameID);
47  nodeHandle.setParam("sensor_model/max_range", maxRange);
48 
49  return OpenRAVE::InterfaceBasePtr(new OctomapInterface(nodeHandle, penv));
50  }
51 
52  return OpenRAVE::InterfaceBasePtr();
53 }
54 
55 void GetPluginAttributesValidated(OpenRAVE::PLUGININFO& info)
56 {
57  info.interfacenames[OpenRAVE::PT_SensorSystem].push_back("or_octomap");
58 }
59 
60 OPENRAVE_PLUGIN_API void DestroyPlugin()
61 {
62  return;
63 }
OpenRAVE::InterfaceBasePtr CreateInterfaceValidated(OpenRAVE::InterfaceType type, const std::string &interfacename, std::istream &sinput, OpenRAVE::EnvironmentBasePtr penv)
Definition: Plugin.cpp:18
void GetPluginAttributesValidated(OpenRAVE::PLUGININFO &info)
Definition: Plugin.cpp:55
static int argc
Definition: Plugin.cpp:17
static char * argv[1]
Definition: Plugin.cpp:16
OPENRAVE_PLUGIN_API void DestroyPlugin()
Definition: Plugin.cpp:60


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