diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..53aac9c
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Car.java b/src/Car.java
index 6a0f716..4993166 100644
--- a/src/Car.java
+++ b/src/Car.java
@@ -50,7 +50,7 @@ public class Car{
//With all the views that the car has, get their point list
void updateScan(PointGraph map){
for(View view : views){
- view.look(map);
+ view.calculatePointScan(map);
slam.RANSAC(view);
}
diff --git a/src/View.java b/src/View.java
index 71e20aa..eea7304 100644
--- a/src/View.java
+++ b/src/View.java
@@ -5,16 +5,22 @@ import java.util.ArrayList;
import ScanGraph.ScanPoint;
public class View {
- Vector pose;
+ Vector position;
float angle = 0;
float FOV;
ArrayList rays = new ArrayList<>();
private static PApplet proc;
- //the x,y position of the view, what angle it's looking at and its FOV
+ /**
+ * @brief Constructor for the View class
+ * @param processing The PApplet that the view will be drawn on
+ * @param newPose The position of the view
+ * @param numberOfRays The number of rays that the view will have
+ * @param FOV The field of view of the view
+ */
View(PApplet processing, Vector newPose, int numberOfRays, float FOV) {
proc = processing;
- this.pose = newPose;
+ this.position = newPose;
this.FOV = FOV;
this.setRayNum(numberOfRays, FOV, this.angle);
}
@@ -25,34 +31,42 @@ public class View {
rays.clear();
float angle = (float) (angleOffset); //the 0.01 fixes some bugs
for (int i = 0; i < numberOfRays; i++) {
- Ray ray = new Ray(pose, angle);
+ Ray ray = new Ray(position, angle);
angle = angle + rayStep;
rays.add(ray);
}
}
- //sees if the ray will collide with the walls in the wall list
- public void look(PointGraph map) {
+ /**
+ * @brief Calculates the points of intersection of the rays with the map
+ * @param map The map that the view is looking at
+ */
+ public void calculatePointScan(PointGraph map) {
for (Ray ray : rays) {
ray.castRay(map);
if(ray.hasCollided()){
ray.getPoint().draw(proc);
-// ray.drawRay(proc);
}
}
}
- //changes the position of the view
- public void setPos(Vector newPose) {
- pose = newPose;
+ /**
+ * @brief Sets the position of the view
+ * @param newPosition The new position of the view
+ */
+ public void setPos(Vector newPosition) {
+ position = newPosition;
for (Ray ray : rays) {
- ray.setPos(pose);
+ ray.setPos(position);
}
}
- //changes the angle of the view
- public void setAngle(float angle) {
- this.angle = angle;
+ /**
+ * @brief Sets the angle of the view
+ * @param newAngle The new angle of the view
+ */
+ public void setAngle(float newAngle) {
+ this.angle = newAngle;
for(Ray ray : rays){
float angleOffset = ray.getAngle() - this.angle;
ray.setAngle(this.angle+angleOffset);
@@ -65,23 +79,38 @@ public class View {
this.setRayNum(this.rays.size(), this.FOV, this.angle);
}
+ /**
+ * @return The position of the view
+ */
public Vector getPos() {
- return pose;
+ return position;
}
+ /**
+ * @return The angle of the view
+ */
public float getAngle() {
return this.angle;
}
+ /**
+ * @return The field of view of the view
+ */
public float getFOV() {
return this.FOV;
}
+ /**
+ * @return The number of rays that the view has
+ */
public int getRayNum() {
return this.rays.size();
}
- //gets the point that each ray has collided with
+ /**
+ * @brief Get the most recent scan from the view
+ * @return A ScanPoint object containing the position, angle and points of the view
+ */
public ScanPoint getScan() {
ArrayList points = new ArrayList<>();
@@ -93,7 +122,7 @@ public class View {
points.add(point);
}
}
- return new ScanPoint(this.pose,this.angle, points);
+ return new ScanPoint(this.position,this.angle, points);
}
/**