Skip to content

Commit

Permalink
Updated the Scala version (2.13.2->2.13.8) and the SBT version (1.3.1…
Browse files Browse the repository at this point in the history
…0->1.7.1). Made further changes according to the latest updates in RACE.
  • Loading branch information
Nastaran Shafiei committed Feb 1, 2023
1 parent 4d5ae4c commit 505d13d
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 30 deletions.
10 changes: 5 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import Dependencies._

name := "mesa"

scalacOptions in (Compile, doc) += "-no-java-comments"
Compile / doc / scalacOptions += "-no-java-comments"

// factor out common settings across the sub-projects
lazy val commonSettings = Seq(
organization := "gov.nasa",
version := "1.0",
scalaVersion := "2.13.2",
mainClass in Compile := Some("gov.nasa.mesa.core.MesaMain"),
scalacOptions in (Compile, doc) += "-no-java-comments",
version := "1.1",
scalaVersion := "2.13.8",
Compile / mainClass := Some("gov.nasa.mesa.core.MesaMain"),
Compile / doc / scalacOptions += "-no-java-comments",
// uncomment to get the full stack trace for failed tests
//testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oF"),
libraryDependencies ++=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class InstantReplayActor(override val config: Config) extends
val delayMillis: Int = config.getIntOrElse("delay-millis", 0)

val reader: ArchiveReader = createReader
var noMoreData: Boolean = !reader.hasMoreData
var noMoreData: Boolean = !reader.hasMoreArchivedData

/** Creates an instance of gov.nasa.race.archive.ArchiveReader to read
* ArchiveEntry objects from the given archive.
Expand Down
19 changes: 9 additions & 10 deletions mesa-nextgen/src/main/scala/gov/nasa/mesa/nextgen/core/Geo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
package gov.nasa.mesa.nextgen.core

import gov.nasa.race.geo.Datum
import gov.nasa.race.geo.{Datum, GeoPosition}
import gov.nasa.race.uom.Area.
import gov.nasa.race.uom.Length.Meters
import gov.nasa.race.uom.{Angle, Length}
Expand Down Expand Up @@ -78,8 +78,8 @@ object Geo {
var minDevWaypoint: Option[Waypoint] = None

for (w <- waypoints) {
val distance = getEuclideanDistance(state.position.φ, state.position.λ,
Meters(0), w.position.φ, w.position.λ, Meters(0))
val distance = getEuclideanDistance(GeoPosition(state.position.φ, state.position.λ,
Meters(0)), GeoPosition(w.position.φ, w.position.λ, Meters(0)))

if (distance <= proximity && distance < minDev) {
minDevWaypoint = Some(w)
Expand All @@ -102,17 +102,16 @@ object Geo {
: Boolean = {
val alt1 = Meters(0)
val alt2 = Meters(0)
getEuclideanDistance(state.position.φ, state.position.λ, alt1,
wp.position.φ, wp.position.λ, alt2) <= proximity
getEuclideanDistance(GeoPosition(state.position.φ, state.position.λ, alt1),
GeoPosition(wp.position.φ, wp.position.λ, alt2)) <= proximity
}

/** Returns the Euclidean distance between the two given geographic
* coordinates.
*/
def getEuclideanDistance(φ1: Angle, λ1: Angle, alt1: Length, φ2: Angle,
λ2: Angle, alt2: Length): Length = {
val p1 = Datum.wgs84ToECEF(φ1, λ1, alt1)
val p2 = Datum.wgs84ToECEF(φ2, λ2, alt2)
((p1.x - p2.x).`²` + (p1.y - p2.y).`²` + (p1.z - p2.z).`²`)
def getEuclideanDistance(pos1: GeoPosition, pos2: GeoPosition): Length = {
val p1 = Datum.wgs84ToECEF(pos1)
val p2 = Datum.wgs84ToECEF(pos2)
((p1.x - p2.x).`²` + (p1.y - p2.y).`²` + (p1.z - p2.z).`²`)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ import scala.concurrent.duration.Duration
* @param config the actor configuration
*/
class FlightStateSbsReplayActor(val config: Config)
extends Replayer[FlightStateSbsReader] with PeriodicRaceActor
extends Replayer with PeriodicRaceActor
with SbsImporter {
type R = FlightStateSbsReader

class DropCheckSBSReader (conf: Config)
extends FlightStateSbsReader(config) {
override def dropTrack (id: String, cs: String, date: DateTime,
Expand Down Expand Up @@ -88,17 +90,17 @@ class FlightStateSbsReader(iStream: InputStream, pathName: String="<unknown>",
conf.getMappedStringOrElse("default-zone", ZoneId.of, ZoneId.systemDefault)
)

override val updater: SbsUpdater = new FstateSbsArchiveUpdater
override val updater: SbsUpdater = new SbsUpdater( Some(this), defaultZone)

class FstateSbsArchiveUpdater extends SbsUpdater(updateTrack,dropTrack,
Some(this), defaultZone) {
override protected def acquireMoreData: Boolean = refillBuf
}
// class FstateSbsArchiveUpdater extends SbsUpdater(updateTrack,dropTrack,
// Some(this), defaultZone) {
// override protected def acquireMoreData: Boolean = refillBuf
// }

override def updateTrack (track: TrackedObject): Boolean = {
val fstate = new FlightState(track.id, track.cs, track.position,
track.speed, track.heading, track.vr, track.date, track.status)
next = someEntry(fstate.date, fstate)
false
}
// override def updateTrack (track: TrackedObject): Boolean = {
// val fstate = new FlightState(track.id, track.cs, track.position,
// track.speed, track.heading, track.vr, track.date, track.status)
// next = someEntry(fstate.date, fstate)
// false
// }
}
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import sbt._

object Dependencies {
lazy val latestVersion = "latest.release"
lazy val raceVersion = "1.8.0"
lazy val raceVersion = "1.8.1"

val typesafeConfig = "com.typesafe" % "config" % "1.4.1"

Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version = 1.3.10
sbt.version = 1.7.1

0 comments on commit 505d13d

Please sign in to comment.