-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip laserscans with no corresponding tf transform #313
Closed
Closed
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,14 +220,14 @@ void scan_unifier_node::topicCallbackLaserScan(const sensor_msgs::LaserScan::Con | |
} | ||
|
||
/** | ||
* @function unifieLaserScans | ||
* @brief unifie the scan information from all laser scans in vec_laser_struct_ | ||
* @function unifyLaserScans | ||
* @brief unify the scan information from all laser scans in vec_laser_struct_ | ||
* | ||
* input: - | ||
* output: | ||
* @param: a laser scan message containing unified information from all scanners | ||
*/ | ||
sensor_msgs::LaserScan scan_unifier_node::unifieLaserScans() | ||
sensor_msgs::LaserScan scan_unifier_node::unifyLaserScans() | ||
{ | ||
sensor_msgs::LaserScan unified_scan = sensor_msgs::LaserScan(); | ||
std::vector<sensor_msgs::PointCloud> vec_cloud; | ||
|
@@ -242,11 +242,13 @@ sensor_msgs::LaserScan scan_unifier_node::unifieLaserScans() | |
ROS_DEBUG_STREAM("Converting scans to point clouds at index: " << i << ", at time: " << vec_laser_struct_.at(i).current_scan_msg.header.stamp << " now: " << ros::Time::now()); | ||
try | ||
{ | ||
listener_.waitForTransform("/base_link", vec_laser_struct_.at(i).current_scan_msg.header.frame_id, | ||
vec_laser_struct_.at(i).current_scan_msg.header.stamp, ros::Duration(3.0)); | ||
|
||
if (!listener_.waitForTransform("base_link", vec_laser_struct_.at(i).current_scan_msg.header.frame_id, | ||
vec_laser_struct_.at(i).current_scan_msg.header.stamp, ros::Duration(3.0))) | ||
{ | ||
continue; | ||
} | ||
ROS_DEBUG("now project to point_cloud"); | ||
projector_.transformLaserScanToPointCloud("/base_link",vec_laser_struct_.at(i).current_scan_msg, vec_cloud.at(i), listener_); | ||
projector_.transformLaserScanToPointCloud("base_link",vec_laser_struct_.at(i).current_scan_msg, vec_cloud.at(i), listener_); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you please make this a parameter, while you are at it? |
||
} | ||
catch(tf::TransformException ex){ | ||
ROS_ERROR("%s",ex.what()); | ||
|
@@ -265,8 +267,8 @@ sensor_msgs::LaserScan scan_unifier_node::unifieLaserScans() | |
unified_scan.ranges.resize(round((unified_scan.angle_max - unified_scan.angle_min) / unified_scan.angle_increment) + 1); | ||
unified_scan.intensities.resize(round((unified_scan.angle_max - unified_scan.angle_min) / unified_scan.angle_increment) + 1); | ||
|
||
// now unifie all Scans | ||
ROS_DEBUG("unifie scans"); | ||
// now unify all Scans | ||
ROS_DEBUG("unify scans"); | ||
for(int j = 0; j < config_.number_input_scans; j++) | ||
{ | ||
for (unsigned int i = 0; i < vec_cloud.at(j).points.size(); i++) | ||
|
@@ -313,7 +315,7 @@ sensor_msgs::LaserScan scan_unifier_node::unifieLaserScans() | |
* input: - | ||
* output: - | ||
*/ | ||
void scan_unifier_node::checkUnifieCondition() | ||
void scan_unifier_node::checkUnifyCondition() | ||
{ | ||
bool all_scans_received = true; | ||
if(!vec_laser_struct_.empty()) | ||
|
@@ -330,9 +332,9 @@ void scan_unifier_node::checkUnifieCondition() | |
|
||
if(all_scans_received) | ||
{ | ||
// all scan-structs received a new msg so now unifie all of them | ||
// all scan-structs received a new msg so now unify all of them | ||
ROS_DEBUG("all_scans_received"); | ||
sensor_msgs::LaserScan unified_scan = unifieLaserScans(); | ||
sensor_msgs::LaserScan unified_scan = unifyLaserScans(); | ||
ROS_DEBUG("now publish"); | ||
topicPub_LaserUnified_.publish(unified_scan); | ||
for(int i=0; i < config_.number_input_scans; i++) | ||
|
@@ -358,7 +360,7 @@ int main(int argc, char** argv) | |
while(my_scan_unifier_node.nh_.ok()) | ||
{ | ||
|
||
my_scan_unifier_node.checkUnifieCondition(); | ||
my_scan_unifier_node.checkUnifyCondition(); | ||
|
||
ros::spinOnce(); | ||
rate.sleep(); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please correct indentation