Skip to content

#KL25-18 カラーセンサから値を取得する#5

Closed
HaruArima08 wants to merge 5 commits intomainfrom
ticket-KL25-18
Closed

#KL25-18 カラーセンサから値を取得する#5
HaruArima08 wants to merge 5 commits intomainfrom
ticket-KL25-18

Conversation

@HaruArima08
Copy link
Copy Markdown
Contributor

@HaruArima08 HaruArima08 commented May 19, 2025

チェックリスト

  • clang-format している
  • コーディング規約に準じている
  • チケットの完了条件を満たしている

変更点

  • カラーセンサを制御するColorSensorクラスの作成

  • ColorSensorクラスのダミーファイル作成

  • ColorSensorクラスの値取得をする関数のテストを行う、ColorMeasureTest.cppの追加

@notion-workspace
Copy link
Copy Markdown

Copy link
Copy Markdown
Collaborator

@takuchi17 takuchi17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ちょっと時間的な理由で表面上しか見れてません。後日ちゃんと見ます😣

CMakeLists.txt Outdated
${PROJECT_TEST_DIR}/dummy
${PROJECT_TEST_DIR}/helpers
)
)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

この括弧は一個下げた方が気持ちいい

Comment on lines +40 to +45
/**
* カラーセンサのRGB値を取得する
* @param 値を設定するRGB構造体、各色10ビット
* @return -
*/
void getRGB(RGB& rgb) const
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

細かいけど説明に引数名がないかな。

Suggested change
/**
* カラーセンサのRGB値を取得する
* @param 値を設定するRGB構造体各色10ビット
* @return -
*/
void getRGB(RGB& rgb) const
/**
* カラーセンサのRGB値を取得する
* @param rgb 値を設定するRGB構造体各色10ビット
* @return -
*/
void getRGB(RGB& rgb) const

Comment on lines +53 to +58
/**
* カラーセンサで色を測定する
* @param surface trueならば表面の色から、falseならば他の光源の色を検出する
* @return 色(hsvによる表現)
*/
void getColor(HSV& hsv, bool surface = true) const
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

引数の説明にhsvがない

Suggested change
/**
* カラーセンサで色を測定する
* @param surface trueならば表面の色からfalseならば他の光源の色を検出する
* @return hsvによる表現
*/
void getColor(HSV& hsv, bool surface = true) const
/**
* カラーセンサで色を測定する
* @param surface trueならば表面の色からfalseならば他の光源の色を検出する
* @param hsv なんちゃら
* @return hsvによる表現
*/
void getColor(HSV& hsv, bool surface = true) const

Comment on lines +66 to +70
/**
* カラーセンサで色を測定する(近似なし)
* @param surface trueならば表面の色から、falseならば他の光源の色を検出する
* @return 色(hsvによる表現)
*/
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここも引数hsvの説明がないな

Comment on lines +7 to +8
#ifndef PORT_H_
#define PORT_H_
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hの後に_って他のクラスつけてたっけ?他のインクルードガードをPORT_Hにすることは多分ないから大丈夫だと思うけど、一応確認。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ダミーの方は PORT_H になってるからミス?
多分ビルド対象外になってたはずだから、PORT_H でも大丈夫なはず

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同じ名前が重複するとインクルードガード効かずビルドが通らなかったので、クラスの方とダミーのほうで分けて書いてました。
分かりやすくクラスのほうは _ 外して、ダミーは先頭に DUMMY_ を足してみました。

@@ -0,0 +1,126 @@
/**
* @file ColorMeasureTest.cpp
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ColorSensor.cppじゃないのは何で?理由があるならいいけど、ないならソースファイルと統一してもらいたい🙏

Suggested change
* @file ColorMeasureTest.cpp
* @file ColorSensorTest.cpp

@@ -0,0 +1,76 @@
/**
* @file colorSensor.h
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @file colorSensor.h
* @file colorsensor.h

Copy link
Copy Markdown
Contributor

@aridome222 aridome222 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

少し気になったところの回答と、細かい修正お願いします。

Copy link
Copy Markdown
Collaborator

@takuchi17 takuchi17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

追加で一つだけかな.setDetectableColors関数のところだけ確認お願いします.

Copy link
Copy Markdown
Contributor

@molpui0726 molpui0726 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

いっこだけ?
他プルリクと実装ファイルが被ってるところがあるから、マージの順番とかは考えないといけない。

Comment on lines +7 to +8
#ifndef PORT_H_
#define PORT_H_
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ダミーの方は PORT_H になってるからミス?
多分ビルド対象外になってたはずだから、PORT_H でも大丈夫なはず

Copy link
Copy Markdown
Collaborator

@takuchi17 takuchi17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

良さそうです。テストも充実してると思います。中身も理解してるのが伝わります。自分は実際に見てないからわからないけど、次のタスクで多分ColorJudgeとかやる(誰かが)と思うから、その時に適宜調整すればいいと思う。
お疲れありがとう。
LGTM

CMakeLists.txt Outdated
${PROJECT_TEST_DIR}/dummy
${PROJECT_TEST_DIR}/helpers
)
)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

すまん、このスペースだけ気になった。どうせコンフリクト起きるからその時してもいいんだけどね。

namespace etrobocon2025_test {

// RGB値取得テスト
TEST(RgbColorTest, getRGB)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

気が回らなかったけど、テスト名はアッパーキャメルでお願いします。一応コーディング規約そうなってます🙏他のも。信じてapproveはそのままにしときます。

Suggested change
TEST(RgbColorTest, getRGB)
TEST(RgbColorTest, GetRGB)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

衝撃の事実、これは、、、去年の人たちが悪いね!

大変申し訳ございませんでした。

Copy link
Copy Markdown
Collaborator

@takuchi17 takuchi17 May 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

実は僕がやりました。公式やらどこ見てもアッパキャメルだったので、ここを区切りにしたかったです。個人的にはアッパーの方が大文字でぱっと見で読みやすいのもある。ちなみにこのリポジトリのwikiを作った時にすでに変えてました。あまり個人の意見を出したくはないのだけど、今年度は今年度なのでね。

Copy link
Copy Markdown
Contributor

@aridome222 aridome222 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正してくれたのでapprove出します!お疲れ様!
LGTM

Copy link
Copy Markdown
Collaborator

@takahashitom takahashitom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

いい感じだと思います。
めんどくさかったら直さなくてもいいです。
どうせコンフリクトするところなので。

実際には動作してるのかしてないのかよくわからない関数もあったけど、このタスクでは、RGB, HSV, 反射光の値が取得できていれば十分だと思うので問題ないと思います。
動作不明関数たちも、もし使えたら割と有用そうなのもあるので、引き続き調査していきましょう。
あとは、HSV取得の片方が動作不良っぽい話とかRGBの取得が 10bit だとかそういう調査の結果わかったことは、Notion の方にまとめておいてもらえると助かります。

お疲れさまでした。

Comment on lines +24 to +26



Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

どうせコンフリクトするところだから直さなくてもいい気がするけど、
ここはいらないかな

Suggested change

Copy link
Copy Markdown
Contributor

@molpui0726 molpui0726 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

僕が出した分がなおってたのでLGTMだします!
おつかれさまんさー
LGTMoon 101481

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants