Skip to content

Commit

Permalink
Add RA, Dec and Rotator position to AuxTel/Dome component
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-aranda committed Aug 9, 2024
1 parent 84c6a08 commit 33f4c18
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 7 deletions.
12 changes: 10 additions & 2 deletions love/src/components/AuxTel/Dome/Dome.container.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ this program. If not, see <http://www.gnu.org/licenses/>.
import React from 'react';
import { connect } from 'react-redux';
import SubscriptionTableContainer from 'components/GeneralPurpose/SubscriptionTable/SubscriptionTable.container';
import { getDomeState, getATMCSState } from 'redux/selectors';
import { getDomeState, getATMCSState, getAuxiliaryTelescopeState } from 'redux/selectors';
import { addGroup, removeGroup } from 'redux/actions/ws';
import { EUIs } from 'Config';
import Dome from './Dome';
Expand Down Expand Up @@ -87,6 +87,9 @@ const DomeContainer = ({
controls,
atDomeTracking,
targetName,
telescopeRA,
telescopeDec,
telescopeRotator,
...props
}) => {
if (props.isRaw) {
Expand Down Expand Up @@ -130,21 +133,26 @@ const DomeContainer = ({
ATMCSSummaryState={ATMCSSummaryState}
atDomeTracking={atDomeTracking}
targetName={targetName}
telescopeRA={telescopeRA}
telescopeDec={telescopeDec}
telescopeRotator={telescopeRotator}
/>
);
};

const mapStateToProps = (state) => {
const domeState = getDomeState(state);
const mountState = getATMCSState(state);
return { ...domeState, ...mountState };
const telescopeState = getAuxiliaryTelescopeState(state);
return { ...domeState, ...mountState, ...telescopeState };
};

const mapDispatchToProps = (dispatch) => {
const subscriptions = [
'telemetry-ATDome-0-position',
'telemetry-ATMCS-0-mount_AzEl_Encoders',
'telemetry-ATMCS-0-mount_Nasmyth_Encoders',
'telemetry-Scheduler-2-observatoryState',
'event-ATDome-0-azimuthState',
'event-ATDome-0-azimuthCommandedState',
'event-ATDome-0-dropoutDoorState',
Expand Down
26 changes: 24 additions & 2 deletions love/src/components/AuxTel/Dome/Dome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ export default class Dome extends Component {
atDomeTracking: PropTypes.bool,
/** Target name */
targetName: PropTypes.string,
/** Telescope RA */
telescopeRA: PropTypes.number,
/** Telescope Dec */
telescopeDec: PropTypes.number,
/** Rotator position */
telescopeRotator: PropTypes.number,
};

static defaultProps = {
Expand Down Expand Up @@ -308,6 +314,9 @@ export default class Dome extends Component {
ATMCSSummaryState,
atDomeTracking,
targetName,
telescopeRA,
telescopeDec,
telescopeRotator,
} = this.props;

const { timeWindow, isLive, historicalData } = this.state;
Expand Down Expand Up @@ -356,7 +365,6 @@ export default class Dome extends Component {
targetValue={targetElevation}
/>
</div>

<Azimuth
className={styles.svgAzimuth}
width={width}
Expand Down Expand Up @@ -402,7 +410,21 @@ export default class Dome extends Component {
title="Difference between telescope and dome azimuth, multiplied by cos(telescope altitude)"
>
<span>Vignetting distance: </span>
<span className={styles.value}>{vignettingDistance}º</span>
<span className={styles.value}>{vignettingDistance}°</span>
<div
title="The following parameters requires the Scheduler:2 CSC to be active"
className={styles.telescopeParametersContainer}
>
<div>
Telescope RA: <span className={styles.value}>{telescopeRA}°</span>
</div>
<div>
Telescope Dec: <span className={styles.value}>{telescopeDec}°</span>
</div>
<div>
Rotator position: <span className={styles.value}>{telescopeRotator}°</span>
</div>
</div>
</div>
</div>
<DomeSummaryTable
Expand Down
24 changes: 21 additions & 3 deletions love/src/components/AuxTel/Dome/Dome.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ this program. If not, see <http://www.gnu.org/licenses/>.
align-self: center;
flex-wrap: wrap;
position: relative;
width: 70%;
width: 100%;
max-width: 700px;
container-type: inline-size;
}

.skymapGridContainer svg {
Expand All @@ -47,7 +48,7 @@ this program. If not, see <http://www.gnu.org/licenses/>.
.topRow {
display: grid;
justify-items: center;
row-gap: 2em;
column-gap: 5em;
padding: 1em 0;
grid-template-columns: minmax(0, 1fr) minmax(22em, 24em);
}
Expand Down Expand Up @@ -134,14 +135,21 @@ this program. If not, see <http://www.gnu.org/licenses/>.
.vignettingDistanceContainer {
position: absolute;
left: 50%;
bottom: 0%;
bottom: calc(var(--content-padding) * -1);
transform: translate(-50%, 0);
}

.vignettingDistanceContainer .value {
color: var(--base-font-color);
}

.telescopeParametersContainer {
display: flex;
gap: var(--content-padding);
white-space: nowrap;
font-size: var(--font-size-larger);
}

.innerDome {
fill: var(--second-tertiary-background-color);
fill-opacity: 0.6;
Expand All @@ -168,3 +176,13 @@ this program. If not, see <http://www.gnu.org/licenses/>.
.elevationPlot {
height: 18em;
}

@container (width < 600px) {
.vignettingDistanceContainer {
bottom: -90px;
}
.telescopeParametersContainer {
flex-direction: column;
gap: 0;
}
}
10 changes: 10 additions & 0 deletions love/src/redux/selectors/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,16 @@ export const getATMCSState = (state) => {
};
};

export const getAuxiliaryTelescopeState = (state) => {
const subscriptions = ['telemetry-Scheduler-2-observatoryState'];
const data = getStreamsData(state, subscriptions);
return {
telescopeRA: data['telemetry-Scheduler-2-observatoryState']?.ra?.value ?? 0,
telescopeDec: data['telemetry-Scheduler-2-observatoryState']?.declination?.value ?? 0,
telescopeRotator: data['telemetry-Scheduler-2-observatoryState']?.telescopeRotator?.value ?? 0,
};
};

export const getMountSubscriptions = (index) => {
return [
// ATHexapod
Expand Down

0 comments on commit 33f4c18

Please sign in to comment.