filters_demo_node.cpp
Go to the documentation of this file.
1 /*
2  * filters_demo_node.cpp
3  *
4  * Created on: Aug 14, 2017
5  * Author: Peter Fankhauser
6  * Institute: ETH Zurich, ANYbotics
7  */
8 
10 
11 #include <ros/ros.h>
12 
13 int main(int argc, char** argv)
14 {
15  ros::init(argc, argv, "grid_map_filters_demo");
16  ros::NodeHandle nodeHandle("~");
17  bool success;
18  grid_map_demos::FiltersDemo filtersDemo(nodeHandle, success);
19  if (success) ros::spin();
20  return 0;
21 }
22 
23 
24 
25 
26 
28 // * filters_demo_node.cpp
29 // *
30 // * Created on: Aug 14, 2017
31 // * Author: Peter Fankhauser
32 // * Institute: ETH Zurich, ANYbotics
33 // */
34 //
35 //#include <filters/filter_chain.h>
36 //#include <grid_map_core/grid_map_core.hpp>
37 //#include <grid_map_ros/grid_map_ros.hpp>
38 //#include <grid_map_msgs/GridMap.h>
39 //#include <ros/ros.h>
40 //
41 //using namespace grid_map;
42 //
43 //class GridMapFilterChain
44 //
45 //
46 //(const grid_map_msgs::GridMapPtr& message)
47 //{
48 // GridMap inputMap;
49 // GridMapRosConverter::fromMessage(message, inputMap);
50 // ROS_INFO("I heard: [%s]", msg->data.c_str());
51 //}
52 //
53 //int main(int argc, char** argv)
54 //{
55 // ros::init(argc, argv, "grid_map_filters_demo");
56 // ros::NodeHandle nodeHandle("~");
57 // ros::Subscriber subscriber = nodeHandle.subscribe("grid_map_in", 1000, chatterCallback);
58 // ros::Publisher publisher = nodeHandle.advertise<grid_map_msgs::GridMap>("grid_map_out", 1, true);
59 //
60 // // Setup filter chain.
61 // filters::FilterChain<grid_map::GridMap> filterChain("grid_map::GridMap");
62 // if (!filterChain.configure("grid_map_filters", nodeHandle)) {
63 // ROS_ERROR("Could not configure the filter chain!");
64 // return false;
65 // }
66 //
67 // // Create input grid map.
68 // GridMap inputMap({"elevation"});
69 // inputMap.setFrameId("map");
70 // inputMap.setGeometry(Length(0.7, 0.7), 0.01, Position(0.0, 0.0));
71 // ROS_INFO("Created map with size %f x %f m (%i x %i cells).\n The center of the map is located at (%f, %f) in the %s frame.",
72 // inputMap.getLength().x(), inputMap.getLength().y(),
73 // inputMap.getSize()(0), inputMap.getSize()(1),
74 // inputMap.getPosition().x(), inputMap.getPosition().y(), inputMap.getFrameId().c_str());
75 // inputMap["elevation"].setRandom();
76 // inputMap["elevation"] *= 0.01;
77 // for (grid_map::CircleIterator iterator(inputMap, Position(0.0, 0.0), 0.15); !iterator.isPastEnd(); ++iterator) {
78 // inputMap.at("elevation", *iterator) = 0.1;
79 // }
80 //
81 // while (nodeHandle.ok()) {
82 //
83 // // Publish original grid map.
84 // inputMap.setTimestamp(ros::Time::now().toNSec());
85 // grid_map_msgs::GridMap message;
86 // GridMapRosConverter::toMessage(inputMap, message);
87 // publisher.publish(message);
88 // ros::Duration(1.0).sleep();
89 //
90 // // Apply filter chain.
91 // GridMap outputMap;
92 // if (!filterChain.update(inputMap, outputMap)) {
93 // ROS_ERROR("Could not update the grid map filter chain!");
94 // break;
95 // }
96 //
97 // // Publish filtered output grid map.
98 // outputMap.setTimestamp(ros::Time::now().toNSec());
99 // GridMapRosConverter::toMessage(outputMap, message);
100 // publisher.publish(message);
101 // ros::Duration(1.0).sleep();
102 // }
103 //
104 // return 0;
105 //}
int main(int argc, char **argv)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROSCPP_DECL void spin()


grid_map_demos
Author(s): Péter Fankhauser
autogenerated on Tue Jun 25 2019 20:02:37