collision_monitor_node.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include <ros/ros.h>
18 
19 #if ROS_VERSION_MINIMUM(1,14,0) // melodic
21 #else
22 #include <tf/transform_listener.h>
23 #endif
24 
25 #include "valid_state_publisher.h"
26 
27 
28 int main(int argc, char **argv)
29 {
30  ros::init (argc, argv, "collision_monitor_node");
31 
32  ros::NodeHandle nh("~");
33 
34 #if ROS_VERSION_MINIMUM(1,14,0) // melodic
35  std::shared_ptr<tf2_ros::Buffer> tf(new tf2_ros::Buffer(ros::Duration(nh.param("max_cache_time", 2.0))));
36  planning_scene_monitor::PlanningSceneMonitorPtr psm(new planning_scene_monitor::PlanningSceneMonitor("robot_description", tf, ""));
37 #else
39  planning_scene_monitor::PlanningSceneMonitorPtr psm(new planning_scene_monitor::PlanningSceneMonitor("robot_description", tf));
40 #endif
41 
42  double state_update_frequency;
43  if(nh.getParam("state_update_frequency", state_update_frequency))
44  psm->setStateUpdateFrequency(state_update_frequency);
45 
46  if(nh.param("start_scene_monitor", true))
47  psm->startSceneMonitor();
48  if(nh.param("start_world_geometry_monitor", true))
49  psm->startWorldGeometryMonitor();
50  psm->startStateMonitor();
51 
53 
54  ros::spin();
55 
56  return 0;
57 }
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROSCPP_DECL void spin(Spinner &spinner)
bool param(const std::string &param_name, T &param_val, const T &default_val) const
bool getParam(const std::string &key, std::string &s) const
int main(int argc, char **argv)


cob_collision_monitor
Author(s): Mathias Lüdtke
autogenerated on Sun Dec 6 2020 03:25:44