From cce691f3dd724318e7701796f1f967dd14e0a6b7 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Tue, 2 Jan 2024 10:25:43 +0100 Subject: [PATCH] Fix basic test --- Perception.h | 9 +-------- test/BB2B_Test.cc | 18 +++++++++--------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/Perception.h b/Perception.h index b18c4ce..1519e32 100644 --- a/Perception.h +++ b/Perception.h @@ -17,13 +17,6 @@ public: /// @brief Default Constructor Perception(); - /// @brief Template to make it possible to leave out ths sensorCount - /// @tparam sensorCount - /// @param sensors An array of sensor placements - template - inline Perception(Placement (&sensors)[sensorCount]) { - Perception(sensors, sensorCount); - } /// @brief Create a perception setup with the given Sensors /// @param sensors The Placement of Sensors on the Roboid /// @param sensorCount The number of sensors in the placement array @@ -94,7 +87,7 @@ public: float nearbyDistance = 0.3F; -protected: +public: /// @brief The Placement of the Sensors used for Perception Placement *sensorPlacements = nullptr; /// @brief The number of Sensors used for Perception diff --git a/test/BB2B_Test.cc b/test/BB2B_Test.cc index 5d09bf8..5cb642f 100644 --- a/test/BB2B_Test.cc +++ b/test/BB2B_Test.cc @@ -14,7 +14,7 @@ TEST(BB2B, Basics) { Placement sensors[] = {Placement(sensorLeft, -30), Placement(sensorRight, 30)}; - Perception *perception = new Perception(sensors); + Perception *perception = new Perception(sensors, 2); DifferentialDrive *propulsion = new DifferentialDrive(Placement(motorLeft, Vector3(-1, 0, 0)), @@ -22,17 +22,17 @@ TEST(BB2B, Basics) { Roboid *roboid = new Roboid(perception, propulsion); - // bool obstacleLeft = roboid->perception->ObjectNearby(-30); - // bool obstacleRight = roboid->perception->ObjectNearby(30); + bool obstacleLeft = roboid->perception->ObjectNearby(-30); + bool obstacleRight = roboid->perception->ObjectNearby(30); - // EXPECT_FALSE(obstacleLeft); - // EXPECT_FALSE(obstacleRight); + EXPECT_FALSE(obstacleLeft); + EXPECT_FALSE(obstacleRight); - // float leftMotorSpeed = obstacleRight ? -1.0F : 1.0F; - // float rightMotorSpeed = obstacleLeft ? -1.0F : 1.0F; + float leftMotorSpeed = obstacleRight ? -1.0F : 1.0F; + float rightMotorSpeed = obstacleLeft ? -1.0F : 1.0F; - // DifferentialDrive *diffDrive = (DifferentialDrive *)&roboid->propulsion; - // diffDrive->SetTargetSpeeds(leftMotorSpeed, rightMotorSpeed); + DifferentialDrive *diffDrive = (DifferentialDrive *)roboid->propulsion; + diffDrive->SetTargetSpeeds(leftMotorSpeed, rightMotorSpeed); // cannot chek verlocity in this branch? }