Skip to content
Open
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
21 changes: 20 additions & 1 deletion umdloop_gui_web/app/GUI functions/CameraManagerModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,26 @@ import CameraFeed from "./CameraFeed";

const ROLE_OPTIONS = [
{ value: "", label: "Unassigned" },
...Object.entries(CAMERA_ROLES).map(([, value]) => ({ value, label: value })),
{ value: CAMERA_ROLES.FRONT, label: "Front Camera" },
{ value: CAMERA_ROLES.BACK, label: "Back Camera" },
{ value: CAMERA_ROLES.LEFT_SIDE, label: "Left Side Camera" },
{ value: CAMERA_ROLES.RIGHT_SIDE, label: "Right Side Camera" },
{ value: CAMERA_ROLES.RADIO_VIEW, label: "Radio View" },
{ value: CAMERA_ROLES.WHEEL_TL_A, label: "TL Wheel A" },
{ value: CAMERA_ROLES.WHEEL_TL_B, label: "TL Wheel B" },
{ value: CAMERA_ROLES.WHEEL_TR_A, label: "TR Wheel A" },
{ value: CAMERA_ROLES.WHEEL_TR_B, label: "TR Wheel B" },
{ value: CAMERA_ROLES.WHEEL_BL_A, label: "BL Wheel A" },
{ value: CAMERA_ROLES.WHEEL_BL_B, label: "BL Wheel B" },
{ value: CAMERA_ROLES.WHEEL_BR_A, label: "BR Wheel A" },
{ value: CAMERA_ROLES.WHEEL_BR_B, label: "BR Wheel B" },
{ value: CAMERA_ROLES.ARM_BASE, label: "Arm Base" },
{ value: CAMERA_ROLES.ARM_JOINT, label: "Arm Joint" },
{ value: CAMERA_ROLES.ARM_EE, label: "Arm End Effector" },
{ value: CAMERA_ROLES.ARM_GRIPPER, label: "Arm Gripper" },
{ value: CAMERA_ROLES.SCIENCE_1, label: "Science Cam 1 / Overhead Scoops / Nightvision" },
{ value: CAMERA_ROLES.SCIENCE_2, label: "Science Cam 2 / View of Scoops" },
{ value: CAMERA_ROLES.SCIENCE_3, label: "Science Cam 3 / View of Sampler / Rover Field View" },
];

const QUALITY_OPTIONS = ["low", "medium", "high", "ultra"];
Expand Down
73 changes: 73 additions & 0 deletions umdloop_gui_web/app/GUI functions/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export default function Navigation({ selectedNavItem }) {
const [longitude, setLongitude] = useState("");
const [navMode, setNavMode] = useState("GNSS");
const [pathPlanStatus, setPathPlanStatus] = useState("");
const [rosCommand, setRosCommand] = useState("");
const [rosCommandStatus, setRosCommandStatus] = useState("");

const fetchStatus = async () => {
try {
Expand Down Expand Up @@ -77,6 +79,17 @@ export default function Navigation({ selectedNavItem }) {
}
};

const onRosCommandSubmit = () => {
const command = rosCommand.trim();

if (!command) {
setRosCommandStatus("Enter a ROS2 command first");
return;
}

setRosCommandStatus(`Ready to send: ${command}`);
};

useEffect(() => {
if (selectedNavItem !== "Object Detection") return undefined;

Expand Down Expand Up @@ -221,6 +234,66 @@ export default function Navigation({ selectedNavItem }) {
</div>
</div>
)}

{selectedNavItem === "Placeholder2" && (
<div style={{ display: "flex", justifyContent: "center" }}>
<div
style={{
width: "min(760px, 100%)",
padding: "18px 20px",
borderRadius: "14px",
border: "2px solid #1f1e1eff",
background: "#2b2b2b",
color: "white",
display: "grid",
gap: "12px",
}}
>
<h2 style={{ margin: 0 }}>ROS2 Command</h2>
<textarea
value={rosCommand}
onChange={(e) => {
setRosCommand(e.target.value);
setRosCommandStatus("");
}}
placeholder="ros2 topic pub /cmd_vel geometry_msgs/msg/Twist '{linear: {x: 0.0}, angular: {z: 0.0}}'"
rows={8}
style={{
width: "100%",
resize: "vertical",
minHeight: "160px",
padding: "12px",
borderRadius: "10px",
border: "2px solid #1f1e1eff",
background: "#3d3d3d",
color: "white",
outline: "none",
fontFamily: "monospace",
fontSize: "14px",
}}
/>
<div style={{ display: "grid", gridTemplateColumns: "1fr auto", gap: "10px", alignItems: "center" }}>
<div style={{ color: rosCommandStatus.startsWith("Ready") ? "#d8d8d8" : "#ffb3b3", fontWeight: 700 }}>
{rosCommandStatus}
</div>
<button
onClick={onRosCommandSubmit}
style={{
padding: "10px 16px",
borderRadius: "10px",
border: "2px solid #1f1e1eff",
background: "#3d3d3d",
color: "white",
fontWeight: 900,
cursor: "pointer",
}}
>
Send Command
</button>
</div>
</div>
</div>
)}
</div>
);
}
18 changes: 9 additions & 9 deletions umdloop_gui_web/app/GUI functions/NavigationBar.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"use client";

import React, { useState } from "react";
import { MODE_ICONS, MODES } from "./pageConstants";
import { NAV_MODE_ICONS, NAV_MODES } from "./pageConstants";

export default function NavigationBar({ selectedMode, setSelectedMode }) {
const [hoveredButtonId, setHoveredButtonId] = useState(null);
const [selectedButton, setSelectedButton] = useState(MODES.indexOf(selectedMode));
const [selectedButton, setSelectedButton] = useState(NAV_MODES.indexOf(selectedMode));

return (
<nav
Expand All @@ -15,11 +15,11 @@ export default function NavigationBar({ selectedMode, setSelectedMode }) {
justifyContent: "center",
alignItems: "center",
gap: "6px",
padding: "12px 8px",
padding: "8px 8px",
background: "#3d3d3d",
}}
>
{MODE_ICONS.map((mode, idx) => {
{NAV_MODE_ICONS.map((mode, idx) => {
const buttonColor =
hoveredButtonId === idx
? "#353535ff"
Expand All @@ -34,24 +34,24 @@ export default function NavigationBar({ selectedMode, setSelectedMode }) {
background: buttonColor,
border: "2px solid #1f1e1eff",
borderRadius: "10px",
padding: "12px 8px",
padding: "8px 8px",
cursor: "pointer",
display: "flex",
flexDirection: "column",
alignItems: "center",
gap: "6px",
gap: "4px",
flex: 1,
minWidth: "0",
}}
onMouseEnter={() => setHoveredButtonId(idx)}
onMouseLeave={() => setHoveredButtonId(null)}
onClick={() => {
setSelectedMode(MODES[idx]);
setSelectedMode(NAV_MODES[idx]);
setSelectedButton(idx);
}}
>
{mode && <img src={`/${mode}`} alt={mode.replace(".png", "")} style={{ width: "36px", height: "36px" }} />}
<span style={{ color: "white", fontSize: "10px", whiteSpace: "nowrap" }}>{MODES[idx]}</span>
{mode && <img src={`/${mode}`} alt={mode.replace(".png", "")} style={{ width: "30px", height: "30px" }} />}
<span style={{ color: "white", fontSize: "10px", whiteSpace: "nowrap" }}>{NAV_MODES[idx]}</span>
</button>
);
})}
Expand Down
Loading