mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 17:40:23 +08:00
OctoMap: Added occupancy threshold to constructor
This commit is contained in:
@@ -57,7 +57,7 @@ public:
|
|||||||
|
|
||||||
class RTABMAP_EXP OctoMap {
|
class RTABMAP_EXP OctoMap {
|
||||||
public:
|
public:
|
||||||
OctoMap(float voxelSize = 0.1f);
|
OctoMap(float voxelSize = 0.1f, float occupancyThr = 0.5f);
|
||||||
|
|
||||||
const std::map<int, Transform> & addedNodes() const {return addedNodes_;}
|
const std::map<int, Transform> & addedNodes() const {return addedNodes_;}
|
||||||
void addToCache(int nodeId,
|
void addToCache(int nodeId,
|
||||||
|
|||||||
@@ -491,7 +491,7 @@ class RTABMAP_EXP Parameters
|
|||||||
RTABMAP_PARAM(Grid, NoiseFilteringRadius, float, 0.0, "Noise filtering radius (0=disabled). Done after segmentation.");
|
RTABMAP_PARAM(Grid, NoiseFilteringRadius, float, 0.0, "Noise filtering radius (0=disabled). Done after segmentation.");
|
||||||
RTABMAP_PARAM(Grid, NoiseFilteringMinNeighbors, int, 5, "Noise filtering minimum neighbors.");
|
RTABMAP_PARAM(Grid, NoiseFilteringMinNeighbors, int, 5, "Noise filtering minimum neighbors.");
|
||||||
RTABMAP_PARAM(Grid, Scan2dUnknownSpaceFilled, bool, false, "Unknown space filled. Only used with 2D laser scans.");
|
RTABMAP_PARAM(Grid, Scan2dUnknownSpaceFilled, bool, false, "Unknown space filled. Only used with 2D laser scans.");
|
||||||
RTABMAP_PARAM(Grid, Scan2dMaxFilledRange, float, 6.0, "Unknown space filled maximum range. If 0, the laser scan maximum range is used.");
|
RTABMAP_PARAM(Grid, Scan2dMaxFilledRange, float, 4.0, "Unknown space filled maximum range. If 0, the laser scan maximum range is used.");
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~Parameters();
|
virtual ~Parameters();
|
||||||
|
|||||||
@@ -35,10 +35,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
namespace rtabmap {
|
namespace rtabmap {
|
||||||
|
|
||||||
OctoMap::OctoMap(float voxelSize) :
|
OctoMap::OctoMap(float voxelSize, float occupancyThr) :
|
||||||
octree_(new octomap::ColorOcTree(voxelSize)),
|
octree_(new octomap::ColorOcTree(voxelSize)),
|
||||||
hasColor_(false)
|
hasColor_(false)
|
||||||
{
|
{
|
||||||
|
octree_->setOccupancyThres(occupancyThr);
|
||||||
UASSERT(voxelSize>0.0f);
|
UASSERT(voxelSize>0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -159,6 +159,7 @@ public:
|
|||||||
bool isOctomap2dGrid() const;
|
bool isOctomap2dGrid() const;
|
||||||
int getOctomapTreeDepth() const;
|
int getOctomapTreeDepth() const;
|
||||||
bool isOctomapGroundAnObstacle() const;
|
bool isOctomapGroundAnObstacle() const;
|
||||||
|
double getOctomapOccupancyThr() const;
|
||||||
int getCloudDecimation(int index) const; // 0=map, 1=odom
|
int getCloudDecimation(int index) const; // 0=map, 1=odom
|
||||||
double getCloudMaxDepth(int index) const; // 0=map, 1=odom
|
double getCloudMaxDepth(int index) const; // 0=map, 1=odom
|
||||||
double getCloudMinDepth(int index) const; // 0=map, 1=odom
|
double getCloudMinDepth(int index) const; // 0=map, 1=odom
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ MainWindow::MainWindow(PreferencesDialog * prefDialog, QWidget * parent) :
|
|||||||
|
|
||||||
_occupancyGrid = new OccupancyGrid(_preferencesDialog->getAllParameters());
|
_occupancyGrid = new OccupancyGrid(_preferencesDialog->getAllParameters());
|
||||||
#ifdef RTABMAP_OCTOMAP
|
#ifdef RTABMAP_OCTOMAP
|
||||||
_octomap = new OctoMap(_preferencesDialog->getGridMapResolution());
|
_octomap = new OctoMap(_preferencesDialog->getGridMapResolution(), _preferencesDialog->getOctomapOccupancyThr());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Timer
|
// Timer
|
||||||
@@ -4037,7 +4037,9 @@ void MainWindow::startDetection()
|
|||||||
#ifdef RTABMAP_OCTOMAP
|
#ifdef RTABMAP_OCTOMAP
|
||||||
UASSERT(_octomap != 0);
|
UASSERT(_octomap != 0);
|
||||||
delete _octomap;
|
delete _octomap;
|
||||||
_octomap = new OctoMap(_preferencesDialog->getGridMapResolution());
|
_octomap = new OctoMap(
|
||||||
|
_preferencesDialog->getGridMapResolution(),
|
||||||
|
_preferencesDialog->getOctomapOccupancyThr());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_occupancyGrid->clear();
|
_occupancyGrid->clear();
|
||||||
@@ -5061,7 +5063,7 @@ void MainWindow::clearTheCache()
|
|||||||
// re-create one if the resolution has changed
|
// re-create one if the resolution has changed
|
||||||
UASSERT(_octomap != 0);
|
UASSERT(_octomap != 0);
|
||||||
delete _octomap;
|
delete _octomap;
|
||||||
_octomap = new OctoMap(_preferencesDialog->getGridMapResolution());
|
_octomap = new OctoMap(_preferencesDialog->getGridMapResolution(), _preferencesDialog->getOctomapOccupancyThr());
|
||||||
#endif
|
#endif
|
||||||
_occupancyGrid->clear();
|
_occupancyGrid->clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1245,6 +1245,7 @@ void PreferencesDialog::resetSettings(QGroupBox * groupBox)
|
|||||||
_ui->spinBox_octomap_treeDepth->setValue(16);
|
_ui->spinBox_octomap_treeDepth->setValue(16);
|
||||||
_ui->checkBox_octomap_2dgrid->setChecked(true);
|
_ui->checkBox_octomap_2dgrid->setChecked(true);
|
||||||
_ui->checkBox_octomap_show3dMap->setChecked(true);
|
_ui->checkBox_octomap_show3dMap->setChecked(true);
|
||||||
|
_ui->doubleSpinBox_octomap_occupancyThr->setValue(0.5);
|
||||||
}
|
}
|
||||||
else if(groupBox->objectName() == _ui->groupBox_logging1->objectName())
|
else if(groupBox->objectName() == _ui->groupBox_logging1->objectName())
|
||||||
{
|
{
|
||||||
@@ -1596,6 +1597,7 @@ void PreferencesDialog::readGuiSettings(const QString & filePath)
|
|||||||
_ui->spinBox_octomap_treeDepth->setValue(settings.value("octomap_depth", _ui->spinBox_octomap_treeDepth->value()).toInt());
|
_ui->spinBox_octomap_treeDepth->setValue(settings.value("octomap_depth", _ui->spinBox_octomap_treeDepth->value()).toInt());
|
||||||
_ui->checkBox_octomap_2dgrid->setChecked(settings.value("octomap_2dgrid", _ui->checkBox_octomap_2dgrid->isChecked()).toBool());
|
_ui->checkBox_octomap_2dgrid->setChecked(settings.value("octomap_2dgrid", _ui->checkBox_octomap_2dgrid->isChecked()).toBool());
|
||||||
_ui->checkBox_octomap_show3dMap->setChecked(settings.value("octomap_3dmap", _ui->checkBox_octomap_show3dMap->isChecked()).toBool());
|
_ui->checkBox_octomap_show3dMap->setChecked(settings.value("octomap_3dmap", _ui->checkBox_octomap_show3dMap->isChecked()).toBool());
|
||||||
|
_ui->doubleSpinBox_octomap_occupancyThr->setValue(settings.value("octomap_occupancy_thr", _ui->doubleSpinBox_octomap_occupancyThr->value()).toDouble());
|
||||||
|
|
||||||
_ui->groupBox_organized->setChecked(settings.value("meshing", _ui->groupBox_organized->isChecked()).toBool());
|
_ui->groupBox_organized->setChecked(settings.value("meshing", _ui->groupBox_organized->isChecked()).toBool());
|
||||||
_ui->doubleSpinBox_mesh_angleTolerance->setValue(settings.value("meshing_angle", _ui->doubleSpinBox_mesh_angleTolerance->value()).toDouble());
|
_ui->doubleSpinBox_mesh_angleTolerance->setValue(settings.value("meshing_angle", _ui->doubleSpinBox_mesh_angleTolerance->value()).toDouble());
|
||||||
@@ -2008,6 +2010,8 @@ void PreferencesDialog::writeGuiSettings(const QString & filePath) const
|
|||||||
settings.setValue("octomap_depth", _ui->spinBox_octomap_treeDepth->value());
|
settings.setValue("octomap_depth", _ui->spinBox_octomap_treeDepth->value());
|
||||||
settings.setValue("octomap_2dgrid", _ui->checkBox_octomap_2dgrid->isChecked());
|
settings.setValue("octomap_2dgrid", _ui->checkBox_octomap_2dgrid->isChecked());
|
||||||
settings.setValue("octomap_3dmap", _ui->checkBox_octomap_show3dMap->isChecked());
|
settings.setValue("octomap_3dmap", _ui->checkBox_octomap_show3dMap->isChecked());
|
||||||
|
settings.setValue("octomap_occupancy_thr", _ui->doubleSpinBox_octomap_occupancyThr->value());
|
||||||
|
|
||||||
|
|
||||||
settings.setValue("meshing", _ui->groupBox_organized->isChecked());
|
settings.setValue("meshing", _ui->groupBox_organized->isChecked());
|
||||||
settings.setValue("meshing_angle", _ui->doubleSpinBox_mesh_angleTolerance->value());
|
settings.setValue("meshing_angle", _ui->doubleSpinBox_mesh_angleTolerance->value());
|
||||||
@@ -3717,6 +3721,10 @@ bool PreferencesDialog::isOctomapGroundAnObstacle() const
|
|||||||
{
|
{
|
||||||
return _ui->checkBox_grid_groundObstacle->isChecked();
|
return _ui->checkBox_grid_groundObstacle->isChecked();
|
||||||
}
|
}
|
||||||
|
double PreferencesDialog::getOctomapOccupancyThr() const
|
||||||
|
{
|
||||||
|
return _ui->doubleSpinBox_octomap_occupancyThr->value();
|
||||||
|
}
|
||||||
|
|
||||||
double PreferencesDialog::getMapVoxel() const
|
double PreferencesDialog::getMapVoxel() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>-500</y>
|
<y>0</y>
|
||||||
<width>678</width>
|
<width>678</width>
|
||||||
<height>2417</height>
|
<height>2417</height>
|
||||||
</rect>
|
</rect>
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>15</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page_22">
|
<widget class="QWidget" name="page_22">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_29" stretch="0,1">
|
<layout class="QVBoxLayout" name="verticalLayout_29" stretch="0,1">
|
||||||
@@ -1759,6 +1759,29 @@ Show a yellow background when the number of odometry inliers goes under this thr
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLabel" name="label_octomap_treeDepth_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Occupancy threshold.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QDoubleSpinBox" name="doubleSpinBox_octomap_occupancyThr">
|
||||||
|
<property name="maximum">
|
||||||
|
<double>1.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>0.500000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user