Fixing prior and gravity constraints support for SBA with orbslam dep… (#1683)

* Fixing prior and gravity constraints support for SBA with orbslam dependency

* Updated an error log msg
This commit is contained in:
matlabbe
2026-04-05 12:36:54 -07:00
committed by GitHub
parent 1ea8fa2e06
commit 8fd701aabe
7 changed files with 188 additions and 124 deletions
+35 -10
View File
@@ -69,6 +69,7 @@ StatItem::StatItem(const QString & name, bool cacheOn, const std::vector<qreal>
_y = y;
}
_unit->setText(unit);
_value->setTextFormat(Qt::PlainText);
this->updateMenu(menu);
}
@@ -90,7 +91,6 @@ void StatItem::addValue(qreal y)
{
_y.push_back(y);
}
_value->setText(QString::number(y, 'g', 3));
Q_EMIT valueAdded(y);
}
@@ -107,7 +107,6 @@ void StatItem::addValue(qreal x, qreal y)
_x.push_back(x);
}
_value->setText(QString::number(y, 'g', 3));
Q_EMIT valueAdded(x,y);
}
@@ -117,18 +116,23 @@ void StatItem::setValues(const std::vector<qreal> & x, const std::vector<qreal>
{
_x = x;
_y = y;
if(y.size())
{
_value->setNum(y[y.size()-1]);
}
}
else
{
_value->setText("*");
}
Q_EMIT valuesChanged(x,y);
}
void StatItem::updateLabel()
{
QString newText;
if(_y.size())
{
newText = QString::number(_y.back(), 'g', 3);
}
if(newText != _value->text())
{
_value->setText(newText);
}
}
QString StatItem::value() const
{
return _value->text();
@@ -227,6 +231,8 @@ StatsToolBox::StatsToolBox(QWidget * parent) :
_plotMenu->addAction(tr("<New figure>"));
_workingDirectory = QDir::homePath();
_newFigureMaxItems = 0;
_updateLabelsTimer.setSingleShot(true);
connect(&_updateLabelsTimer, &QTimer::timeout, this, &StatsToolBox::updateLabels);
}
StatsToolBox::~StatsToolBox()
@@ -263,6 +269,7 @@ void StatsToolBox::updateStat(const QString & statFullName, qreal y, bool cacheO
std::vector<qreal> vx,vy(1);
vy[0] = y;
updateStat(statFullName, vx, vy, cacheOn);
requestLabelsUpdate();
}
void StatsToolBox::updateStat(const QString & statFullName, qreal x, qreal y, bool cacheOn)
@@ -271,6 +278,7 @@ void StatsToolBox::updateStat(const QString & statFullName, qreal x, qreal y, bo
vx[0] = x;
vy[0] = y;
updateStat(statFullName, vx, vy, cacheOn);
requestLabelsUpdate();
}
void StatsToolBox::updateStat(const QString & statFullName, const std::vector<qreal> & x, const std::vector<qreal> & y, bool cacheOn)
@@ -295,6 +303,7 @@ void StatsToolBox::updateStat(const QString & statFullName, const std::vector<qr
{
item->setValues(x, y);
}
requestLabelsUpdate();
}
else
{
@@ -378,6 +387,22 @@ void StatsToolBox::updateStat(const QString & statFullName, const std::vector<qr
}
}
void StatsToolBox::requestLabelsUpdate()
{
if(!_updateLabelsTimer.isActive())
{
_updateLabelsTimer.start(100); // Max 10 Hz
}
}
void StatsToolBox::updateLabels()
{
QList<StatItem *> items = _statBox->findChildren<StatItem *>();
for(int i=0; i<items.size(); ++i)
{
items[i]->updateLabel();
}
}
void StatsToolBox::plot(const StatItem * stat, const QString & plotName)
{
QWidget * fig = _figures.value(plotName, (QWidget*)0);