Skip to content

Commit

Permalink
Implemented rotator tracking configuration.
Browse files Browse the repository at this point in the history
  • Loading branch information
jluhrs committed Oct 26, 2023
1 parent a071674 commit 3634c17
Show file tree
Hide file tree
Showing 14 changed files with 318 additions and 188 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,47 +57,49 @@ object NavigateCommand {
case object InstSpecifics extends NavigateCommand
case object OiwfsTarget extends NavigateCommand
case object OiwfsProbeTracking extends NavigateCommand
case object RotatorTrackingConfig extends NavigateCommand

given Eq[NavigateCommand] = Eq.fromUniversalEquals

extension (self: NavigateCommand) {
def name: String = self match {
case McsFollow(_) => "Mcs Follow"
case ScsFollow(_) => "Scs Follow"
case CrcsFollow(_) => "Crcs Follow"
case Pwfs1Follow(_) => "Pwfs1 Follow"
case Pwfs2Follow(_) => "Pwfs2 Follow"
case OiwfsFollow(_) => "Oiwfs Follow"
case AowfsFollow(_) => "Aowfs Follow"
case Cwfs1Follow(_) => "Cwfs1 Follow"
case Cwfs2Follow(_) => "Cwfs2 Follow"
case Cwfs3Follow(_) => "Cwfs3 Follow"
case Odgw1Follow(_) => "Odgw1 Follow"
case Odgw2Follow(_) => "Odgw2 Follow"
case Odgw3Follow(_) => "Odgw3 Follow"
case Odgw4Follow(_) => "Odgw4 Follow"
case McsPark => "Mcs Park"
case ScsPark => "Scs Park"
case CrcsPark => "Crcs Park"
case Pwfs1Park => "Pwfs1 Park"
case Pwfs2Park => "Pwfs2 Park"
case OiwfsPark => "Oiwfs Park"
case AowfsPark => "Aowfs Park"
case Cwfs1Park => "Cwfs1 Park"
case Cwfs2Park => "Cwfs2 Park"
case Cwfs3Park => "Cwfs3 Park"
case Odgw1Park => "Odgw1 Park"
case Odgw2Park => "Odgw2 Park"
case Odgw3Park => "Odgw3 Park"
case Odgw4Park => "Odgw4 Park"
case CrcsStop(_) => "Crcs Stop"
case CrcsMove(_) => "Crcs Move"
case _: EcsCarouselMode => "Ecs Carousel Mode"
case _: EcsVentGatesMove => "Ecs Vent Gates Move"
case Slew => "Slew"
case InstSpecifics => "Instrument Specifics"
case OiwfsTarget => "OIWFS"
case OiwfsProbeTracking => "OIWFS Probe Tracking"
case McsFollow(_) => "Mcs Follow"
case ScsFollow(_) => "Scs Follow"
case CrcsFollow(_) => "Crcs Follow"
case Pwfs1Follow(_) => "Pwfs1 Follow"
case Pwfs2Follow(_) => "Pwfs2 Follow"
case OiwfsFollow(_) => "Oiwfs Follow"
case AowfsFollow(_) => "Aowfs Follow"
case Cwfs1Follow(_) => "Cwfs1 Follow"
case Cwfs2Follow(_) => "Cwfs2 Follow"
case Cwfs3Follow(_) => "Cwfs3 Follow"
case Odgw1Follow(_) => "Odgw1 Follow"
case Odgw2Follow(_) => "Odgw2 Follow"
case Odgw3Follow(_) => "Odgw3 Follow"
case Odgw4Follow(_) => "Odgw4 Follow"
case McsPark => "Mcs Park"
case ScsPark => "Scs Park"
case CrcsPark => "Crcs Park"
case Pwfs1Park => "Pwfs1 Park"
case Pwfs2Park => "Pwfs2 Park"
case OiwfsPark => "Oiwfs Park"
case AowfsPark => "Aowfs Park"
case Cwfs1Park => "Cwfs1 Park"
case Cwfs2Park => "Cwfs2 Park"
case Cwfs3Park => "Cwfs3 Park"
case Odgw1Park => "Odgw1 Park"
case Odgw2Park => "Odgw2 Park"
case Odgw3Park => "Odgw3 Park"
case Odgw4Park => "Odgw4 Park"
case CrcsStop(_) => "Crcs Stop"
case CrcsMove(_) => "Crcs Move"
case _: EcsCarouselMode => "Ecs Carousel Mode"
case _: EcsVentGatesMove => "Ecs Vent Gates Move"
case Slew => "Slew"
case InstSpecifics => "Instrument Specifics"
case OiwfsTarget => "OIWFS"
case OiwfsProbeTracking => "OIWFS Probe Tracking"
case RotatorTrackingConfig => "CR Tracking Configuration"
}
}

Expand Down
22 changes: 15 additions & 7 deletions modules/server/src/main/scala/navigate/server/NavigateEngine.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import cats.effect.{Async, Concurrent, Ref, Temporal}
import cats.effect.kernel.Sync
import cats.syntax.all.*
import org.typelevel.log4cats.Logger
import navigate.model.NavigateCommand.{CrcsFollow, CrcsMove, CrcsPark, CrcsStop, EcsCarouselMode, InstSpecifics, McsFollow, McsPark, OiwfsFollow, OiwfsPark, OiwfsProbeTracking, OiwfsTarget, Slew}
import navigate.model.NavigateCommand.*
import navigate.model.{NavigateCommand, NavigateEvent}
import navigate.model.NavigateEvent.{CommandFailure, CommandPaused, CommandStart, CommandSuccess}
import navigate.model.config.NavigateEngineConfiguration
import navigate.model.enums.{DomeMode, ShutterMode}
import navigate.server.tcs.{InstrumentSpecifics, SlewConfig, Target, TrackingConfig}
import navigate.server.tcs.{InstrumentSpecifics, RotatorTrackConfig, SlewConfig, Target, TrackingConfig}
import navigate.stateengine.StateEngine
import NavigateEvent.NullEvent
import fs2.{Pipe, Stream}
Expand All @@ -32,6 +32,7 @@ trait NavigateEngine[F[_]] {
def rotPark: F[Unit]
def rotFollow(enable: Boolean): F[Unit]
def rotMove(angle: Angle): F[Unit]
def rotTrackingConfig(cfg: RotatorTrackConfig): F[Unit]
def ecsCarouselMode(
domeMode: DomeMode,
shutterMode: ShutterMode,
Expand Down Expand Up @@ -181,6 +182,13 @@ object NavigateEngine {
systems.tcsSouth.oiwfsFollow(enable),
Focus[State](_.oiwfsFollowInProgress)
)

override def rotTrackingConfig(cfg: navigate.server.tcs.RotatorTrackConfig): F[Unit] = command(
engine,
RotatorTrackingConfig,
systems.tcsSouth.rotTrackingConfig(cfg),
Focus[State](_.rotTrackingConfigInProgress)
)
}

def build[F[_]: Concurrent: Logger](
Expand All @@ -198,15 +206,15 @@ object NavigateEngine {
rotParkInProgress: Boolean,
rotFollowInProgress: Boolean,
rotMoveInProgress: Boolean,
rotTrackingConfigInProgress: Boolean,
ecsDomeModeInProgress: Boolean,
ecsVentGateMoveInProgress: Boolean,
slewInProgress: Boolean,
oiwfsInProgress: Boolean,
instrumentSpecificsInProgress: Boolean,
rotIaaInProgress: Boolean,
oiwfsProbeTrackingInProgress: Boolean,
oiwfsParkInProgress: Boolean,
oiwfsFollowInProgress: Boolean
oiwfsFollowInProgress: Boolean,
) {
lazy val tcsActionInProgress: Boolean =
mcsParkInProgress ||
Expand All @@ -215,12 +223,12 @@ object NavigateEngine {
rotParkInProgress ||
rotFollowInProgress ||
rotMoveInProgress ||
rotTrackingConfigInProgress ||
ecsDomeModeInProgress ||
ecsVentGateMoveInProgress ||
slewInProgress ||
oiwfsInProgress ||
instrumentSpecificsInProgress ||
rotIaaInProgress ||
instrumentSpecificsInProgress
oiwfsProbeTrackingInProgress ||
oiwfsParkInProgress ||
oiwfsFollowInProgress
Expand All @@ -233,12 +241,12 @@ object NavigateEngine {
rotParkInProgress = false,
rotFollowInProgress = false,
rotMoveInProgress = false,
rotTrackingConfigInProgress = false,
ecsDomeModeInProgress = false,
ecsVentGateMoveInProgress = false,
slewInProgress = false,
oiwfsInProgress = false,
instrumentSpecificsInProgress = false,
rotIaaInProgress = false,
oiwfsProbeTrackingInProgress = false,
oiwfsParkInProgress = false,
oiwfsFollowInProgress = false
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright (c) 2016-2023 Association of Universities for Research in Astronomy, Inc. (AURA)
// For license information see LICENSE or https://opensource.org/licenses/BSD-3-Clause

package navigate.server.tcs

import cats.Eq
import lucuma.core.math.Angle

case class RotatorTrackConfig (
ipa: Angle,
mode: RotatorTrackingMode
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) 2016-2023 Association of Universities for Research in Astronomy, Inc. (AURA)
// For license information see LICENSE or https://opensource.org/licenses/BSD-3-Clause

package navigate.server.tcs

import lucuma.core.util.Enumerated

sealed abstract class RotatorTrackingMode(val tag: String) extends Product with Serializable

object RotatorTrackingMode {

case object Tracking extends RotatorTrackingMode("Tracking")
case object Fixed extends RotatorTrackingMode("Fixed")

given Enumerated[RotatorTrackingMode] = Enumerated.from(Tracking, Fixed).withTag(_.tag)

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ case class SlewConfig(
slewOptions: SlewOptions,
baseTarget: Target,
instrumentSpecifics: InstrumentSpecifics,
oiwfs: Option[GuiderConfig]
oiwfs: Option[GuiderConfig],
rotatorTrackConfig: RotatorTrackConfig
)
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ trait TcsBaseController[F[_]] {
def instrumentSpecifics(config: InstrumentSpecifics): F[ApplyCommandResult]
def oiwfsTarget(target: Target): F[ApplyCommandResult]
def rotIaa(angle: Angle): F[ApplyCommandResult]
def rotTrackingConfig(cfg: RotatorTrackConfig): F[ApplyCommandResult]
def oiwfsProbeTracking(config: TrackingConfig): F[ApplyCommandResult]
def oiwfsPark: F[ApplyCommandResult]
def oiwfsFollow(enable: Boolean): F[ApplyCommandResult]
Expand All @@ -38,5 +39,9 @@ object TcsBaseController {
case class TcsConfig(
sourceATarget: Target
)

val SystemDefault: String = "FK5"
val EquinoxDefault: String = "J2000"
val FixedSystem: String = "Fixed"

}
Loading

0 comments on commit 3634c17

Please sign in to comment.