Bug fixes

This commit is contained in:
Pascal Serrarens 2023-11-16 10:43:31 +01:00
parent 48b80fb9ed
commit 1abe40815e
2 changed files with 12 additions and 4 deletions

View File

@ -3,6 +3,10 @@
#include "FloatSingle.h"
extern "C" {
#include "debug.h"
}
Propulsion::Propulsion() {
this->placement = nullptr;
this->motorCount = 0;
@ -33,7 +37,7 @@ void Propulsion::AddMotors(Placement* things, unsigned int thingCount) {
}
void Propulsion::AddQuadcopter(Quadcopter* quadcoper) {
void Propulsion::AddQuadcopter(Quadcopter* quadcopter) {
this->quadcopter = quadcopter;
}

View File

@ -5,6 +5,10 @@
#include <math.h>
#include <algorithm>
extern "C" {
#include "debug.h"
}
SensorPlacement::SensorPlacement(DistanceSensor* distanceSensor, Vector2 direction) {
this->distanceSensor = distanceSensor;
this->switchSensor = nullptr;
@ -65,8 +69,8 @@ float Sensing::DistanceForward(float angle) {
continue;
DistanceSensor* distanceSensor = (DistanceSensor*)placement.thing;
float sensorAngle = placement.direction.x;
if (sensorAngle > -angle && sensorAngle < angle) {
float sensorAngle = placement.direction.z;
if (sensorAngle > 0 && sensorAngle < angle) {
minDistance = fmin(minDistance, distanceSensor->GetDistance());
}
}
@ -116,7 +120,7 @@ float Sensing::DistanceUp(float angle) {
Sensor* sensor = (Sensor*)placement.thing;
if (sensor->isDistanceSensor == false)
continue;
DistanceSensor* distanceSensor = (DistanceSensor*)placement.thing;
float sensorAngle = placement.direction.y; // not correct!
if (sensorAngle > 0 && sensorAngle < angle) {