Skip to content
Snippets Groups Projects
Commit 68db6176 authored by echelon's avatar echelon
Browse files

wall only version

parent b336cdce
Branches
No related tags found
No related merge requests found
...@@ -123,7 +123,7 @@ void LidarOdometry::onInit() ...@@ -123,7 +123,7 @@ void LidarOdometry::onInit()
if((sqlite3_prepare_v3(db, query.str().c_str(), -1, SQLITE_PREPARE_PERSISTENT, &poleStmt, 0))) if((sqlite3_prepare_v3(db, query.str().c_str(), -1, SQLITE_PREPARE_PERSISTENT, &poleStmt, 0)))
ROS_ERROR_STREAM("ERROR while preparing statment: " << sqlite3_errmsg(db)); ROS_ERROR_STREAM("ERROR while preparing statment: " << sqlite3_errmsg(db));
if(mDetectWalls && (sqlite3_prepare_v3(db, wallquery2.str().c_str(), -1, SQLITE_PREPARE_PERSISTENT, &wallStmt, 0))){ if(mDetectWalls && (sqlite3_prepare_v3(db, wallquery.str().c_str(), -1, SQLITE_PREPARE_PERSISTENT, &wallStmt, 0))){
mDetectWalls = false; mDetectWalls = false;
ROS_ERROR_STREAM("ERROR while preparing statment: " << sqlite3_errmsg(db)); ROS_ERROR_STREAM("ERROR while preparing statment: " << sqlite3_errmsg(db));
} }
...@@ -397,11 +397,8 @@ void LidarOdometry::insertPrints(std::map<long, Pole> &poleMap, FingerprintMap & ...@@ -397,11 +397,8 @@ void LidarOdometry::insertPrints(std::map<long, Pole> &poleMap, FingerprintMap &
Pole other = poleMap[print.first]; Pole other = poleMap[print.first];
geometry_msgs::Point otherutmpos; geometry_msgs::Point otherutmpos;
if(isEdgeType(other)) if(!isEdgeType(other))
otherutmpos = map2UTM(other.pose.position, other.header.stamp); continue; //otherutmpos = map2UTM(other.pose.position, other.header.stamp);
else
continue;
sqlite3_bind_int64(mWallInsertStmt, 1, id); sqlite3_bind_int64(mWallInsertStmt, 1, id);
sqlite3_bind_double(mWallInsertStmt, 2, utmpos.x); sqlite3_bind_double(mWallInsertStmt, 2, utmpos.x);
...@@ -433,6 +430,7 @@ void LidarOdometry::insertPrints(std::map<long, Pole> &poleMap, FingerprintMap & ...@@ -433,6 +430,7 @@ void LidarOdometry::insertPrints(std::map<long, Pole> &poleMap, FingerprintMap &
if(lastPoleMap.find(id) != lastPoleMap.end() && lastPoleMap.find(print.first) != lastPoleMap.end()) if(lastPoleMap.find(id) != lastPoleMap.end() && lastPoleMap.find(print.first) != lastPoleMap.end())
continue; continue;
continue;
sqlite3_bind_int64(mPoleInsertStmt, 1, id); sqlite3_bind_int64(mPoleInsertStmt, 1, id);
sqlite3_bind_double(mPoleInsertStmt, 2, utmpos.x); sqlite3_bind_double(mPoleInsertStmt, 2, utmpos.x);
sqlite3_bind_double(mPoleInsertStmt, 3, utmpos.y); sqlite3_bind_double(mPoleInsertStmt, 3, utmpos.y);
...@@ -741,7 +739,7 @@ std::vector<std::tuple<pole_based_localization::Pole, std::vector<std::tuple<dou ...@@ -741,7 +739,7 @@ std::vector<std::tuple<pole_based_localization::Pole, std::vector<std::tuple<dou
double x1=coords.x - mMaxSearchRadius, y1=coords.y - mMaxSearchRadius, x2 = coords.x + mMaxSearchRadius, y2 = coords.y + mMaxSearchRadius; double x1=coords.x - mMaxSearchRadius, y1=coords.y - mMaxSearchRadius, x2 = coords.x + mMaxSearchRadius, y2 = coords.y + mMaxSearchRadius;
if(isEdge){ if(isEdge){
auto endPoint = edgeToPoints(trackedPole).second; auto endPoint = map2UTM(edgeToPoints(trackedPole).second, trackedPole.header.stamp);
x2 = endPoint.x + mMaxSearchRadius; x2 = endPoint.x + mMaxSearchRadius;
y2 = endPoint.y + mMaxSearchRadius; y2 = endPoint.y + mMaxSearchRadius;
} }
...@@ -750,16 +748,16 @@ std::vector<std::tuple<pole_based_localization::Pole, std::vector<std::tuple<dou ...@@ -750,16 +748,16 @@ std::vector<std::tuple<pole_based_localization::Pole, std::vector<std::tuple<dou
sqlite3_bind_double(stmt, 3, x2); sqlite3_bind_double(stmt, 3, x2);
sqlite3_bind_double(stmt, 4, y2); sqlite3_bind_double(stmt, 4, y2);
sqlite3_bind_double(stmt, 5, x1); //sqlite3_bind_double(stmt, 5, x1);
sqlite3_bind_double(stmt, 6, y1); //sqlite3_bind_double(stmt, 6, y1);
sqlite3_bind_double(stmt, 7, x2); // sqlite3_bind_double(stmt, 7, x2);
sqlite3_bind_double(stmt, 8, y2); // sqlite3_bind_double(stmt, 8, y2);
//ROS_ERROR_STREAM("from " << std::fixed << coords.x - mMaxSearchRadius << ", " << std::fixed << coords.x + mMaxSearchRadius << " to " << std::fixed << coords.y - mMaxSearchRadius << ", " << std::fixed << coords.y + mMaxSearchRadius); //ROS_ERROR_STREAM("from " << std::fixed << coords.x - mMaxSearchRadius << ", " << std::fixed << coords.x + mMaxSearchRadius << " to " << std::fixed << coords.y - mMaxSearchRadius << ", " << std::fixed << coords.y + mMaxSearchRadius);
//sqlite3_bind_int(stmt, 5, trackedPole.type); sqlite3_bind_int(stmt, 5, trackedPole.type);
sqlite3_bind_int(stmt, 9, trackedPole.type); // sqlite3_bind_int(stmt, 9, trackedPole.type);
int i=5; int i=5;
/* for(auto it = dists.begin(); it != dists.end(); ++it) for(auto it = dists.begin(); it != dists.end(); ++it)
{ {
if(isEdge && poleMap.find(it->first) == poleMap.end()) if(isEdge && poleMap.find(it->first) == poleMap.end())
continue; continue;
...@@ -769,7 +767,7 @@ std::vector<std::tuple<pole_based_localization::Pole, std::vector<std::tuple<dou ...@@ -769,7 +767,7 @@ std::vector<std::tuple<pole_based_localization::Pole, std::vector<std::tuple<dou
sqlite3_bind_double(stmt, ++i, it->second.first + dist_tol); sqlite3_bind_double(stmt, ++i, it->second.first + dist_tol);
double minAngle = it->second.second - ((angleTolerance*10.0)/it->second.first), maxAngle = it->second.second + ((angleTolerance*10.0)/it->second.first); double minAngle = it->second.second - ((angleTolerance*10.0)/it->second.first), maxAngle = it->second.second + ((angleTolerance*10.0)/it->second.first);
sqlite3_bind_double(stmt, ++i, -minAngle); sqlite3_bind_double(stmt, ++i, minAngle);
sqlite3_bind_double(stmt, ++i, maxAngle); sqlite3_bind_double(stmt, ++i, maxAngle);
if(isEdge){ if(isEdge){
...@@ -788,9 +786,9 @@ std::vector<std::tuple<pole_based_localization::Pole, std::vector<std::tuple<dou ...@@ -788,9 +786,9 @@ std::vector<std::tuple<pole_based_localization::Pole, std::vector<std::tuple<dou
++i; ++i;
int paramsPerPrint = isEdge ? 8 : 4; int paramsPerPrint = isEdge ? 8 : 4;
for(; i<5+mMaxDists*paramsPerPrint; ++i){ for(; i<6+mMaxDists*paramsPerPrint; ++i){
sqlite3_bind_double(stmt, i, -5.0); sqlite3_bind_double(stmt, i, -5.0);
}*/ }
std::string curPole = ""; std::string curPole = "";
unsigned int distCount = 0; unsigned int distCount = 0;
...@@ -801,7 +799,8 @@ std::vector<std::tuple<pole_based_localization::Pole, std::vector<std::tuple<dou ...@@ -801,7 +799,8 @@ std::vector<std::tuple<pole_based_localization::Pole, std::vector<std::tuple<dou
elapsed_seconds = std::chrono::system_clock::now()-afterStep; elapsed_seconds = std::chrono::system_clock::now()-afterStep;
//std::cout << "Database statement step for poleId took " << elapsed_seconds.count() * 1000 << "ms (id: " << entry.first << ")" << std::endl; //std::cout << "Database statement step for poleId took " << elapsed_seconds.count() * 1000 << "ms (id: " << entry.first << ")" << std::endl;
distCount = std::round(sqlite3_column_double(stmt, 0) * 1000); // TODO HACK FOR TESTING //distCount = std::round(sqlite3_column_double(stmt, 0) * 1000); // TODO HACK FOR TESTING
distCount = sqlite3_column_int(stmt, 0);
if(curPole.compare(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 1))) && distCount > 0) if(curPole.compare(reinterpret_cast<const char*>(sqlite3_column_text(stmt, 1))) && distCount > 0)
{ {
curPole = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 1)); curPole = reinterpret_cast<const char*>(sqlite3_column_text(stmt, 1));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment