Skip to content

Commit 2f9de5a

Browse files
committed
fix: set pose covariance to identity matrix
1 parent 25da3ff commit 2f9de5a

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

aruco-detector/src/aruco_detector_ros.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ ArucoDetectorNode::ArucoDetectorNode(const rclcpp::NodeOptions& options)
1212
detect_board_ = this->declare_parameter<bool>("detect_board");
1313
visualize_ = this->declare_parameter<bool>("visualize");
1414
log_markers_ = this->declare_parameter<bool>("log_markers");
15-
publish_detections_ =
16-
this->declare_parameter<bool>("publish_detections");
17-
publish_landmarks_ =
18-
this->declare_parameter<bool>("publish_landmarks");
15+
publish_detections_ = this->declare_parameter<bool>("publish_detections");
16+
publish_landmarks_ = this->declare_parameter<bool>("publish_landmarks");
1917

2018
this->declare_parameter<float>("aruco.marker_size");
2119
this->declare_parameter<std::string>("aruco.dictionary");
@@ -222,6 +220,12 @@ void ArucoDetectorNode::imageCallback(
222220
board_pose_cov.pose = pose_msg.pose;
223221
std::fill(board_pose_cov.covariance.begin(),
224222
board_pose_cov.covariance.end(), 0.0);
223+
224+
// Set covariance to identity
225+
for (int i = 0; i < 6; ++i) {
226+
board_pose_cov.covariance[i * 6 + i] = 1.0;
227+
}
228+
225229
board_landmark.pose = board_pose_cov;
226230

227231
landmark_array.landmarks.push_back(board_landmark);
@@ -271,6 +275,10 @@ void ArucoDetectorNode::imageCallback(
271275
geometry_msgs::msg::PoseWithCovariance pose_cov;
272276
pose_cov.pose = pose_msg.pose;
273277
std::fill(pose_cov.covariance.begin(), pose_cov.covariance.end(), 0.0);
278+
// Set covariance to identity
279+
for (int i = 0; i < 36; i += 7) {
280+
pose_cov.covariance[i] = 1.0;
281+
}
274282
landmark.pose = pose_cov;
275283
landmark_array.landmarks.push_back(landmark);
276284
}

0 commit comments

Comments
 (0)