Skip to main content

Start a mission

This endpoint request a start mission to the pilot. The drone needs to have a correctly loaded operation in order to start a new mission.

If the drone is already in a mission and pilot accepts it the drone will send a warning in the status_message topic. If the drone was loitering, this command will resume the mission.

 POST /api/1.0/drone/{droneId}/startMission
tip

Remember to subscribe to the status_message topic to receive feedback from pilot accept/reject or drone messages

Response

caution

If the drone is not connected to the system, this call will return an error.

{status:"Command received, pending for pilot approval"}

Example

const fetchData=async ()=>{
let j,response;
const serverResponse = await fetch(`https://cloud.rigi.tech/api/1.0/drone/41/startMisssion`, {
mode: "cors",
method: "POST",
referrer: "no-referrer",
headers: {"authorization": "Bearer " + token}
body: JSON.stringify({}),
})
if(!serverResponse.ok){
try {
switch (serverResponse.status){
case 400:
j = await serverResponse.json();
break;
case 403:
response = { message: "Forbidden access to data" };
case 404:
response = { message: "Address not found" };
default:
j = await serverResponse.json()
}
} catch (e) {
response = { message: "Error fetching data" };
}
}else{
j = await serverResponse.json()
}

response = { data:j };
const {data, message} = response
if(message) console.debug(message)
if(data) console.debug(data)
}
fetchData()