Skip to content

Commit 48ba55d

Browse files
committed
Fixed #197 (handling zed pose confidence == -1)
1 parent 5223629 commit 48ba55d

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

corelib/src/CameraStereo.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,32 +1029,40 @@ SensorData CameraStereoZed::captureImage(CameraInfo * info)
10291029
sl::Pose pose;
10301030
zed_->getPosition(pose);
10311031
int trackingConfidence = pose.pose_confidence;
1032-
if (trackingConfidence)
1032+
// FIXME What does pose_confidence == -1 mean?
1033+
if (trackingConfidence>0)
10331034
{
10341035
info->odomPose = zedPoseToTransform(pose);
10351036
if (!info->odomPose.isNull())
10361037
{
10371038
//transform x->forward, y->left, z->up
10381039
Transform opticalTransform(0, 0, 1, 0, -1, 0, 0, 0, 0, -1, 0, 0);
10391040
info->odomPose = opticalTransform * info->odomPose * opticalTransform.inverse();
1040-
}
1041-
if (lost_)
1042-
{
1043-
info->odomCovariance = cv::Mat::eye(6, 6, CV_64FC1) * 9999.0f; // don't know transform with previous pose
1044-
lost_ = false;
1045-
UDEBUG("Init %s (var=%f)", info->odomPose.prettyPrint().c_str(), 9999.0f);
1041+
1042+
if (lost_)
1043+
{
1044+
info->odomCovariance = cv::Mat::eye(6, 6, CV_64FC1) * 9999.0f; // don't know transform with previous pose
1045+
lost_ = false;
1046+
UDEBUG("Init %s (var=%f)", info->odomPose.prettyPrint().c_str(), 9999.0f);
1047+
}
1048+
else
1049+
{
1050+
info->odomCovariance = cv::Mat::eye(6, 6, CV_64FC1) * 1.0f / float(trackingConfidence);
1051+
UDEBUG("Run %s (var=%f)", info->odomPose.prettyPrint().c_str(), 1.0f / float(trackingConfidence));
1052+
}
10461053
}
10471054
else
10481055
{
1049-
info->odomCovariance = cv::Mat::eye(6, 6, CV_64FC1) * 1.0f / float(trackingConfidence);
1050-
UDEBUG("Run %s (var=%f)", info->odomPose.prettyPrint().c_str(), 1.0f / float(trackingConfidence));
1056+
info->odomCovariance = cv::Mat::eye(6, 6, CV_64FC1) * 9999.0f; // lost
1057+
lost_ = true;
1058+
UWARN("ZED lost! (trackingConfidence=%d)", trackingConfidence);
10511059
}
10521060
}
10531061
else
10541062
{
10551063
info->odomCovariance = cv::Mat::eye(6, 6, CV_64FC1) * 9999.0f; // lost
10561064
lost_ = true;
1057-
UWARN("ZED lost!");
1065+
UWARN("ZED lost! (trackingConfidence=%d)", trackingConfidence);
10581066
}
10591067
}
10601068
}

0 commit comments

Comments
 (0)