Skip to content

Commit dda0c37

Browse files
committed
fix: 公式APIのインクルードパスの修正.テストは通らないが,実機でAPIが使えるか確認するためのコミット
1 parent cf15fb2 commit dda0c37

File tree

6 files changed

+28
-5
lines changed

6 files changed

+28
-5
lines changed

Makefile.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ INCLUDES += \
2424
-I$(mkfile_path)modules/calculators\
2525
-I$(mkfile_path)modules/motions\
2626
-I$(mkfile_path)modules/CameraCapture \
27-
-I$(mkfile_path)../../raspike-athrill-v850e2m/sdk/common/library/libcpp-spike/include \
27+
-I$(mkfile_path)../../common/library/libcpp-spike/include \
2828
-I/usr/include/opencv4
2929

3030
APPL_LIBS += $(shell pkg-config --libs opencv4)

modules/EtRobocon2025.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#include "EtRobocon2025.h"
88

9+
Robot EtRobocon2025::robot; // Robotインスタンス
10+
911
void EtRobocon2025::start()
1012
{
1113
std::cout << "Hello KATLAB" << std::endl;

modules/EtRobocon2025.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
#define ETROBOCON2025_H
99

1010
#include <iostream>
11+
#include "Robot.h"
1112

1213
class EtRobocon2025 {
1314
public:
1415
static void start();
16+
17+
private:
18+
static Robot robot; // Robotインスタンス
1519
};
1620

1721
#endif

modules/Robot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include "Robot.h"
88

9-
Robot::Robot() : motorController(), cameraCapture() /*, colorSensor()*/ {}
9+
Robot::Robot() : motorController(), cameraCapture() /*, colorSensor(EPort::PORT_E)*/ {}
1010

1111
MotorController& Robot::getMotorControllerInstance()
1212
{
@@ -18,7 +18,7 @@ CameraCapture& Robot::getCameraCaptureInstance()
1818
return cameraCapture;
1919
}
2020

21-
// ColorSensor& Robot::getColorSensorInstance()
21+
// spikeapi::ColorSensor& Robot::getColorSensorInstance()
2222
// {
2323
// return colorSensor;
2424
// }

modules/Robot.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#ifndef ROBOT_H
88
#define ROBOT_H
99

10+
#include "spikeapi.h"
1011
#include "MotorController.h"
1112
#include "CameraCapture.h"
1213
// #include "ColorSensor.h"
@@ -31,10 +32,16 @@ class Robot {
3132
*/
3233
CameraCapture& getCameraCaptureInstance();
3334

35+
// /**
36+
// * @brief ColorSensorのインスタンスの参照を返す
37+
// * @return メンバ変数colorSensor(ColorSensorのインスタンス)の参照
38+
// */
39+
// spikeapi::ColorSensor& getColorSensorInstance();
40+
3441
private:
3542
MotorController motorController; // MotorControllerインスタンス
3643
CameraCapture cameraCapture; // CameraCaptureインスタンス
37-
// ColorSensor colorSensor; //ColorSensorインスタンス
44+
// spikeapi::ColorSensor colorSensor; // ColorSensorインスタンス
3845
};
3946

4047
#endif

tests/RobotTest.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,14 @@ namespace etrobocon2025_test {
2929
EXPECT_EQ(&cameraRef1, &cameraRef2);
3030
}
3131

32-
} // namespace etrobocon2025_test
32+
// ゲッターで取得したColorSensorインスタンスが等しいか確認するテスト
33+
// TEST(RobotTest, GetColorSensorInstanceReturnsReference)
34+
// {
35+
// Robot robot;
36+
// spikeapi::ColorSensor& colorSensorRef1 = robot.getCameraCaptureInstance();
37+
// spikeapi::ColoeSensor& colorSensorRef2 = robot.getCameraCaptureInstance();
38+
39+
// EXPECT_EQ(&cameraRef1, &cameraRef2);
40+
// }
41+
42+
} // namespace etrobocon2025_test

0 commit comments

Comments
 (0)