From d3258cb5bc225164f0e6469c42c8fba6ead75c2a Mon Sep 17 00:00:00 2001 From: Connor Needham <129120300+ConnorNeed@users.noreply.github.com> Date: Tue, 7 Jul 2026 15:41:26 +0000 Subject: [PATCH 1/2] feat: add more status/state monitoring for the arm --- src/components/panels/ArmControlPanel.tsx | 51 +++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/components/panels/ArmControlPanel.tsx b/src/components/panels/ArmControlPanel.tsx index 3539777..56ced99 100644 --- a/src/components/panels/ArmControlPanel.tsx +++ b/src/components/panels/ArmControlPanel.tsx @@ -10,6 +10,8 @@ const ArmControlPanel: React.FC = () => { const [poseNames, setPoseNames] = useState([]); const [selectedPose, setSelectedPose] = useState(''); const [presetName, setPresetName] = useState(''); + const [armState, setArmState] = useState(null); + const [servoStatus, setServoStatus] = useState(null); const [distance, setDistance] = useState(null); const [distanceStatus, setDistanceStatus] = useState(null); const [response, setResponse] = useState<{ success: boolean; message: string } | null>(null); @@ -52,6 +54,48 @@ const ArmControlPanel: React.FC = () => { refreshPoseNames(); }, [ros]); + useEffect(() => { + if (!ros) return; + + const stateTopic = new ROSLIB.Topic({ + ros, + name: '/arm_teleop_node/state', + messageType: 'std_msgs/msg/String', + queue_size: 1, + }); + + const handleState = (msg: any) => { + setArmState(msg.data); + }; + + stateTopic.subscribe(handleState); + + return () => { + stateTopic.unsubscribe(handleState); + }; + }, [ros]); + + useEffect(() => { + if (!ros) return; + + const statusTopic = new ROSLIB.Topic({ + ros, + name: '/servo_node/status', + messageType: 'moveit_msgs/msg/ServoStatus', + queue_size: 1, + }); + + const handleServoStatus = (msg: any) => { + setServoStatus(msg.message); + }; + + statusTopic.subscribe(handleServoStatus); + + return () => { + statusTopic.unsubscribe(handleServoStatus); + }; + }, [ros]); + useEffect(() => { if (!ros) return; @@ -176,6 +220,13 @@ const ArmControlPanel: React.FC = () => { return (
+
+ State: + {armState ?? 'No data'} + Servo Status: + {servoStatus ?? 'No data'} +
+
handleCollisionCheckingChange(e.target.checked)} + disabled={!collisionParameterLoaded || collisionParameterUpdating} + /> + + @@ -348,6 +448,40 @@ const ArmControlPanel: React.FC = () => { font-weight: 600; } + .toggle-row { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 0.75rem; + padding: 0.5rem; + border: 1px solid #333; + border-radius: 4px; + background: #2b2b2b; + cursor: pointer; + } + + .toggle-row span { + display: flex; + flex-direction: column; + color: #ccc; + } + + .toggle-row small { + margin-top: 0.15rem; + color: #888; + font-size: 0.7rem; + } + + .toggle-row input { + width: 1.1rem; + height: 1.1rem; + cursor: pointer; + } + + .toggle-row input:disabled { + cursor: not-allowed; + } + button { background: #0070f3; color: #f1f1f1;