Skip to content
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

costmap_cspace: fix frame of z-filter in pointcloud2_to_map. #80

Merged
merged 1 commit into from
Oct 31, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions costmap_cspace/src/pointcloud2_to_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ class pointcloud2_to_map

public:
pointcloud2_to_map()
: nh(), pnh("~"), accums(2)
: nh()
, pnh("~")
, accums(2)
{
pnh.param("z_min", z_min, 0.1);
pnh.param("z_max", z_max, 1.0);
Expand Down Expand Up @@ -134,6 +136,7 @@ class pointcloud2_to_map
return;
published = now;

float robot_z;
try
{
tf::StampedTransform trans;
Expand All @@ -148,6 +151,7 @@ class pointcloud2_to_map
map.info.origin.orientation.w = 1.0;
origin_x = x - width * map.info.resolution * 0.5;
origin_y = y - height * map.info.resolution * 0.5;
robot_z = pos.z();
}
catch (tf::TransformException &e)
{
Expand All @@ -166,7 +170,7 @@ class pointcloud2_to_map
sensor_msgs::PointCloud2Iterator<float> iter_z(pc, "z");
for (; iter_x != iter_x.end(); ++iter_x, ++iter_y, ++iter_z)
{
if (*iter_z < z_min || z_max < *iter_z)
if (*iter_z - robot_z < z_min || z_max < *iter_z - robot_z)
continue;
unsigned int x = int(
(*iter_x - map.info.origin.position.x) / map.info.resolution);
Expand Down