forked from ANYbotics/grid_map
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/elevation_mapping_postprocessing_unit_test' int…
…o 'master' [elevation_mapping] Postprocessing unit test Closes #UNKNOWN GitOrigin-RevId: 5876ae92b2d64766999d6692660cbb5759b5a01b
- Loading branch information
1 parent
007163c
commit a623fa5
Showing
5 changed files
with
125 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* MockFilter.hpp | ||
* | ||
* Created on: Sep 24, 2020 | ||
* Author: Magnus Gärtner | ||
* Institute: ETH Zurich, ANYbotics | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <filters/filter_base.h> | ||
|
||
#include <string> | ||
|
||
namespace grid_map { | ||
|
||
/*! | ||
* Duplication filter class duplicates a layer of a grid map. | ||
*/ | ||
template<typename T> | ||
class MockFilter : public filters::FilterBase<T> | ||
{ | ||
|
||
public: | ||
/*! | ||
* Constructor | ||
*/ | ||
MockFilter(); | ||
|
||
/*! | ||
* Destructor. | ||
*/ | ||
virtual ~MockFilter(); | ||
|
||
/*! | ||
* Configures the filter from parameters on the parameter server. | ||
*/ | ||
virtual bool configure(); | ||
|
||
/*! | ||
* Copies the input to the output. The time for the update is specified by processingTime_. Optionally the update is logged. | ||
* @param mapIn Input. | ||
* @param mapOut Output. | ||
*/ | ||
virtual bool update(const T& mapIn, T& mapOut); | ||
|
||
private: | ||
|
||
//! Flag indicating wheter to also log on update. | ||
bool printName_; | ||
|
||
//! The time [ms] that the update function takes. | ||
uint processingTime_; | ||
}; | ||
|
||
} /* namespace */ |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* MockFilter.cpp | ||
* | ||
* Created on: Sep 24, 2020 | ||
* Author: Magnus Gärtner | ||
* Institute: ETH Zurich, ANYbotics | ||
*/ | ||
|
||
#include <grid_map_core/GridMap.hpp> | ||
#include <pluginlib/class_list_macros.h> | ||
#include <thread> | ||
#include <chrono> | ||
|
||
#include "grid_map_filters/MockFilter.hpp" | ||
|
||
using namespace filters; | ||
|
||
namespace grid_map { | ||
|
||
template<typename T> | ||
MockFilter<T>::MockFilter() | ||
{ | ||
} | ||
|
||
template<typename T> | ||
MockFilter<T>::~MockFilter() | ||
{ | ||
} | ||
|
||
template<typename T> | ||
bool MockFilter<T>::configure() | ||
{ | ||
if (!FilterBase<T>::getParam(std::string("processing_time"), processingTime_)) { | ||
ROS_ERROR("MockFilter did not find parameter 'processing_time'."); | ||
return false; | ||
} | ||
|
||
if (!FilterBase<T>::getParam(std::string("print_name"), printName_)) { | ||
ROS_ERROR("MockFilter did not find parameter 'print_name'."); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
template<typename T> | ||
bool MockFilter<T>::update(const T& mapIn, T& mapOut) | ||
{ | ||
mapOut = mapIn; | ||
if(printName_){ | ||
ROS_INFO_STREAM(this->getName()<<": update()"); | ||
} | ||
std::this_thread::sleep_for(std::chrono::milliseconds(processingTime_)); | ||
return true; | ||
} | ||
|
||
} /* namespace */ | ||
|
||
PLUGINLIB_EXPORT_CLASS(grid_map::MockFilter<grid_map::GridMap>, filters::FilterBase<grid_map::GridMap>) |