Skip to content

Commit 7a471d8

Browse files
author
svn
committed
Cleanup indentation, function names, and license agreement.
1 parent 95980e1 commit 7a471d8

9 files changed

+746
-591
lines changed
Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
1+
/*
2+
* Software License Agreement (BSD License)
3+
*
4+
* Copyright (c) 2016, Fraunhofer IPA.
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions
9+
* are met:
10+
*
11+
* * Redistributions of source code must retain the above copyright
12+
* notice, this list of conditions and the following disclaimer.
13+
* * Redistributions in binary form must reproduce the above
14+
* copyright notice, this list of conditions and the following
15+
* disclaimer in the documentation and/or other materials provided
16+
* with the distribution.
17+
* * Neither the name of the copyright holder nor the names of its
18+
* contributors may be used to endorse or promote products derived
19+
* from this software without specific prior written permission.
20+
*
21+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24+
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31+
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32+
* POSSIBILITY OF SUCH DAMAGE.
33+
*
34+
*
35+
*/
36+
37+
/*
38+
* Author: Sofie Nilsson
39+
*/
40+
141
#ifndef FRAME_PUB_H
242
#define FRAME_PUB_H
343

@@ -10,22 +50,22 @@
1050
class FramePublisher
1151
{
1252
public:
13-
bool initialize();
53+
bool initialize();
1454

1555
private:
16-
void frameBroadcastCallback(const ros::TimerEvent& event);
56+
void frameBroadcastCallback(const ros::TimerEvent& event);
1757

1858
private:
19-
ros::NodeHandle nh_, priv_nh_;
20-
tf::TransformListener tf_listener_;
21-
tf::TransformBroadcaster tf_broadcaster_;
22-
23-
ros::Timer frame_broadcast_timer_;
24-
double update_rate_;
25-
std::string base_frame_;
26-
std::string rotation_frame_;
27-
std::string target_frame_;
28-
bool rot_z_, rot_x_, rot_y_;
59+
ros::NodeHandle nh_, priv_nh_;
60+
tf::TransformListener tf_listener_;
61+
tf::TransformBroadcaster tf_broadcaster_;
62+
63+
ros::Timer frame_broadcast_timer_;
64+
double update_rate_;
65+
std::string base_frame_;
66+
std::string rotation_frame_;
67+
std::string target_frame_;
68+
bool rot_z_, rot_x_, rot_y_;
2969
};
3070

3171
#endif // FRAME_PUB_H

include/pointcloud_to_laserscan/ipa_pointcloud_to_laserscan_nodelet.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Software License Agreement (BSD License)
33
*
44
* Copyright (c) 2010-2012, Willow Garage, Inc.
5+
* Copyright (c) 2015, Fraunhofer IPA.
56
* All rights reserved.
67
*
78
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +15,7 @@
1415
* copyright notice, this list of conditions and the following
1516
* disclaimer in the documentation and/or other materials provided
1617
* with the distribution.
17-
* * Neither the name of Willow Garage, Inc. nor the names of its
18+
* * Neither the name of the copyright holders nor the names of its
1819
* contributors may be used to endorse or promote products derived
1920
* from this software without specific prior written permission.
2021
*
@@ -33,7 +34,7 @@
3334
*
3435
*
3536
*/
36-
37+
3738
/*
3839
* Author: Paul Bovbel
3940
* Author: Sofie Nilsson
@@ -83,7 +84,7 @@ namespace pointcloud_to_laserscan
8384
boost::shared_ptr<tf2_ros::Buffer> tf2_;
8485
boost::shared_ptr<tf2_ros::TransformListener> tf2_listener_;
8586

86-
ros::Subscriber sub_;
87+
ros::Subscriber sub_;
8788

8889
scan_outlier_filter::ScanOutlierRemovalFilter outlier_filter_;
8990
// ROS Parameters

include/pointcloud_to_laserscan/roi_outlier_removal.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Software License Agreement (BSD License)
33
*
4-
* Copyright (c) 2010-2012, Willow Garage, Inc.
4+
* Copyright (c) 2016, Fraunhofer IPA.
55
* All rights reserved.
66
*
77
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +14,7 @@
1414
* copyright notice, this list of conditions and the following
1515
* disclaimer in the documentation and/or other materials provided
1616
* with the distribution.
17-
* * Neither the name of Willow Garage, Inc. nor the names of its
17+
* * Neither the name of the copyright holder nor the names of its
1818
* contributors may be used to endorse or promote products derived
1919
* from this software without specific prior written permission.
2020
*
@@ -33,7 +33,7 @@
3333
*
3434
*
3535
*/
36-
36+
3737
/*
3838
* Author: Sofie Nilsson
3939
*/
@@ -72,7 +72,7 @@ namespace pointcloud_to_laserscan
7272

7373
public:
7474
RoiOutlierRemovalNodelet();
75-
void configure_filter();
75+
void configure_roi_settings();
7676

7777
private:
7878
virtual void onInit();
@@ -89,7 +89,7 @@ namespace pointcloud_to_laserscan
8989
boost::shared_ptr<tf2_ros::Buffer> tf2_;
9090
boost::shared_ptr<tf2_ros::TransformListener> tf2_listener_;
9191

92-
ros::Subscriber sub_;
92+
ros::Subscriber sub_;
9393

9494
// ROS Parameters
9595
unsigned int input_queue_size_;

include/pointcloud_to_laserscan/scan_outlier_removal_filter.h

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* Software License Agreement (BSD License)
44
*
5-
* Copyright (c) 2010-2012, Fraunhofer IPA
5+
* Copyright (c) 2016, Fraunhofer IPA.
66
* All rights reserved.
77
*
88
* Redistribution and use in source and binary forms, with or without
@@ -15,7 +15,7 @@
1515
* copyright notice, this list of conditions and the following
1616
* disclaimer in the documentation and/or other materials provided
1717
* with the distribution.
18-
* * Neither the name of Willow Garage, Inc. nor the names of its
18+
* * Neither the name of the copyright holder nor the names of its
1919
* contributors may be used to endorse or promote products derived
2020
* from this software without specific prior written permission.
2121
*
@@ -39,31 +39,37 @@
3939
* Author: Sofie Nilsson
4040
*/
4141

42+
/*
43+
* The scan_outlier_removal_filter removes noise clusters with much smaller range than the surrounding points.
44+
* The filter can be configured with the following three parameters cluster_break_distance, max_noise_cluster_size,
45+
* max_noise_cluster_distance.
46+
*/
47+
4248
#ifndef IPA_POINTCLOUD_TO_LASERSCAN_SCAN_OUTLIER_REMOVAL_FILTER
4349
#define IPA_POINTCLOUD_TO_LASERSCAN_SCAN_OUTLIER_REMOVAL_FILTER
4450

4551
#include <sensor_msgs/LaserScan.h>
4652

47-
namespace scan_outlier_filter
48-
{
49-
class ScanOutlierRemovalFilter
50-
{
51-
private:
52-
bool filter_configured_;
53-
double cluster_break_distance_;
54-
int max_noise_cluster_size_;
55-
double max_noise_cluster_distance_;
53+
namespace scan_outlier_filter
54+
{
55+
class ScanOutlierRemovalFilter
56+
{
57+
private:
58+
bool filter_configured_;
59+
double cluster_break_distance_;
60+
int max_noise_cluster_size_;
61+
double max_noise_cluster_distance_;
5662

57-
public:
58-
ScanOutlierRemovalFilter():
59-
filter_configured_(false),
60-
cluster_break_distance_(0.0),
61-
max_noise_cluster_size_(0),
62-
max_noise_cluster_distance_(0.0)
63-
{};
64-
void configure(const double cluster_break_distance, const int max_noise_cluster_size, const double max_noise_cluster_distance);
63+
public:
64+
ScanOutlierRemovalFilter():
65+
filter_configured_(false),
66+
cluster_break_distance_(0.0),
67+
max_noise_cluster_size_(0),
68+
max_noise_cluster_distance_(0.0)
69+
{};
70+
void configure(const double cluster_break_distance, const int max_noise_cluster_size, const double max_noise_cluster_distance);
6571

66-
void remove_outliers(sensor_msgs::LaserScan &scan);
67-
};
72+
void remove_outliers(sensor_msgs::LaserScan &scan);
73+
};
6874
}
6975
#endif //IPA_POINTCLOUD_TO_LASERSCAN_SCAN_OUTLIER_REMOVAL_FILTER

src/frame_publisher.cpp

Lines changed: 82 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,96 @@
1+
2+
/*
3+
* Software License Agreement (BSD License)
4+
*
5+
* Copyright (c) 2016, Fraunhofer IPA.
6+
* All rights reserved.
7+
*
8+
* Redistribution and use in source and binary forms, with or without
9+
* modification, are permitted provided that the following conditions
10+
* are met:
11+
*
12+
* * Redistributions of source code must retain the above copyright
13+
* notice, this list of conditions and the following disclaimer.
14+
* * Redistributions in binary form must reproduce the above
15+
* copyright notice, this list of conditions and the following
16+
* disclaimer in the documentation and/or other materials provided
17+
* with the distribution.
18+
* * Neither the name of the copyright holder nor the names of its
19+
* contributors may be used to endorse or promote products derived
20+
* from this software without specific prior written permission.
21+
*
22+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25+
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26+
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32+
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33+
* POSSIBILITY OF SUCH DAMAGE.
34+
*
35+
*
36+
*/
37+
38+
/*
39+
* Author: Sofie Nilsson
40+
*/
41+
142
#include <pointcloud_to_laserscan/frame_publisher.h>
243

344
bool FramePublisher::initialize()
445
{
5-
priv_nh_ = ros::NodeHandle("~");
46+
priv_nh_ = ros::NodeHandle("~");
47+
48+
priv_nh_.param<double>("update_rate", update_rate_, 0.01); // 100Hz
49+
50+
priv_nh_.param<std::string>("base_frame", base_frame_, "base_link");
51+
priv_nh_.param<std::string>("rotation_frame", rotation_frame_, "torso_center_link");
52+
priv_nh_.param<std::string>("target_frame", target_frame_, "torso_rotated_base_link");
653

7-
priv_nh_.param<double>("update_rate", update_rate_, 0.01); // 100Hz
54+
priv_nh_.param<bool>("rot_z", rot_z_, false);
55+
priv_nh_.param<bool>("rot_x", rot_x_, false);
56+
priv_nh_.param<bool>("rot_y", rot_y_, false);
857

9-
priv_nh_.param<std::string>("base_frame", base_frame_, "base_link");
10-
priv_nh_.param<std::string>("rotation_frame", rotation_frame_, "torso_center_link");
11-
priv_nh_.param<std::string>("target_frame", target_frame_, "torso_rotated_base_link");
12-
13-
priv_nh_.param<bool>("rot_z", rot_z_, false);
14-
priv_nh_.param<bool>("rot_x", rot_x_, false);
15-
priv_nh_.param<bool>("rot_y", rot_y_, false);
16-
17-
frame_broadcast_timer_ = nh_.createTimer(ros::Duration(update_rate_), &FramePublisher::frameBroadcastCallback, this);
58+
frame_broadcast_timer_ = nh_.createTimer(ros::Duration(update_rate_), &FramePublisher::frameBroadcastCallback, this);
1859

19-
ros::Duration(1.0).sleep(); //give tf_listener some time
60+
ros::Duration(1.0).sleep(); //give tf_listener some time
2061

21-
return true;
62+
return true;
2263
}
2364

2465
/// Broadcast a frame aligned with the base frame but rotated around specified axes as rotation_frame
2566
void FramePublisher::frameBroadcastCallback(const ros::TimerEvent& event)
2667
{
27-
tf::StampedTransform frame_transform;
28-
try
29-
{
30-
tf_listener_.waitForTransform(base_frame_, rotation_frame_, event.current_real, ros::Duration(0.1));
31-
tf_listener_.lookupTransform(base_frame_, rotation_frame_, ros::Time(0), frame_transform);
32-
}
33-
catch (tf::TransformException& ex)
34-
{
35-
ROS_ERROR("FramePublisher::getTransform: \n%s", ex.what());
36-
return;
37-
}
38-
39-
double rot_frame_roll, rot_frame_pitch, rot_frame_yaw;
40-
frame_transform.getBasis().getRPY(rot_frame_roll, rot_frame_pitch, rot_frame_yaw);
41-
tf::Transform target_transform(frame_transform.getRotation());
42-
43-
// Use rotations according to settings
44-
double target_frame_roll = 0;
45-
double target_frame_pitch = 0;
46-
double target_frame_yaw = 0;
47-
if (rot_z_){ target_frame_yaw = rot_frame_yaw;}
48-
if (rot_x_){ target_frame_roll = rot_frame_roll;}
49-
if (rot_y_){ target_frame_pitch = rot_frame_pitch;}
50-
51-
target_transform.getBasis().setRPY(target_frame_roll, target_frame_pitch, target_frame_yaw);
52-
53-
// Broadcast new frame
54-
tf_broadcaster_.sendTransform(tf::StampedTransform(target_transform, frame_transform.stamp_, base_frame_, target_frame_));
68+
tf::StampedTransform frame_transform;
69+
try
70+
{
71+
tf_listener_.waitForTransform(base_frame_, rotation_frame_, event.current_real, ros::Duration(0.1));
72+
tf_listener_.lookupTransform(base_frame_, rotation_frame_, ros::Time(0), frame_transform);
73+
}
74+
catch (tf::TransformException& ex)
75+
{
76+
ROS_ERROR("FramePublisher::getTransform: \n%s", ex.what());
77+
return;
78+
}
79+
80+
double rot_frame_roll, rot_frame_pitch, rot_frame_yaw;
81+
frame_transform.getBasis().getRPY(rot_frame_roll, rot_frame_pitch, rot_frame_yaw);
82+
tf::Transform target_transform(frame_transform.getRotation());
83+
84+
// Use rotations according to settings
85+
double target_frame_roll = 0;
86+
double target_frame_pitch = 0;
87+
double target_frame_yaw = 0;
88+
if (rot_z_){ target_frame_yaw = rot_frame_yaw;}
89+
if (rot_x_){ target_frame_roll = rot_frame_roll;}
90+
if (rot_y_){ target_frame_pitch = rot_frame_pitch;}
91+
92+
target_transform.getBasis().setRPY(target_frame_roll, target_frame_pitch, target_frame_yaw);
93+
94+
// Broadcast new frame
95+
tf_broadcaster_.sendTransform(tf::StampedTransform(target_transform, frame_transform.stamp_, base_frame_, target_frame_));
5596
}

0 commit comments

Comments
 (0)