mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-09 21:10:19 +08:00
Fixed DataRecorder UI asserting if data without images is received (in case of monocular or lidar-only recording). rtabmap-dataRecorder: added auto-close when end of stream is reached. rtabmap-reprocess: added ability to process images without odometry and to record localization poses with -p option in localizatiion mode.
This commit is contained in:
@@ -156,8 +156,12 @@ void DataRecorder::addData(const rtabmap::SensorData & data, const Transform & p
|
||||
void DataRecorder::showImage(const cv::Mat & image, const cv::Mat & depth)
|
||||
{
|
||||
processingImages_ = true;
|
||||
imageView_->setImage(uCvMat2QImage(image));
|
||||
imageView_->setImageDepth(depth);
|
||||
if(!image.empty()) {
|
||||
imageView_->setImage(uCvMat2QImage(image));
|
||||
}
|
||||
if(!depth.empty()) {
|
||||
imageView_->setImageDepth(depth);
|
||||
}
|
||||
label_->setText(tr("Images=%1 (~%2 MB)").arg(count_).arg(totalSizeKB_/1000));
|
||||
processingImages_ = false;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <rtabmap/core/CameraRGBD.h>
|
||||
#include <rtabmap/core/CameraStereo.h>
|
||||
#include <rtabmap/core/Camera.h>
|
||||
#include <rtabmap/core/SensorEvent.h>
|
||||
#include <rtabmap/core/DBReader.h>
|
||||
#include <rtabmap/core/SensorCaptureThread.h>
|
||||
#include <rtabmap/core/SensorCaptureThread.h>
|
||||
@@ -71,6 +72,31 @@ void sighandler(int sig)
|
||||
}
|
||||
}
|
||||
|
||||
// Detect when we reached end-of-files
|
||||
class StatusHandler: public UEventsHandler{
|
||||
protected:
|
||||
virtual bool handleEvent(UEvent * event)
|
||||
{
|
||||
if(event->getClassName().compare("SensorEvent") == 0)
|
||||
{
|
||||
SensorEvent * camEvent = (SensorEvent*)event;
|
||||
if(camEvent->getCode() == SensorEvent::kCodeNoMoreImages)
|
||||
{
|
||||
printf("End of stream reached...\n");
|
||||
if(cam)
|
||||
{
|
||||
cam->join(true);
|
||||
}
|
||||
if(app)
|
||||
{
|
||||
QMetaObject::invokeMethod(app, "quit");
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
int main (int argc, char * argv[])
|
||||
{
|
||||
ULogger::setType(ULogger::kTypeConsole);
|
||||
@@ -138,6 +164,10 @@ int main (int argc, char * argv[])
|
||||
signal(SIGTERM, &sighandler);
|
||||
signal(SIGINT, &sighandler);
|
||||
|
||||
// Catch end of stream to close the gui
|
||||
StatusHandler statusHandler;
|
||||
statusHandler.registerToEventsManager();
|
||||
|
||||
rtabmap::Camera * camera = dialog.createCamera();
|
||||
if(camera == 0)
|
||||
{
|
||||
|
||||
@@ -1024,7 +1024,7 @@ int main(int argc, char * argv[])
|
||||
|
||||
UTimer iterationTime;
|
||||
std::string status;
|
||||
if(!odometryIgnored && info.odomPose.isNull())
|
||||
if(!odometryIgnored && info.odomPose.isNull() && incrementalMemory)
|
||||
{
|
||||
printf("Skipping node %d as it doesn't have odometry pose set.\n", data.id());
|
||||
}
|
||||
@@ -1235,15 +1235,22 @@ int main(int argc, char * argv[])
|
||||
localizationAngleVariations.push_back(stats.data().at(Statistics::kLoopOdom_correction_angle()));
|
||||
}
|
||||
|
||||
if(exportPoses && !info.odomPose.isNull())
|
||||
if(exportPoses)
|
||||
{
|
||||
if(!odomTrajectoryPoses.empty())
|
||||
if(!info.odomPose.isNull())
|
||||
{
|
||||
int previousId = odomTrajectoryPoses.rbegin()->first;
|
||||
odomTrajectoryLinks.insert(std::make_pair(previousId, Link(previousId, refId, Link::kNeighbor, odomTrajectoryPoses.rbegin()->second.inverse()*info.odomPose, info.odomCovariance)));
|
||||
if(!odomTrajectoryPoses.empty())
|
||||
{
|
||||
int previousId = odomTrajectoryPoses.rbegin()->first;
|
||||
odomTrajectoryLinks.insert(std::make_pair(previousId, Link(previousId, refId, Link::kNeighbor, odomTrajectoryPoses.rbegin()->second.inverse()*info.odomPose, info.odomCovariance)));
|
||||
}
|
||||
odomTrajectoryPoses.insert(std::make_pair(refId, info.odomPose));
|
||||
localizationPoses.insert(std::make_pair(refId, stats.mapCorrection()*info.odomPose));
|
||||
}
|
||||
else
|
||||
{
|
||||
localizationPoses.insert(std::make_pair(refId, rtabmap.getLastLocalizationPose()));
|
||||
}
|
||||
odomTrajectoryPoses.insert(std::make_pair(refId, info.odomPose));
|
||||
localizationPoses.insert(std::make_pair(refId, stats.mapCorrection()*info.odomPose));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user