39 #include <sensor_msgs/LaserScan.h> 41 #include <pr2_msgs/LaserScannerSignal.h> 42 #include <boost/thread/mutex.hpp> 64 ROS_ERROR(
"The filter_sections must be a list of integers");
69 for(
int i = 0; i < filter_sections.
size(); ++i){
74 ROS_ERROR(
"The tilt_profile_times must be a list of integers");
78 double section_int = int(section);
90 ROS_ERROR(
"No tilt_profile_times were given");
95 ROS_ERROR(
"The tilt_profile_times must be a list of doubles");
99 if(tilt_profile_times.
size() < 2){
100 ROS_ERROR(
"The tilt_profile_times list must contain at least two values... a start and an end");
105 for(
int i = 0; i < tilt_profile_times.
size(); ++i){
110 ROS_ERROR(
"The tilt_profile_times must be a list of doubles");
132 void signalCb(
const pr2_msgs::LaserScannerSignal::ConstPtr& signal){
133 boost::mutex::scoped_lock lock(
mutex_);
135 if(signal->signal == 0){
141 bool update(
const sensor_msgs::LaserScan& scan_in, sensor_msgs::LaserScan& scan_out){
149 boost::mutex::scoped_lock lock(
mutex_);
156 int profile_section = 0;
159 ROS_DEBUG(
"Checking period_time: %.4f against tilt_profile time: %.4f and next %.4f",
166 ROS_DEBUG(
"Profile section: %d, time: %.4f", profile_section, scan_in.header.stamp.toSec());
171 sensor_msgs::LaserScan empty_scan;
172 empty_scan.header = scan_in.header;
173 scan_out = empty_scan;
LaserTiltControllerFilter()
std::vector< int > filter_signals_
~LaserTiltControllerFilter()
void signalCb(const pr2_msgs::LaserScannerSignal::ConstPtr &signal)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
bool update(const sensor_msgs::LaserScan &scan_in, sensor_msgs::LaserScan &scan_out)
Type const & getType() const
A filter that invalidates scans for certain periods of a tilt profile.
ros::Subscriber signal_sub_
std::vector< double > tilt_profile_times_
bool loadTiltProfileTiming()