diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index c48a022..dc06d8a 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -4,6 +4,7 @@ Changelog for package rviz_satellite
Forthcoming
-----------
+* Don't show map if transform is missing
* Fix demo.launch
1.2.0 (2019-03-07)
diff --git a/launch/demo.launch b/launch/demo.launch
index be5e275..8be7e89 100644
--- a/launch/demo.launch
+++ b/launch/demo.launch
@@ -3,7 +3,7 @@
-
+
diff --git a/src/aerialmap_display.cpp b/src/aerialmap_display.cpp
index 4474e06..d2bcbed 100644
--- a/src/aerialmap_display.cpp
+++ b/src/aerialmap_display.cpp
@@ -290,8 +290,8 @@ void AerialMapDisplay::navFixCallback(sensor_msgs::NavSatFixConstPtr const& msg)
// re-load imagery
received_msg_ = true;
- loadImagery();
transformAerialMap();
+ loadImagery();
}
void AerialMapDisplay::loadImagery()
@@ -310,6 +310,11 @@ void AerialMapDisplay::loadImagery()
return;
}
+ if (!hasWorkingTransform_)
+ {
+ return;
+ }
+
if (tile_url_.empty())
{
setStatus(StatusProperty::Error, "Message", "Tile URL is not set");
@@ -507,6 +512,8 @@ void AerialMapDisplay::transformAerialMap()
{
context_->getFrameManager()->setFixedFrame(lastFixedFrame_);
setStatus(StatusProperty::Error, "Transform", QString::fromStdString(errMsg));
+ hasWorkingTransform_ = false;
+ clear();
return;
}
@@ -529,6 +536,8 @@ void AerialMapDisplay::transformAerialMap()
"Could not transform from [" + QString::fromStdString(frame) + "] to Fixed Frame [" + fixed_frame_ +
"] for an unknown reason");
}
+ hasWorkingTransform_ = false;
+ clear();
return;
}
@@ -537,9 +546,12 @@ void AerialMapDisplay::transformAerialMap()
// This can occur if an invalid TF is published.
// Show an error and don't apply anything, so OGRE does not throw an assertion.
setStatus(StatusProperty::Error, "Transform", "Received invalid transform");
+ hasWorkingTransform_ = false;
+ clear();
return;
}
+ hasWorkingTransform_ = true;
setStatus(StatusProperty::Ok, "Transform", "Transform OK");
// apply transform and add offset from origin
diff --git a/src/aerialmap_display.h b/src/aerialmap_display.h
index 404f973..bc75ab1 100644
--- a/src/aerialmap_display.h
+++ b/src/aerialmap_display.h
@@ -175,6 +175,8 @@ protected Q_SLOTS:
boost::optional lastTileId_;
std::string lastFixedFrame_;
+ bool hasWorkingTransform_ = false;
+
/**
* Calculate the tile width/ height in meter
*/