diff --git a/love/src/components/MainTel/MTDome/MTDome.container.jsx b/love/src/components/MainTel/MTDome/MTDome.container.jsx index fc0881eca..7bee0a7c9 100644 --- a/love/src/components/MainTel/MTDome/MTDome.container.jsx +++ b/love/src/components/MainTel/MTDome/MTDome.container.jsx @@ -27,6 +27,7 @@ import { getDomeAzimuth, getLightWindScreen, getPointingStatus, + getMainTelescopeState, } from '../../../redux/selectors'; import { addGroup, removeGroup } from '../../../redux/actions/ws'; import SubscriptionTableContainer from '../../GeneralPurpose/SubscriptionTable/SubscriptionTable.container'; @@ -47,6 +48,12 @@ export const schema = { default: true, isPrivate: false, }, + raDecHourFormat: { + type: 'boolean', + description: 'Whether to display the RA and DEC in hour format', + isPrivate: false, + default: false, + }, }, }; @@ -72,6 +79,11 @@ const MTDomeContainer = ({ targetPointingAz, currentPointingEl, targetPointingEl, + telescopeRAHour, + telescopeRADeg, + telescopeDecDeg, + telescopeRotatorRad, + raDecHourFormat, ...props }) => { if (props.isRaw) { @@ -100,6 +112,11 @@ const MTDomeContainer = ({ targetPointingAz={targetPointingAz} currentPointingEl={currentPointingEl} targetPointingEl={targetPointingEl} + telescopeRAHour={telescopeRAHour} + telescopeRADeg={telescopeRADeg} + telescopeDecDeg={telescopeDecDeg} + telescopeRotatorRad={telescopeRotatorRad} + raDecHourFormat={raDecHourFormat} /> ); }; @@ -111,6 +128,7 @@ const mapStateToProps = (state) => { const lightWindScreenState = getLightWindScreen(state); const domeAzimuthState = getDomeAzimuth(state); const pointingState = getPointingStatus(state); + const telescopeState = getMainTelescopeState(state); return { ...domeState, ...louversState, @@ -118,6 +136,7 @@ const mapStateToProps = (state) => { ...lightWindScreenState, ...domeAzimuthState, ...pointingState, + ...telescopeState, }; }; @@ -129,6 +148,8 @@ const mapDispatchToProps = (dispatch) => { 'telemetry-MTDome-0-louvers', 'telemetry-MTMount-0-azimuth', 'telemetry-MTMount-0-elevation', + 'telemetry-MTPtg-0-mountStatus', + 'telemetry-MTPtg-0-mountPosition', 'event-MTDome-0-azEnabled', 'event-MTDome-0-azMotion', 'event-MTDome-0-azTarget', @@ -136,6 +157,8 @@ const mapDispatchToProps = (dispatch) => { 'event-MTMount-0-target', 'event-MTDome-0-summaryState', 'event-MTMount-0-summaryState', + 'event-MTPtg-0-currentTarget', + ]; return { subscriptions, diff --git a/love/src/components/MainTel/MTDome/MTDome.jsx b/love/src/components/MainTel/MTDome/MTDome.jsx index 2c0a09e83..291533682 100644 --- a/love/src/components/MainTel/MTDome/MTDome.jsx +++ b/love/src/components/MainTel/MTDome/MTDome.jsx @@ -28,9 +28,8 @@ import Azimuth from 'components/GeneralPurpose/Azimuth/Azimuth'; import Elevation from 'components/GeneralPurpose/Elevation/Elevation'; import WindRose from '../../icons/WindRose/WindRose'; import MTDomeSummaryTable from './MTDomeSummaryTable/MTDomeSummaryTable'; -import styles from './MTDome.module.css'; - import { MTDomeLouversMapAF, MTDomeLouversMapGN } from 'Config'; +import styles from './MTDome.module.css'; const defaultValuesAF = { A1: '0', @@ -218,6 +217,16 @@ export default class MTDome extends Component { targetPointingEl: PropTypes.number, /** High level state machine state identifier of the MTMount. */ mtMountSummaryState: PropTypes.number, + /** Telescope current RA in hours */ + telescopeRAHour: PropTypes.number, + /** Telescope current RA in degrees */ + telescopeRADeg: PropTypes.number, + /** Telescope current Dec in degrees */ + telescopeDecDeg: PropTypes.number, + /** Telescope rotator position in rad */ + telescopeRotatorRad: PropTypes.number, + /** Whether to display the RA and DEC in hour format */ + raDecHourFormat: PropTypes.bool, }; static defaultProps = { @@ -559,6 +568,11 @@ export default class MTDome extends Component { currentPointingEl, targetPointingAz, targetPointingEl, + telescopeRAHour, + telescopeRADeg, + telescopeDecDeg, + telescopeRotatorRad, + raDecHourFormat, } = this.props; const currentPointing = { @@ -642,6 +656,11 @@ export default class MTDome extends Component { positionCommandedShutter={positionCommandedShutter} currentPointing={currentPointing} targetPointing={targetPointing} + telescopeRAHour={telescopeRAHour} + telescopeRADeg={telescopeRADeg} + telescopeDecDeg={telescopeDecDeg} + telescopeRotatorRad={telescopeRotatorRad} + raDecHourFormat={raDecHourFormat} /> diff --git a/love/src/components/MainTel/MTDome/MTDomeSummaryTable/MTDomeSummaryTable.jsx b/love/src/components/MainTel/MTDome/MTDomeSummaryTable/MTDomeSummaryTable.jsx index 07b122565..0864abada 100644 --- a/love/src/components/MainTel/MTDome/MTDomeSummaryTable/MTDomeSummaryTable.jsx +++ b/love/src/components/MainTel/MTDome/MTDomeSummaryTable/MTDomeSummaryTable.jsx @@ -18,17 +18,16 @@ this program. If not, see . */ import React, { Component } from 'react'; -import styles from './MTDomeSummaryTable.module.css'; -import StatusText from '../../../GeneralPurpose/StatusText/StatusText'; -import CurrentTargetValue from '../../../GeneralPurpose/CurrentTargetValue/CurrentTargetValue'; import PropTypes from 'prop-types'; -import Limits from '../../../GeneralPurpose/Limits/Limits'; -import SummaryPanel from '../../../GeneralPurpose/SummaryPanel/SummaryPanel'; -import Row from '../../../GeneralPurpose/SummaryPanel/Row'; -import Label from '../../../GeneralPurpose/SummaryPanel/Label'; -import Value from '../../../GeneralPurpose/SummaryPanel/Value'; -import Title from '../../../GeneralPurpose/SummaryPanel/Title'; -import ProgressBar from '../../../GeneralPurpose/ProgressBar/ProgressBar'; +import StatusText from 'components/GeneralPurpose/StatusText/StatusText'; +import CurrentTargetValue from 'components/GeneralPurpose/CurrentTargetValue/CurrentTargetValue'; +import Limits from 'components/GeneralPurpose/Limits/Limits'; +import SummaryPanel from 'components/GeneralPurpose/SummaryPanel/SummaryPanel'; +import Row from 'components/GeneralPurpose/SummaryPanel/Row'; +import Label from 'components/GeneralPurpose/SummaryPanel/Label'; +import Value from 'components/GeneralPurpose/SummaryPanel/Value'; +import Title from 'components/GeneralPurpose/SummaryPanel/Title'; +import ProgressBar from 'components/GeneralPurpose/ProgressBar/ProgressBar'; import { summaryStateMap, summaryStateToStyle, @@ -40,6 +39,8 @@ import { mtdomeMotionStatetoStyle, MTMountLimits, } from 'Config'; +import { formatHoursToDigital, degreesToDMS, degrees, defaultNumberFormatter } from 'Utils'; +import styles from './MTDomeSummaryTable.module.css'; export default class MTDomeSummaryTable extends Component { static propTypes = { @@ -67,6 +68,16 @@ export default class MTDomeSummaryTable extends Component { positionActualShutter: PropTypes.array, /** Commanded shutter position */ positionCommandedShutter: PropTypes.array, + /** Telescope current RA in hours */ + telescopeRAHour: PropTypes.number, + /** Telescope current RA in degrees */ + telescopeRADeg: PropTypes.number, + /** Telescope current Dec in degrees */ + telescopeDecDeg: PropTypes.number, + /** Telescope rotator position in rad */ + telescopeRotatorRad: PropTypes.number, + /** Whether to display the RA and DEC in hour format */ + raDecHourFormat: PropTypes.bool, }; static defaultProps = { @@ -98,6 +109,11 @@ export default class MTDomeSummaryTable extends Component { targetPointing, positionActualShutter, positionCommandedShutter, + telescopeRAHour, + telescopeRADeg, + telescopeDecDeg, + telescopeRotatorRad, + raDecHourFormat, } = this.props; const mtDomeStatusText = summaryStateMap[mtDomeSummaryState]; @@ -113,12 +129,26 @@ export default class MTDomeSummaryTable extends Component { const shutterPositionCommanded1 = Math.round(positionCommandedShutter[0] ?? 0); const shutterPositionActual2 = Math.round(positionActualShutter[1] ?? 0); const shutterPositionCommanded2 = Math.round(positionCommandedShutter[1] ?? 0); + + const parsedTelescopeRAHour = formatHoursToDigital(telescopeRAHour); + const parsedTelescopeDecHour = degreesToDMS(telescopeDecDeg); + const parsedTelescopeRADeg = defaultNumberFormatter(telescopeRADeg, 2) + '°'; + const parsedTelescopeDecDeg = defaultNumberFormatter(telescopeDecDeg, 2) + '°'; + const parsedTelescopeRotatorDeg = defaultNumberFormatter(degrees(telescopeRotatorRad), 2) + '°'; + const telescopeRAText = raDecHourFormat ? parsedTelescopeRAHour : parsedTelescopeRADeg; + const telescopeDecText = raDecHourFormat ? parsedTelescopeDecHour : parsedTelescopeDecDeg; return (
Track ID {trackId?.toString()} + + {telescopeRAText} + + {telescopeDecText} + + {parsedTelescopeRotatorDeg} MTDome CSC {mtDomeStatusText} diff --git a/love/src/redux/selectors/selectors.js b/love/src/redux/selectors/selectors.js index b3cbdbde9..7e3cefc79 100644 --- a/love/src/redux/selectors/selectors.js +++ b/love/src/redux/selectors/selectors.js @@ -1221,6 +1221,20 @@ export const getDomeStatus = (state) => { }; }; +export const getMainTelescopeState = (state) => { + const subscriptions = [ + 'telemetry-MTPtg-0-mountStatus', + 'telemetry-MTPtg-0-mountPosition' + ]; + const data = getStreamsData(state, subscriptions); + return { + telescopeRAHour: data[`telemetry-MTPtg-0-mountStatus`]?.mountRA?.value ?? 0, + telescopeRADeg: data[`telemetry-MTPtg-0-mountPosition`]?.ra?.value ?? 0, + telescopeDecDeg: data[`telemetry-MTPtg-0-mountStatus`]?.mountDec?.value ?? 0, + telescopeRotatorRad: data[`telemetry-MTPtg-0-mountStatus`]?.mountRot?.value ?? 0, + }; +}; + // MTDome Power Draw export const getMtDomePowerDraw = (state) => { const subscriptions = [