cob_collision_velocity_filter.h
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 
18 #ifndef COB_COLLISION_VELOCITY_FILTER_H
19 #define COB_COLLISION_VELOCITY_FILTER_H
20 
21 //##################
22 //#### includes ####
23 
24 // standard includes
25 //--
26 
27 // ROS includes
28 #include <ros/ros.h>
29 #include <XmlRpc.h>
30 
31 #include <pthread.h>
32 
33 // ROS message includes
34 #include <geometry_msgs/Twist.h>
35 #include <geometry_msgs/PolygonStamped.h>
36 #include <geometry_msgs/Polygon.h>
37 #include <nav_msgs/OccupancyGrid.h>
38 
39 #include <boost/tokenizer.hpp>
40 #include <boost/foreach.hpp>
41 #include <boost/algorithm/string.hpp>
42 
43 // ROS service includes
44 #include "cob_footprint_observer/GetFootprint.h"
45 
46 // dynamic reconfigure includes
47 #include <dynamic_reconfigure/server.h>
48 #include <cob_collision_velocity_filter/CollisionVelocityFilterConfig.h>
49 
50 // BUT velocity limited marker
52 
53 // Costmap for obstacle detection
55 
62 {
63 public:
64 
69 
74 
80  void joystickVelocityCB(const geometry_msgs::Twist::ConstPtr &twist);
81 
86  void readObstacles();
87 
91  void getFootprint(const ros::TimerEvent&);
92 
98  void dynamicReconfigureCB(const cob_collision_velocity_filter::CollisionVelocityFilterConfig &config,
99  const uint32_t level);
100 
102  //public
104 
105  //private
107 
110 
114 
117 
119  dynamic_reconfigure::Server<cob_collision_velocity_filter::CollisionVelocityFilterConfig> dyn_server_;
120  dynamic_reconfigure::Server<cob_collision_velocity_filter::CollisionVelocityFilterConfig>::CallbackType dynCB_;
121 
122 private:
123  /* core functions */
124 
126  //costmap_2d::Costmap2D costmap;
131  void performControllerStep();
132 
137  void obstacleHandler();
138 
139  /* helper functions */
140 
144  double sign(double x);
145 
151  double getDistance2d(geometry_msgs::Point a, geometry_msgs::Point b);
152 
159  bool obstacleValid(double x_obstacle, double y_obstacle);
160 
164  void stopMovement();
165 
166  pthread_mutex_t m_mutex;
167 
168  //obstacle_treshold
170 
171  //frames
173 
174  //velocity
175  geometry_msgs::Vector3 robot_twist_linear_, robot_twist_angular_;
178 
179  //obstacle avoidance
180  std::vector<geometry_msgs::Point> robot_footprint_;
184  nav_msgs::OccupancyGrid last_costmap_received_, relevant_obstacles_;
187 
188  // variables for slow down behavior
189  double last_time_;
190  double kp_, kv_;
192  double virt_mass_;
193 
194  // BUT velocity limited marker
196 
197 };
198 //CollisionVelocityFilter
199 
200 #endif
201 
std::vector< geometry_msgs::Point > robot_footprint_
ros::Timer get_footprint_timer_
Timer for periodically calling GetFootprint Service.
ros::Subscriber joystick_velocity_sub_
declaration of subscriber
dynamic_reconfigure::Server< cob_collision_velocity_filter::CollisionVelocityFilterConfig >::CallbackType dynCB_
geometry_msgs::Vector3 robot_twist_angular_
void stopMovement()
stops movement of the robot
dynamic_reconfigure::Server< cob_collision_velocity_filter::CollisionVelocityFilterConfig > dyn_server_
dynamic reconfigure
geometry_msgs::Vector3 robot_twist_linear_
ros::Publisher topic_pub_command_
declaration of publisher
costmap_2d::Costmap2DROS * anti_collision_costmap_
cob_collision_velocity_filter::VelocityLimitedMarker velocity_limited_marker_
checks for obstacles in driving direction and stops the robot
void obstacleHandler()
checks for obstacles in driving direction of the robot (rotation included) and publishes relevant obs...
nav_msgs::OccupancyGrid relevant_obstacles_
void performControllerStep()
checks distance to obstacles in driving direction and slows down/stops robot and publishes command ve...
nav_msgs::OccupancyGrid last_costmap_received_
double getDistance2d(geometry_msgs::Point a, geometry_msgs::Point b)
computes distance between two points
double sign(double x)
returns the sign of x
bool obstacleValid(double x_obstacle, double y_obstacle)
checks if obstacle lies already within footprint -> this is ignored due to sensor readings of the hul...
ros::NodeHandle nh_
create a handle for this node, initialize node


cob_collision_velocity_filter
Author(s): Matthias Gruhler, Michal Spanel
autogenerated on Thu Apr 8 2021 02:39:36