Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
4 changes: 4 additions & 0 deletions public/Oxford Chip Diagram.excalidraw.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
157 changes: 155 additions & 2 deletions src/screens/OavMover.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
import {
Box,
Button,
Drawer,
Dialog,
DialogContent,
DialogTitle,
Grid2,
IconButton,
Stack,
TextField,
Tooltip,
Typography,
useTheme,
Drawer,
Tooltip,
} from "@mui/material";
import { OavVideoStream } from "../components/OavVideoStream";
import {
ArrowBackRounded,
ArrowDownwardRounded,
ArrowForwardRounded,
ArrowUpwardRounded,
Close,
Help,
} from "@mui/icons-material";
import { useState } from "react";

Expand Down Expand Up @@ -258,6 +265,149 @@ export function SideDrawer() {
);
}

export function CoordinateSystem() {
const [open, setOpen] = React.useState(false);

const handleClickOpen = () => {
setOpen(true);
};
const handleClose = () => {
setOpen(false);
};

const buttonStyle = {
color: "white",
margin: "5px",
padding: "15px",
backgroundColor: "#1c2025",
width: "100%",
height: "95%",
};

return (
<>
<Box>
<Grid2 container spacing={1}>
<Grid2 size={10}>
<b>Co-ordinate System Setup</b>
</Grid2>
<Grid2>
<Help onClick={handleClickOpen} />
</Grid2>
<Grid2 size={4}>
<Button
style={buttonStyle}
onClick={() =>
submitAndRunPlanImmediately("moveto", {
place: "zero",
})
}
>
Go to Origin
</Button>
</Grid2>
<Grid2 size={4}>
<Button
style={buttonStyle}
onClick={() =>
submitAndRunPlanImmediately("moveto", {
place: "f1",
})
}
>
Go to Fiducial 1
</Button>
</Grid2>
<Grid2 size={4}>
<Button
style={buttonStyle}
onClick={() =>
submitAndRunPlanImmediately("moveto", {
place: "f2",
})
}
>
Go to Fiducial 2
</Button>
</Grid2>
<Grid2 size={4}>
<Button style={buttonStyle}>Set Fiducial 0</Button>
</Grid2>
<Grid2 size={4}>
<Button
style={buttonStyle}
onClick={() =>
submitAndRunPlanImmediately("fiducial", {
point: "1",
})
}
>
Set Fiducial 1
</Button>
</Grid2>
<Grid2 size={4}>
<Button
style={buttonStyle}
onClick={() =>
submitAndRunPlanImmediately("fiducial", {
point: "2",
})
}
>
Set Fiducial 2
</Button>
</Grid2>
<Grid2 size={6}>
<Button
style={buttonStyle}
onClick={() => submitAndRunPlanImmediately("cs_maker", {})}
>
Make Coordinate System
</Button>
</Grid2>
<Grid2 size={6}>
<Button
style={buttonStyle}
onClick={() => submitAndRunPlanImmediately("block_check", {})}
>
Block Check
</Button>
</Grid2>
</Grid2>
</Box>
<Dialog
onClose={handleClose}
aria-labelledby="customized-dialog-title"
open={open}
>
<DialogTitle sx={{ m: 0, p: 2 }} id="customized-dialog-title">
How to use Co-ordinate System Setup
</DialogTitle>
<IconButton
aria-label="close"
onClick={handleClose}
sx={(theme) => ({
position: "absolute",
right: 8,
top: 8,
color: theme.palette.grey[500],
})}
>
<Close />
</IconButton>
<DialogContent dividers>
<img src="Oxford Chip Diagram.excalidraw.svg" alt="" />
<Typography gutterBottom>
This only works for an Oxford chip. Fiducial 0 is the origin, the
top left corner. Fiducial 1 is the top right corner and Fiducial 2
is the bottom left corner.
</Typography>
</DialogContent>
</Dialog>
</>
);
}

export function OavMover() {
const [crosshairX, setCrosshairX] = useState<number>(200);
const [crosshairY, setCrosshairY] = useState<number>(200);
Expand Down Expand Up @@ -309,6 +459,9 @@ export function OavMover() {
label="zoom-level"
pv="ca://BL24I-EA-OAV-01:FZOOM:MP:SELECT"
/>
<hr />
<CoordinateSystem />
<hr />
<SideDrawer />
</Grid2>
</Grid2>
Expand Down