mirror of
https://github.com/introlab/rtabmap.git
synced 2026-10-04 09:07:47 +08:00
Fixed PnP camera matrix empty when computing loop closure. Updated odometry nonholomic motion estimation (using arc around ICR).
This commit is contained in:
+34
-14
@@ -1975,20 +1975,29 @@ Transform Memory::computeVisualTransform(
|
||||
UWARN("PnP estimation and Epipolar geometry estimation are set, only PnP is used.");
|
||||
}
|
||||
|
||||
if(!newS.sensorData().rightRaw().empty() && !newS.sensorData().stereoCameraModel().isValid())
|
||||
{
|
||||
UERROR("Calibrated stereo camera required");
|
||||
}
|
||||
else if(!newS.sensorData().depthRaw().empty() &&
|
||||
(newS.sensorData().cameraModels().size() != 1 || !newS.sensorData().cameraModels()[0].isValid()))
|
||||
if((!newS.sensorData().rightRaw().empty() ||
|
||||
!newS.sensorData().stereoCameraModel().isValid()) &&
|
||||
(!newS.sensorData().depthRaw().empty() ||
|
||||
newS.sensorData().cameraModels().size() != 1 ||
|
||||
!newS.sensorData().cameraModels()[0].isValid()))
|
||||
{
|
||||
UERROR("Calibrated camera required (multi-cameras not supported).");
|
||||
}
|
||||
else
|
||||
{
|
||||
cv::Mat K = newS.sensorData().cameraModels().size()?newS.sensorData().cameraModels()[0].K():newS.sensorData().stereoCameraModel().left().K();
|
||||
Transform localTransform = newS.sensorData().cameraModels().size()?newS.sensorData().cameraModels()[0].localTransform():newS.sensorData().stereoCameraModel().left().localTransform();
|
||||
|
||||
cv::Mat K;
|
||||
Transform localTransform;
|
||||
if(newS.sensorData().cameraModels().size())
|
||||
{
|
||||
K = newS.sensorData().cameraModels()[0].K();
|
||||
localTransform = newS.sensorData().cameraModels()[0].localTransform();
|
||||
}
|
||||
else
|
||||
{
|
||||
K = newS.sensorData().stereoCameraModel().left().K();
|
||||
localTransform = newS.sensorData().stereoCameraModel().left().localTransform();
|
||||
}
|
||||
UASSERT(!K.empty() && !localTransform.isNull());
|
||||
// 2D -> 3D
|
||||
if(!oldS.getWords3().empty() && !newS.getWords().empty())
|
||||
{
|
||||
@@ -4268,11 +4277,22 @@ Signature * Memory::createSignature(const SensorData & data, const Transform & p
|
||||
data.stamp(),
|
||||
"",
|
||||
pose,
|
||||
data.userData(),
|
||||
SensorData(
|
||||
rtabmap::compressData2(laserScan),
|
||||
data.laserScanMaxPts(),
|
||||
cv::Mat(), cv::Mat(), CameraModel(), id));
|
||||
data.userData(),
|
||||
stereoCameraModel.isValid()?
|
||||
SensorData(
|
||||
rtabmap::compressData2(laserScan),
|
||||
data.laserScanMaxPts(),
|
||||
cv::Mat(),
|
||||
cv::Mat(),
|
||||
stereoCameraModel,
|
||||
id):
|
||||
SensorData(
|
||||
rtabmap::compressData2(laserScan),
|
||||
data.laserScanMaxPts(),
|
||||
cv::Mat(),
|
||||
cv::Mat(),
|
||||
cameraModels,
|
||||
id));
|
||||
}
|
||||
s->setWords(words);
|
||||
s->setWords3(words3D);
|
||||
|
||||
Reference in New Issue
Block a user