From 0eaef9e70dc029970b4e0704b54817c9bff7bbc0 Mon Sep 17 00:00:00 2001 From: dev Date: Tue, 1 Aug 2023 16:50:10 -0400 Subject: [PATCH] Added javadoc comments --- .../fhwa/saxton/CarmaV2xMessageReceiver.java | 7 +- .../lib/objects/detector/DetectedObject.java | 135 ++++++++++++++++-- .../mosaic/lib/objects/detector/Detector.java | 52 ++++++- .../lib/objects/detector/Orientation.java | 20 ++- .../mosaic/lib/objects/detector/Size.java | 19 ++- 5 files changed, 209 insertions(+), 24 deletions(-) diff --git a/co-simulation/lib/mosaic-carma-utils/src/main/java/gov/dot/fhwa/saxton/CarmaV2xMessageReceiver.java b/co-simulation/lib/mosaic-carma-utils/src/main/java/gov/dot/fhwa/saxton/CarmaV2xMessageReceiver.java index d09fca9e..dd009085 100644 --- a/co-simulation/lib/mosaic-carma-utils/src/main/java/gov/dot/fhwa/saxton/CarmaV2xMessageReceiver.java +++ b/co-simulation/lib/mosaic-carma-utils/src/main/java/gov/dot/fhwa/saxton/CarmaV2xMessageReceiver.java @@ -103,15 +103,12 @@ public void run() { // Enqueue message for processing on main thread synchronized (rxQueue) { rxQueue.add(new Tuple<>(msg.getAddress(), parsedMessage)); - log.info("CarmaV2xMessageReceiver enqueued message of size: " + msg.getLength() + " from client " + msg.getAddress().toString() + "."); + log.debug("CarmaV2xMessageReceiver enqueued message of size {} from client {}." , msg.getLength(), msg.getAddress()); } } catch (IllegalArgumentException parseError) { - log.warn("CarmaV2xMessageReceiver received malformed message with length: " + msg.getLength() + " from client " + msg.getAddress().toString() + "! Reason: " + parseError.getMessage() +". Discarding..."); + log.warn("CarmaV2xMessageReceiver received malformed message with size {} from client {} !\nReason: {} .\nDiscarding ...",msg.getLength(), msg.getAddress(), parseError.getMessage()); } } - if (listenSocket != null) { - listenSocket.close(); - } } /** diff --git a/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/DetectedObject.java b/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/DetectedObject.java index ffc9d299..59f22cdb 100644 --- a/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/DetectedObject.java +++ b/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/DetectedObject.java @@ -48,7 +48,23 @@ public final class DetectedObject implements Serializable { private Double[] angularVelocityCovariance = new Double[9]; private Size size; - + /** + * Constructor for Detected Object information. + * + * @param type {@link DetectionType}. + * @param confidence in detection type classification. + * @param sensorId of sensor/detector reporting object detection + * @param projString containing information about reference frame in + * which kinematic information is reported. + * @param objectId unique string ID of detected object (only guaranteed + * unique among other detected objects reported by the + * same sensor). + * @param position position of detected object relative to sensor/detector + * frame. + * @param velocity velocity of detected object in sensor/detector frame. + * @param angularVelocity angular velocity of detected object in sensor/detector frame. + * @param size size of object including height,width and length. + */ public DetectedObject(DetectionType type, double confidence, String sensorId, String projString, String objectId, CartesianPoint position, Vector3d velocity, Vector3d angularVelocity, Size size) { this.type = type; @@ -62,108 +78,201 @@ public DetectedObject(DetectionType type, double confidence, String sensorId, St this.size = size; } + /** + * Getter for {@link DetectionType} + * @return + */ public DetectionType getType() { return type; } + /** + * Getter for projection string which describes how to translate + * Detected Object position,velocity, and angular velocity from a + * sensor/detector relative map reference frame to other reference frames. + * @return + */ public String getProjString() { return projString; } + /** + * Getter for 3x3 covariance associated with position represented as + * a 9 element vector for JSON serialization/deserialization. + * @return + */ public Double[] getPositionCovariance() { return positionCovariance; } + /** + * Setter for 3x3 covariance associated with position represented as + * a 9 element vector for JSON serialization/deserialization. + * @param positionCovariance + */ public void setPositionCovariance(Double[] positionCovariance) { this.positionCovariance = positionCovariance; } + /** + * Getter for 3x3 covariance associated with velocity represented as + * a 9 element vector for JSON serialization/deserialization. + * @return + */ public Double[] getVelocityCovariance() { return velocityCovariance; } + /** + * Setter for 3x3 covariance associated with velocity represented as + * a 9 element vector for JSON serialization/deserialization. + * @param positionCovariance + */ public void setVelocityCovariance(Double[] velocityCovariance) { this.velocityCovariance = velocityCovariance; } - + /** + * Getter for 3x3 covariance associated with angular velocity represented + * as a 9 element vector for JSON serialization/deserialization. + * @return + */ public Double[] getAngularVelocityCovariance() { return angularVelocityCovariance; } + /** + * Setter for 3x3 covariance associated with angular velocity represented + * as a 9 element vector for JSON serialization/deserialization. + * @param positionCovariance + */ public void setAngularVelocityCovariance(Double[] angularVelocityCovariance) { this.angularVelocityCovariance = angularVelocityCovariance; } - + /** + * Getter for confidence value in DetectionType classification. + * @return + */ public double getConfidence() { return confidence; } + /** + * Getter for sensor ID reporting detected object. + * @return + */ public String getSensorId() { return sensorId; } - + /** + * Getter for String object ID. + * @return + */ public String getObjectId() { return objectId; } - + /** + * Getter for object location. + * @return + */ public CartesianPoint getPosition() { return position; } - + /** + * Getter for object velocity. + * @return + */ public Vector3d getVelocity() { return velocity; } + /** + * Getter for object angular velocity + * @return + */ public Vector3d getAngularVelocity() { return angularVelocity; } - + /** + * Getter for object size + * @return + */ public Size getSize() { return size; } - - public static long getSerialversionuid() { - return serialVersionUID; - } - + /** + * Setter for object {@link DetectionType} + * @param type + */ public void setType(DetectionType type) { this.type = type; } + /** + * Setter for confidence in detected object {@link DetectionType} classification. + * @param confidence + */ public void setConfidence(double confidence) { this.confidence = confidence; } + /** + * Setter for String sensor ID reporting DetectedObject. + * @param sensorId + */ public void setSensorId(String sensorId) { this.sensorId = sensorId; } + /** + * Setter for projection string to translate object kinematic information from + * reference frame to geodetic cordinates. + * @param projString + */ public void setProjString(String projString) { this.projString = projString; } + /** + * Setter for detected object unique string ID. + * @param objectId + */ public void setObjectId(String objectId) { this.objectId = objectId; } + /** + * Setter for detected object position. + * @param position + */ public void setPosition(CartesianPoint position) { this.position = position; } + /** + * Setter for detected object velocity. + * @param velocity {@link Vector3d} + */ public void setVelocity(Vector3d velocity) { this.velocity = velocity; } - + /** + * Setter for detected object angular velocity. + * @param angularVelocity {@link Vector3d} + */ public void setAngularVelocity(Vector3d angularVelocity) { this.angularVelocity = angularVelocity; } + /** + * Setter for object size. + * @param size {@link Size} + */ public void setSize(Size size) { this.size = size; } diff --git a/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Detector.java b/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Detector.java index 142abc0e..42e12df8 100644 --- a/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Detector.java +++ b/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Detector.java @@ -26,35 +26,81 @@ public class Detector implements Serializable { private DetectorType type; private Orientation orientation; private CartesianPoint location; - - public Detector(String sensorId, DetectorType type, Orientation orientation, CartesianPoint point) { + + /** + * Sensor/Detector constructor + * + * @param sensorId unique string ID of sensor/detector. + * @param type of the sensor/detector. + * @param orientation of the sensor/detector. + * @param location of the sensor/detector. + */ + public Detector(String sensorId, DetectorType type, Orientation orientation, CartesianPoint location) { this.sensorId = sensorId; this.type = type; this.orientation = orientation; - this.location = point; + this.location = location; } + /** + * Get unique String sensor ID. + * @return + */ public String getSensorId() { return sensorId; } + + /** + * Set unique String sensor ID. + * @param sensorId + */ public void setSensorId(String sensorId) { this.sensorId = sensorId; } + + /** + * Get sensor/detector {@link DetectorType}. + * @return + */ public DetectorType getType() { return type; } + + /** + * Set the sensor/detector {@link DetectorType}. + * @param type + */ public void setType(DetectorType type) { this.type = type; } + + /** + * Get sensor/detector {@link Orientation}. + * @return + */ public Orientation getOrientation() { return orientation; } + + /** + * Set sensor/detector {@link Orientation}. + * @param orientation + */ public void setOrientation(Orientation orientation) { this.orientation = orientation; } + + /** + * Get sensor/detector location. + * @return {@link CartesianPoint}. + */ public CartesianPoint getLocation() { return location; } + /** + * Set sensor/detector location + * @param point {@link CartesianPoint}. + */ public void setLocation(CartesianPoint point) { this.location = point; } diff --git a/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Orientation.java b/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Orientation.java index 7173bc6e..ea902bb5 100644 --- a/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Orientation.java +++ b/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Orientation.java @@ -25,22 +25,38 @@ public class Orientation implements Serializable{ private double pitch; private double roll; - + /** + * Constructor for orientation + * @param yaw in degrees + * @param pitch in degrees + * @param roll in degrees + */ public Orientation( double yaw, double pitch, double roll) { this.yaw = yaw; this.pitch = pitch; this.roll = roll; } + /** + * Get yaw in degrees. + * @return + */ public double getYaw() { return yaw; } - + /** + * Get pitch in degrees. + * @return + */ public double getPitch() { return pitch; } + /** + * Get roll in degrees. + * @return + */ public double getRoll() { return roll; } diff --git a/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Size.java b/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Size.java index 7c45900d..97716728 100644 --- a/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Size.java +++ b/co-simulation/lib/mosaic-objects/src/main/java/org/eclipse/mosaic/lib/objects/detector/Size.java @@ -25,21 +25,38 @@ public class Size implements Serializable { private double height; private double width; - + /** + * Constructor for size + * @param length in meters + * @param height in meters + * @param width in meters + */ public Size(double length, double height, double width) { this.length = length; this.height = height; this.width = width; } + /** + * Get length in meters. + * @return + */ public double getLength() { return length; } + /** + * Get height in meters. + * @return + */ public double getHeight() { return height; } + /** + * Get width in meters. + * @return + */ public double getWidth() { return width; }