Fix basic test

This commit is contained in:
Pascal Serrarens 2024-01-02 10:25:43 +01:00
parent 89e4aef01f
commit cce691f3dd
2 changed files with 10 additions and 17 deletions

View File

@ -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 <unsigned int sensorCount>
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

View File

@ -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?
}