-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathRobot.tsx
More file actions
151 lines (146 loc) · 4.24 KB
/
Copy pathRobot.tsx
File metadata and controls
151 lines (146 loc) · 4.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
import { useInstrumentSession } from "@atlas/app-shell";
import { Box, Typography, Stack, useTheme } from "@mui/material";
import { useState } from "react";
import { NumberInput } from "../components/NumberInput";
import { RunPlanButton } from "@atlas/blueapi-ui";
import { ReadOnlyPv } from "@atlas/pvws-config";
import { StatusCard } from "../components/StatusCard";
import { WebcamStreamFromPv } from "../components/Webcam";
type RobotSampleFormData = {
puck: number;
position: number;
};
function StatusSidebar() {
const theme = useTheme();
return (
<Box sx={{ ml: 5 }}>
<Stack direction={"row"} spacing={2}>
<StatusCard
title="Ring status"
bgColor={theme.palette.success.light}
cardColor={theme.palette.primary.main}
>
<ReadOnlyPv
label="Ring Current"
pv="ca://SR-DI-DCCT-01:SIGNAL"
parseNumeric
units="mA"
/>
<ReadOnlyPv
label="Ring Energy"
pv="ca://CS-CS-MSTAT-01:BEAMENERGY"
parseNumeric
units="GeV"
/>
</StatusCard>
<StatusCard
title="EH3 Safety"
bgColor={theme.palette.success.light}
cardColor={theme.palette.primary.main}
>
<ReadOnlyPv label="Hutch Enabled" pv="ca://BL15I-PS-IOC-02:M14:LOP" />
</StatusCard>
<StatusCard
title="Currently loaded"
bgColor={theme.palette.info.light}
cardColor={theme.palette.primary.main}
>
<ReadOnlyPv label="Puck" pv="ca://BL15J-EA-LOC-01:PUCK:INDEX" />
<ReadOnlyPv
label="Sample Pin"
pv="ca://BL15J-EA-LOC-01:SAMPLE:INDEX"
/>
</StatusCard>
</Stack>
</Box>
);
}
function RobotControl() {
const { instrumentSession } = useInstrumentSession();
const [formData, setFormData] = useState<RobotSampleFormData>({
puck: 1,
position: 1,
});
const theme = useTheme();
return (
<Box
sx={{
padding: 5,
borderRadius: 1,
border: "1px solid",
borderColor: theme.palette.primary.main,
}}
>
<Stack direction={"column"} spacing={3} alignItems={"center"}>
<Typography component="h1" variant="h5">
Robot Control
</Typography>
<Stack direction={"row"} spacing={3} alignItems={"center"}>
<NumberInput
label="Puck"
numberMode="natural"
defaultValue={formData["puck"]}
onCommit={(parsedValue) => {
setFormData({ ...formData, ["puck"]: parsedValue });
}}
/>
<NumberInput
label="Position"
numberMode="natural"
defaultValue={formData["position"]}
onCommit={(parsedValue) => {
setFormData({ ...formData, ["position"]: parsedValue });
}}
/>
</Stack>
<RunPlanButton
name="robot_load"
params={formData}
instrumentSession={instrumentSession}
buttonText="Load Sample"
/>
<RunPlanButton
name="robot_unload"
instrumentSession={instrumentSession}
buttonText="Unload Sample"
/>
</Stack>
</Box>
);
}
// TODO: Webcams currently not visible unless streams are not automatically
// upgraded to https (and not available outside the beamline network). Stream
// serving needs to be updated when available.
// https://github.com/DiamondLightSource/atlas/issues/90
function Robot() {
return (
<Box
// component={"section"}
sx={{
display: "flex",
justifyContent: "left",
mt: 3,
mr: 5,
ml: 5,
}}
>
<Stack direction={"column"} spacing={3} alignItems={"left"}>
<StatusSidebar />
<Stack direction={"row"} spacing={3} alignItems={"left"}>
<WebcamStreamFromPv
label="JWEB1"
sourcePv="ca://BL15J-DI-WEB-01:MJPG:MJPG_URL_RBV"
size="250"
/>
<WebcamStreamFromPv
label="JCAM2"
sourcePv="ca://BL15J-DI-CAM-02:MJPG:MJPG_URL_RBV"
size="250"
/>
<RobotControl />
</Stack>
</Stack>
</Box>
);
}
export default Robot;