-
Notifications
You must be signed in to change notification settings - Fork 1
write mission button functionality #10
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job :D
I noticed you made it compatible with fence and rally items. Could you include sample fence + rally points to confirm they can be properly written and read consecutively from the drone? Once this is validated, this feature will be approved to merge.
|
Also why did you make another IMACS.yaml file within radio? |
|
Oops I think that was by mistake, I'll fix that real quick. And yeah I'll get on making it compatible with fence and rally items
…________________________________
From: Benjamin Tran ***@***.***>
Sent: Friday, October 10, 2025 11:54 PM
To: UWARG/IMACS-3.0 ***@***.***>
Cc: Shilo T Jeyarajasingam ***@***.***>; Author ***@***.***>
Subject: Re: [UWARG/IMACS-3.0] write mission button functionality (PR #10)
[https://avatars.githubusercontent.com/u/197320739?s=20&v=4]benjtran left a comment (UWARG/IMACS-3.0#10)<#10 (comment)>
Also why did you make another IMACS.yaml file within radio?
—
Reply to this email directly, view it on GitHub<#10 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BX3STF7W2GITWH7SBWJI55T3XB5RFAVCNFSM6AAAAACIVV5HVOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGOJSHA3TIOJYHA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
…lity - Added sample mission items (San Francisco to British Columbia) - Added sample fence items (4-vertex polygon around SF area) - Added sample rally points (3 rally points around SF area) - Added test buttons to easily switch between mission types - All mission types now have test data for validation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sample rally waypoints are there; however, when writing them to the drone it fails to upload: "Mission upload failed: Could not upload mission, received mission acknowledgement error". It may be worth reviewing uploadMission() in MissionController to verify that you're passing in the correct mission type.
Also there seems to be no fence wps
gcs/src/missions.jsx
Outdated
| <Divider className="my-1" /> | ||
|
|
||
| {/* Test buttons for validation */} | ||
| <div className="flex flex-col gap-2"> | ||
| <div className="text-sm text-gray-400 mb-2">Test All Mission Types:</div> | ||
| <div className="flex gap-2"> | ||
| <Button | ||
| onClick={() => { | ||
| setActiveTab("mission") | ||
| console.log("🧪 Testing Mission items:", missionItems.length) | ||
| }} | ||
| variant="outline" | ||
| size="sm" | ||
| className="flex-1" | ||
| > | ||
| Test Mission ({missionItems.length}) | ||
| </Button> | ||
| <Button | ||
| onClick={() => { | ||
| setActiveTab("fence") | ||
| console.log("🧪 Testing Fence items:", fenceItems.length) | ||
| }} | ||
| variant="outline" | ||
| size="sm" | ||
| className="flex-1" | ||
| > | ||
| Test Fence ({fenceItems.length}) | ||
| </Button> | ||
| <Button | ||
| onClick={() => { | ||
| setActiveTab("rally") | ||
| console.log("🧪 Testing Rally items:", rallyItems.length) | ||
| }} | ||
| variant="outline" | ||
| size="sm" | ||
| className="flex-1" | ||
| > | ||
| Test Rally ({rallyItems.length}) | ||
| </Button> | ||
| </div> | ||
| </div> | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need these buttons
README.md
Outdated
| #### Creating a virtual environment | ||
|
|
||
| Create a new Python virtual environment using `python -m venv venv`. This can then be activated using `./venv/scripts/activate`. | ||
| Create a new Python virtual environment using `python -m venv venv`. This can then be activated using `C`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to change this
… on fence and rally when they are ready
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some cleanup needed then ready to merge !
| defaultValue: [ | ||
| { | ||
| id: uuidv4(), | ||
| seq: 0, | ||
| command: 16, // MAV_CMD_NAV_WAYPOINT | ||
| frame: 3, // MAV_FRAME_GLOBAL_RELATIVE_ALT | ||
| current: 0, | ||
| autocontinue: 1, | ||
| param1: 0.0, | ||
| param2: 0.0, | ||
| param3: 0.0, | ||
| param4: 0.0, | ||
| x: 37.7749, // San Francisco latitude | ||
| y: -122.4194, // San Francisco longitude | ||
| z: 100.0, // altitude | ||
| }, | ||
| { | ||
| id: uuidv4(), | ||
| seq: 1, | ||
| command: 16, // MAV_CMD_NAV_WAYPOINT | ||
| frame: 3, // MAV_FRAME_GLOBAL_RELATIVE_ALT | ||
| current: 0, | ||
| autocontinue: 1, | ||
| param1: 0.0, | ||
| param2: 0.0, | ||
| param3: 0.0, | ||
| param4: 0.0, | ||
| x: 49.2827, // British Columbia latitude | ||
| y: -123.1207, // British Columbia longitude | ||
| z: 150.0, // altitude | ||
| } | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert these changes back to the original waypoints from main
gcs/src/missions.jsx
Outdated
| defaultValue: [], | ||
| defaultValue: [ | ||
| { | ||
| id: uuidv4(), | ||
| seq: 0, | ||
| command: 16, // MAV_CMD_NAV_WAYPOINT (using waypoint command for SITL compatibility) | ||
| frame: 3, // MAV_FRAME_GLOBAL_RELATIVE_ALT | ||
| current: 0, | ||
| autocontinue: 1, | ||
| param1: 0.0, | ||
| param2: 0.0, | ||
| param3: 0.0, | ||
| param4: 0.0, | ||
| x: 37.7849, // Fence vertex 1 - slightly north of SF | ||
| y: -122.4094, // Fence vertex 1 - slightly east of SF | ||
| z: 200.0, // max altitude | ||
| }, | ||
| { | ||
| id: uuidv4(), | ||
| seq: 1, | ||
| command: 16, // MAV_CMD_NAV_WAYPOINT (using waypoint command for SITL compatibility) | ||
| frame: 3, // MAV_FRAME_GLOBAL_RELATIVE_ALT | ||
| current: 0, | ||
| autocontinue: 1, | ||
| param1: 0.0, | ||
| param2: 0.0, | ||
| param3: 0.0, | ||
| param4: 0.0, | ||
| x: 37.7649, // Fence vertex 2 - slightly south of SF | ||
| y: -122.4094, // Fence vertex 2 - slightly east of SF | ||
| z: 200.0, // max altitude | ||
| }, | ||
| { | ||
| id: uuidv4(), | ||
| seq: 2, | ||
| command: 16, // MAV_CMD_NAV_WAYPOINT (using waypoint command for SITL compatibility) | ||
| frame: 3, // MAV_FRAME_GLOBAL_RELATIVE_ALT | ||
| current: 0, | ||
| autocontinue: 1, | ||
| param1: 0.0, | ||
| param2: 0.0, | ||
| param3: 0.0, | ||
| param4: 0.0, | ||
| x: 37.7649, // Fence vertex 3 - slightly south of SF | ||
| y: -122.4294, // Fence vertex 3 - slightly west of SF | ||
| z: 200.0, // max altitude | ||
| }, | ||
| { | ||
| id: uuidv4(), | ||
| seq: 3, | ||
| command: 16, // MAV_CMD_NAV_WAYPOINT (using waypoint command for SITL compatibility) | ||
| frame: 3, // MAV_FRAME_GLOBAL_RELATIVE_ALT | ||
| current: 0, | ||
| autocontinue: 1, | ||
| param1: 0.0, | ||
| param2: 0.0, | ||
| param3: 0.0, | ||
| param4: 0.0, | ||
| x: 37.7849, // Fence vertex 4 - slightly north of SF | ||
| y: -122.4294, // Fence vertex 4 - slightly west of SF | ||
| z: 200.0, // max altitude | ||
| } | ||
| ], | ||
| }) | ||
| const [rallyItems, setRallyItems] = useSessionStorage({ | ||
| key: "rallyItems", | ||
| defaultValue: [], | ||
| defaultValue: [ | ||
| { | ||
| id: uuidv4(), | ||
| seq: 0, | ||
| command: 16, // MAV_CMD_NAV_WAYPOINT (using waypoint command for SITL compatibility) | ||
| frame: 3, // MAV_FRAME_GLOBAL_RELATIVE_ALT | ||
| current: 0, | ||
| autocontinue: 1, | ||
| param1: 0.0, | ||
| param2: 0.0, | ||
| param3: 0.0, | ||
| param4: 0.0, | ||
| x: 37.7849, // Rally point 1 - north of SF | ||
| y: -122.4094, // Rally point 1 - east of SF | ||
| z: 120.0, // altitude | ||
| }, | ||
| { | ||
| id: uuidv4(), | ||
| seq: 1, | ||
| command: 16, // MAV_CMD_NAV_WAYPOINT (using waypoint command for SITL compatibility) | ||
| frame: 3, // MAV_FRAME_GLOBAL_RELATIVE_ALT | ||
| current: 0, | ||
| autocontinue: 1, | ||
| param1: 0.0, | ||
| param2: 0.0, | ||
| param3: 0.0, | ||
| param4: 0.0, | ||
| x: 37.7649, // Rally point 2 - south of SF | ||
| y: -122.4294, // Rally point 2 - west of SF | ||
| z: 130.0, // altitude | ||
| }, | ||
| { | ||
| id: uuidv4(), | ||
| seq: 2, | ||
| command: 16, // MAV_CMD_NAV_WAYPOINT (using waypoint command for SITL compatibility) | ||
| frame: 3, // MAV_FRAME_GLOBAL_RELATIVE_ALT | ||
| current: 0, | ||
| autocontinue: 1, | ||
| param1: 0.0, | ||
| param2: 0.0, | ||
| param3: 0.0, | ||
| param4: 0.0, | ||
| x: 37.7749, // Rally point 3 - center SF | ||
| y: -122.4194, // Rally point 3 - center SF | ||
| z: 110.0, // altitude | ||
| } | ||
| ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll have 0 fence and rally waypoints by default
| socket.on("upload_mission_result", (data) => { | ||
| console.log("📨 Received upload_mission_result:", data) | ||
| setIsUploading(false) | ||
| if (data.success) { | ||
| console.log("✅ Mission upload successful!") | ||
| showSuccessNotification(data.message) | ||
| } else { | ||
| console.log("❌ Mission upload failed:", data.message) | ||
| showErrorNotification(data.message) | ||
| } | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove the console logs so we dont clog it
gcs/src/missions.jsx
Outdated
| console.log("🚀 Write Mission Button Pressed!") | ||
| console.log("📊 Current state:", { | ||
| connected, | ||
| isUploading, | ||
| activeTab, | ||
| missionItemsCount: missionItems.length, | ||
| fenceItemsCount: fenceItems.length, | ||
| rallyItemsCount: rallyItems.length | ||
| }) | ||
|
|
||
| if (!connected) { | ||
| console.log("❌ Not connected to drone") | ||
| showErrorNotification("Not connected to drone") | ||
| return | ||
| } | ||
|
|
||
| if (isUploading) { | ||
| console.log("⏳ Mission upload already in progress") | ||
| showErrorNotification("Mission upload already in progress") | ||
| return | ||
| } | ||
|
|
||
| let missionData = [] | ||
| if (activeTab === "mission") { | ||
| missionData = missionItems | ||
| console.log("📋 Using mission items:", missionItems) | ||
| } else if (activeTab === "fence") { | ||
| missionData = fenceItems | ||
| } else if (activeTab === "rally") { | ||
| missionData = rallyItems | ||
| } | ||
|
|
||
| if (missionData.length === 0) { | ||
| console.log(`❌ No ${activeTab} items to upload`) | ||
| showErrorNotification(`No ${activeTab} items to upload`) | ||
| return | ||
| } | ||
|
|
||
| console.log(`✅ Found ${missionData.length} ${activeTab} items to upload`) | ||
|
|
||
| setIsUploading(true) | ||
|
|
||
| // Convert mission items to the format expected by the backend | ||
| const formattedMissionData = missionData.map((item, index) => { | ||
| const formatted = { | ||
| seq: index, | ||
| frame: item.frame || 3, // MAV_FRAME_GLOBAL_RELATIVE_ALT | ||
| command: item.command || 16, // MAV_CMD_NAV_WAYPOINT | ||
| current: item.current || 0, | ||
| autocontinue: item.autocontinue || 1, | ||
| param1: item.param1 || 0.0, | ||
| param2: item.param2 || 0.0, | ||
| param3: item.param3 || 0.0, | ||
| param4: item.param4 || 0.0, | ||
| x: Math.round((item.x || 0) * 1e7), // latitude as integer (1e7 * degrees) | ||
| y: Math.round((item.y || 0) * 1e7), // longitude as integer (1e7 * degrees) | ||
| z: item.z || 0.0, // altitude | ||
| } | ||
| console.log(`📝 Formatted item ${index}:`, formatted) | ||
|
|
||
|
|
||
| return formatted | ||
| }) | ||
|
|
||
| console.log("📤 Sending mission data to backend:", { | ||
| type: activeTab, | ||
| mission_data: formattedMissionData | ||
| }) | ||
|
|
||
| socket.emit("upload_mission", { | ||
| type: activeTab, | ||
| mission_data: formattedMissionData, | ||
| }) | ||
|
|
||
| console.log("⏰ Setting 30-second timeout for upload...") | ||
|
|
||
| // Set a timeout to handle cases where the upload might hang | ||
| setTimeout(() => { | ||
| if (isUploading) { | ||
| console.log("⏰ Mission upload timed out!") | ||
| setIsUploading(false) | ||
| showErrorNotification("Mission upload timed out. Please try again.") | ||
| } | ||
| }, 30000) // 30 second timeout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Console logs can be removed
radio/IMACS.yml
Outdated
| logs: | ||
| location: "" No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is not needed
radio/temp_old.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is not needed
t! Backend is running. Next steps
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can delete this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove your changes to the readme and delete this file: "t! Backend is running. Next steps"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
No description provided.