Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

using namespace rmcs;

auto main() -> int try {
auto main() -> int {
using namespace std::chrono_literals;

std::signal(SIGINT, [](int) { util::set_running(false); });
Expand Down Expand Up @@ -117,7 +117,4 @@ auto main() -> int try {
}

rclcpp_node.shutdown();
} catch (const std::exception& e) {
using namespace rmcs;
util::panic(std::format("exception uncatched | {}", e.what()));
}
14 changes: 9 additions & 5 deletions src/utility/image/armor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ auto draw(Image& canvas, const Armor2D& armor) noexcept -> void {
auto genre = get_enum_name(armor.genre);
auto shape = get_enum_name(armor.shape);

auto conf_str = std::format("{:.2f} {} {}", armor.confidence, genre, shape);

auto first = cv::Point2f {};
auto prev = cv::Point2f {};
auto is_first = true;
Expand All @@ -41,12 +39,18 @@ auto draw(Image& canvas, const Armor2D& armor) noexcept -> void {
cv::line(opencv_mat, prev, first, color, 2, cv::LINE_AA);
}

const auto thickness = 2;
const auto thickness = 1;
const auto font = cv::FONT_HERSHEY_SIMPLEX;
const auto scale = 0.6;
const auto white = cv::Scalar { 255, 255, 255 };

cv::putText(opencv_mat, "TR", armor.tr, font, scale, white, thickness, cv::LINE_AA);
cv::putText(opencv_mat, "BL", armor.bl, font, scale, white, thickness, cv::LINE_AA);
cv::putText(opencv_mat, "BR", armor.br, font, scale, white, thickness, cv::LINE_AA);

cv::putText(opencv_mat, conf_str, armor.tl + cv::Point2f { 0, -5 }, font, scale, color,
thickness, cv::LINE_AA);
auto info = std::format("{:.2f} {} {}", armor.confidence, genre, shape);
cv::putText(opencv_mat, info, armor.tl + cv::Point2f { 0, -5 }, font, scale, white, thickness,
cv::LINE_AA);
}

}
2 changes: 1 addition & 1 deletion src/utility/panic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ auto panic(const std::string& message, const std::source_location& loc) -> void

std::cerr << panic_tail << std::endl;

std::abort();
throw std::runtime_error { "PANIC HERE" };
}

} // namespace rmcs::util