Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ATAOS corrections information to MountSummaryPanel #378

Merged
merged 2 commits into from
Jul 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions love/src/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,17 @@ export const m3InPositionStateMap = {
0: 'UNKNOWN',
};

// ATAOS
export const ataosCorrectionsStateMap = {
false: 'DISABLED',
true: 'ENABLED',
};

export const ataosCorrectionsStateToStyle = {
DISABLED: 'warning',
ENABLED: 'ok',
};

// ATPneumatics
export const m1CoverStateStateMap = {
1: 'DISABLED',
Expand Down
38 changes: 37 additions & 1 deletion love/src/components/AuxTel/Mount/SummaryPanel/SummaryPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
m1CoverStateStateMap,
nasmythRotatorInPositionStateMap,
hexapodInPositionStateMap,
ataosCorrectionsStateMap,
ataosCorrectionsStateToStyle,
stateToStyleMount,
} from '../../../../Config';
import SummaryPanel from '../../../GeneralPurpose/SummaryPanel/SummaryPanel';
Expand Down Expand Up @@ -61,12 +63,25 @@ export default class SummaryTable extends Component {

const position = Array.isArray(this.props.hexapodReportedPosition.value)
? this.props.hexapodReportedPosition.value
: ['-','-','-','-','-','-'];
: ['-', '-', '-', '-', '-', '-'];

const hexapodPosAndOffset = Array.isArray(this.props.hexapodReportedPosition.value)
? this.props.hexapodReportedPosition.value.map((pos, i) => [pos, offset[i]])
: this.props.hexapodReportedPosition;

// ATAOS
const {
atspectrograph: atSpectrographCorrections,
hexapod: hexapodCorrections,
m1: m1Corrections,
m2: m2Corrections,
} = this.props.correctionEnabled;

const atSpectrographCorrectionsState = ataosCorrectionsStateMap[atSpectrographCorrections?.value ?? false];
const hexapodCorrectionsState = ataosCorrectionsStateMap[hexapodCorrections?.value ?? false];
const m1CorrectionsState = ataosCorrectionsStateMap[m1Corrections?.value ?? false];
const m2CorrectionsState = ataosCorrectionsStateMap[m2Corrections?.value ?? false];

//Hexapod Table data
const hexapodTableData = {
x: {
Expand Down Expand Up @@ -179,6 +194,27 @@ export default class SummaryTable extends Component {
<div style={{ gridColumnStart: '1', gridColumnEnd: '3' }} className={styles.panelTable}>
<SimpleTable headers={headers} data={simpleTableData} />
</div>
<Title wide>Corrections</Title>
<Label>M1</Label>
<Value>
<StatusText status={ataosCorrectionsStateToStyle[m1CorrectionsState]}>{m1CorrectionsState}</StatusText>
</Value>
<Label>M2</Label>
<Value>
<StatusText status={ataosCorrectionsStateToStyle[m2CorrectionsState]}>{m2CorrectionsState}</StatusText>
</Value>
<Label>Hexapod</Label>
<Value>
<StatusText status={ataosCorrectionsStateToStyle[hexapodCorrectionsState]}>
{hexapodCorrectionsState}
</StatusText>
</Value>
<Label>Spectrograph</Label>
<Value>
<StatusText status={ataosCorrectionsStateToStyle[atSpectrographCorrectionsState]}>
{atSpectrographCorrectionsState}
</StatusText>
</Value>
</SummaryPanel>
);
}
Expand Down
3 changes: 3 additions & 0 deletions love/src/redux/selectors/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ export const getMountSubscriptions = (index) => {
`telemetry-ATMCS-${index}-mountEncoders`,
// ATAOS
`event-ATAOS-${index}-correctionOffsets`,
`event-ATAOS-${index}-correctionEnabled`,
];
};

Expand All @@ -343,6 +344,7 @@ export const getMountState = (state, index) => {
const m1VentsLimitSwitches = mountData[`event-ATPneumatics-${index}-m1VentsLimitSwitches`];
const m1CoverLimitSwitches = mountData[`event-ATPneumatics-${index}-m1CoverLimitSwitches`];
const correctionOffsets = mountData[`event-ATAOS-${index}-correctionOffsets`];
const correctionEnabled = mountData[`event-ATAOS-${index}-correctionEnabled`];
return {
// ATHexapod
hexapodInPosition: hexapodInPosition ? hexapodInPosition[hexapodInPosition.length - 1].inPosition.value : 0,
Expand Down Expand Up @@ -398,6 +400,7 @@ export const getMountState = (state, index) => {
v: { value: '-' },
w: { value: '-' },
},
correctionEnabled: correctionEnabled ? correctionEnabled[correctionEnabled.length - 1] : {},
};
};

Expand Down