amcl: fix compilation with gcc7

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
This commit is contained in:
Dmitry Rozhkov 2017-06-26 17:17:11 +03:00
parent 2678ffb491
commit c255bc3dc8
2 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,48 @@
From bd789fc1fc201c3d180e9570af5065bd27e50338 Mon Sep 17 00:00:00 2001
From: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
Date: Fri, 16 Jun 2017 14:50:52 +0300
Subject: [PATCH] amcl: fix compilation with gcc v7
When building amcl with recent enough gcc v7 compilation fails with
the error
src/amcl/map/map_cspace.cpp: In function 'void enqueue(map_t*, unsigned int, unsigned int, unsigned int, unsigned int, std::priority_queue<CellData>&, CachedDistanceMap*, unsigned char*)':
src/amcl/map/map_cspace.cpp:98:34: error: call of overloaded 'abs(unsigned int)' is ambiguous
unsigned int di = abs(i - src_i);
Use `int abs(int)` flavour of the abs() function.
Upstream-Status: Submitted [https://github.com/ros-planning/navigation/pull/587]
---
amcl/src/amcl/map/map_cspace.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/amcl/src/amcl/map/map_cspace.cpp b/amcl/src/amcl/map/map_cspace.cpp
index 421f718..5b4cf9c 100644
--- a/amcl/src/amcl/map/map_cspace.cpp
+++ b/amcl/src/amcl/map/map_cspace.cpp
@@ -86,8 +86,8 @@ get_distance_map(double scale, double max_dist)
return cdm;
}
-void enqueue(map_t* map, unsigned int i, unsigned int j,
- unsigned int src_i, unsigned int src_j,
+void enqueue(map_t* map, int i, int j,
+ int src_i, int src_j,
std::priority_queue<CellData>& Q,
CachedDistanceMap* cdm,
unsigned char* marked)
@@ -95,8 +95,8 @@ void enqueue(map_t* map, unsigned int i, unsigned int j,
if(marked[MAP_INDEX(map, i, j)])
return;
- unsigned int di = abs(i - src_i);
- unsigned int dj = abs(j - src_j);
+ int di = abs(i - src_i);
+ int dj = abs(j - src_j);
double distance = cdm->distances_[di][dj];
if(distance > cdm->cell_radius_)
--
2.9.3

View File

@ -2,7 +2,8 @@ SRC_URI = "https://github.com/ros-planning/${ROS_SPN}/archive/${PV}.tar.gz;downl
SRC_URI[md5sum] = "d7a392da183b3c2a5fce063e90cbf1f2"
SRC_URI[sha256sum] = "169f89a4a3a94437ffbf80a9b06b65471c17529169d1940a217e92d85481f18f"
SRC_URI += "file://0001-address-gcc6-build-error.patch;patchdir=.."
SRC_URI += "file://0001-address-gcc6-build-error.patch;patchdir=.. \
file://0001-amcl-fix-compilation-with-gcc-v7.patch;patchdir=.."
S = "${WORKDIR}/${ROS_SP}/${ROS_BPN}"