Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft/check ci #7175

Closed
wants to merge 30 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
30467aa
feat(traffic_light_fine_detector): update function for waited IoU
Shin-kyoto May 20, 2024
8c28620
test(traffic_light_fine_detector): add test for util function
Shin-kyoto May 20, 2024
fa31134
test(traffic_light_fine_detector): update CMakeLists.txt with short e…
Shin-kyoto May 20, 2024
b929b13
chore(traffic_light_fine_detector): apply pre-commit
Shin-kyoto May 20, 2024
3365dcb
chore(traffic_light_fine_detector): remove misspelling
Shin-kyoto May 20, 2024
761a221
feat(traffic_light_fine_detector): move definition of util function t…
Shin-kyoto May 21, 2024
aa071cc
Merge branch 'main' into feat/update-tlr-util-function
Shin-kyoto May 21, 2024
981217a
Merge branch 'main' into feat/update-tlr-util-function
Shin-kyoto May 21, 2024
a948ae3
test(traffic_light_fine_detector): make CMakeLists shorter by using a…
Shin-kyoto May 24, 2024
9f1ab61
test(traffic_light_fine_detector): remove unnecessary compiling
Shin-kyoto May 26, 2024
a4160d5
test(traffic_light_fine_detector): disable test that fails now
Shin-kyoto May 29, 2024
c76b5fd
test(traffic_light_fine_detector): add const to variables that do not…
Shin-kyoto May 29, 2024
441a6ff
test(traffic_light_fine_detector): add const to the arguments
Shin-kyoto May 29, 2024
327c358
chore: set CUDA_ARCHITECTURE. This commit should not be merged.
Shin-kyoto May 30, 2024
3cabf12
Revert "chore: set CUDA_ARCHITECTURE. This commit should not be merged."
Shin-kyoto May 30, 2024
a2477c7
chore: remove test code to check CI. this commit should not be merged
Shin-kyoto May 30, 2024
0ff8bed
Revert "chore: remove test code to check CI. this commit should not b…
Shin-kyoto May 30, 2024
145bf55
feat(traffic_light_fine_detector): add link library for test
Shin-kyoto May 30, 2024
7777709
feat(traffic_light_fine_detector): add target directories for test
Shin-kyoto May 30, 2024
85aeaa4
Revert "feat(traffic_light_fine_detector): move definition of util fu…
Shin-kyoto May 30, 2024
0ffe4db
Revert "feat(traffic_light_fine_detector): update function for waited…
Shin-kyoto May 30, 2024
0129f28
Revert "feat(traffic_light_fine_detector): add target directories for…
Shin-kyoto May 30, 2024
f54a2bb
Revert "feat(traffic_light_fine_detector): add link library for test"
Shin-kyoto May 30, 2024
db9db2a
feat(traffic_light_fine_detector): remove test cases
Shin-kyoto May 30, 2024
a542a98
feat(traffic_light_fine_detector): add test function
Shin-kyoto May 30, 2024
2f6f80c
Revert "Revert "feat(traffic_light_fine_detector): update function fo…
Shin-kyoto May 30, 2024
4c941e3
Revert "Revert "feat(traffic_light_fine_detector): move definition of…
Shin-kyoto May 30, 2024
afb9953
feat(traffic_light_fine_detector): add test case
Shin-kyoto May 30, 2024
ff5aed1
feat(traffic_light_fine_detector): add code for checking ci
Shin-kyoto May 31, 2024
9870ac9
feat(traffic_light_fine_detector): add code for checking ci
Shin-kyoto May 31, 2024
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
Prev Previous commit
Next Next commit
chore(traffic_light_fine_detector): apply pre-commit
Signed-off-by: Shin-kyoto <aquashin0202@gmail.com>
Shin-kyoto committed May 20, 2024
commit b929b1373cb55489cd094ff1f855e3fb6b6042ff
37 changes: 25 additions & 12 deletions perception/traffic_light_fine_detector/test/test_nodelet.cpp
Original file line number Diff line number Diff line change
@@ -13,9 +13,11 @@
// limitations under the License.

#include "traffic_light_fine_detector/nodelet.hpp"

#include <gtest/gtest.h>

sensor_msgs::msg::RegionOfInterest createMapBasedBbox(uint32_t x_offset, uint32_t y_offset, uint32_t width, uint32_t height)
sensor_msgs::msg::RegionOfInterest createMapBasedBbox(
uint32_t x_offset, uint32_t y_offset, uint32_t width, uint32_t height)
{
sensor_msgs::msg::RegionOfInterest bbox;
bbox.x_offset = x_offset;
@@ -25,70 +27,81 @@
return bbox;
}

tensorrt_yolox::Object createYoloxBbox(int32_t x_offset, int32_t y_offset, int32_t width, int32_t height, float score, int32_t type)
tensorrt_yolox::Object createYoloxBbox(
int32_t x_offset, int32_t y_offset, int32_t width, int32_t height, float score, int32_t type)
{
tensorrt_yolox::Object bbox;
bbox.x_offset = x_offset;
bbox.y_offset = y_offset;
bbox.width = width;
bbox.height = height;
bbox.score = score;
bbox.type = type;
return bbox;
}

Check warning on line 41 in perception/traffic_light_fine_detector/test/test_nodelet.cpp

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Excess Number of Function Arguments

createYoloxBbox has 6 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

TEST(CalWeightedIouTest, NoOverlap) {
TEST(CalWeightedIouTest, NoOverlap)
{
sensor_msgs::msg::RegionOfInterest map_based_bbox = createMapBasedBbox(0, 0, 10, 10);
tensorrt_yolox::Object yolox_bbox = createYoloxBbox(20, 20, 10, 10, 0.9f, 0);

EXPECT_FLOAT_EQ(traffic_light::calWeightedIou(map_based_bbox, yolox_bbox), 0.0f);
}

TEST(CalWeightedIouTest, PartiallyOverlap1) {
TEST(CalWeightedIouTest, PartiallyOverlap1)
{
sensor_msgs::msg::RegionOfInterest map_based_bbox = createMapBasedBbox(15, 15, 10, 10);
tensorrt_yolox::Object yolox_bbox = createYoloxBbox(20, 20, 10, 10, 0.7f, 0);

EXPECT_FLOAT_EQ(traffic_light::calWeightedIou(map_based_bbox, yolox_bbox), 0.1f);
}

TEST(CalWeightedIouTest, PartiallyOverlap2) {
TEST(CalWeightedIouTest, PartiallyOverlap2)
{
sensor_msgs::msg::RegionOfInterest map_based_bbox = createMapBasedBbox(0, 0, 10, 10);
tensorrt_yolox::Object yolox_bbox = createYoloxBbox(-5, -5, 10, 10, 0.7f, 0);

EXPECT_FLOAT_EQ(traffic_light::calWeightedIou(map_based_bbox, yolox_bbox), 0.1f);
}

TEST(CalWeightedIouTest, Included1) {
TEST(CalWeightedIouTest, Included1)
{
sensor_msgs::msg::RegionOfInterest map_based_bbox = createMapBasedBbox(20, 20, 10, 10);
tensorrt_yolox::Object yolox_bbox = createYoloxBbox(20, 20, 10, 10, 0.5f, 0);

EXPECT_FLOAT_EQ(traffic_light::calWeightedIou(map_based_bbox, yolox_bbox), 0.5f);
}

TEST(CalWeightedIouTest, Included2) {
TEST(CalWeightedIouTest, Included2)
{
sensor_msgs::msg::RegionOfInterest map_based_bbox = createMapBasedBbox(20, 20, 100, 100);
tensorrt_yolox::Object yolox_bbox = createYoloxBbox(20, 20, 10, 10, 0.5f, 0);

EXPECT_FLOAT_EQ(traffic_light::calWeightedIou(map_based_bbox, yolox_bbox), 0.005f);
}

TEST(CalWeightedIouTest, Zero) {
TEST(CalWeightedIouTest, Zero)
{
sensor_msgs::msg::RegionOfInterest map_based_bbox = createMapBasedBbox(0, 0, 0, 0);
tensorrt_yolox::Object yolox_bbox = createYoloxBbox(0, 0, 0, 0, 0.5f, 0);

EXPECT_FLOAT_EQ(traffic_light::calWeightedIou(map_based_bbox, yolox_bbox), 0.0f);
}

TEST(CalWeightedIouTest, Negative) {
TEST(CalWeightedIouTest, Negative)
{
sensor_msgs::msg::RegionOfInterest map_based_bbox = createMapBasedBbox(0, 0, 10, 10);
tensorrt_yolox::Object yolox_bbox = createYoloxBbox(-5, -5, -5, 10, 0.5f, 0);

EXPECT_FLOAT_EQ(traffic_light::calWeightedIou(map_based_bbox, yolox_bbox), 0.0f);
}

// This test case should be passed but it fails because of unappropriate type casting. Current result is 0.1097561, but it should be 0.0.
// TEST(CalWeightedIouTest, Uint32Max) {
// sensor_msgs::msg::RegionOfInterest map_based_bbox = createMapBasedBbox(UINT32_MAX, UINT32_MAX, 10, 10);
// This test case should be passed but it fails because of unappropriate type casting. Current

Check warning on line 99 in perception/traffic_light_fine_detector/test/test_nodelet.cpp

GitHub Actions / spell-check-partial

Unknown word (unappropriate)
// result is 0.1097561, but it should be 0.0.
// TEST(CalWeightedIouTest, Uint32Max)
// {
// sensor_msgs::msg::RegionOfInterest map_based_bbox =
// createMapBasedBbox(UINT32_MAX, UINT32_MAX, 10, 10);
// tensorrt_yolox::Object yolox_bbox = createYoloxBbox(-5, -5, 10, 10, 0.5f, 0);

// EXPECT_FLOAT_EQ(traffic_light::calWeightedIou(map_based_bbox, yolox_bbox), 0.0f);

Unchanged files with check annotations Beta

// Copyright 2023 TIER IV, Inc.

Check notice on line 1 in perception/traffic_light_fine_detector/src/nodelet.cpp

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Overall Code Complexity

The mean cyclomatic complexity increases from 4.30 to 4.56, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.