Mission Planner


#1

Hello,

Can you please provide me a sample code for executing a mission by setting different waypoints. As I need to now how to add multiple waypoints in a sequence and then execute the whole mission.

Thanks


#2

Pratik,

here is a sample code in javascript .


function addWaypoints(lat,lng){

    var newWaypoint={};
    newWaypoint["frame"]=3;
    newWaypoint["command"]=16;
    newWaypoint["is_current"]=false;
    newWaypoint["autocontinue"]=true;
    newWaypoint["param1"]=0;
    newWaypoint["param2"]=1;
    newWaypoint["param3"]=0;
    newWaypoint["param4"]=0;
    newWaypoint["x_lat"]=lat;
    newWaypoint["y_long"]=lng;
    newWaypoint["z_alt"]=5;

    waypointsList.push(newWaypoint);    //waypointList is a global variable in which all the
                                                                                 // waypoints are stacked in the order they were created.
  
}

function sendWaypoints(){

    waypointsList[0].is_current=true;    //for defining the start of the mission in the list of waypoints
    var msgdata = {};
    msgdata["waypoints"]=waypointsList;       //waypoints is the parameter that needs to be populated
                                                                                            // with the array of waypoints in waypointsList 

    $.ajax({
       type: "POST",
       dataType: "json",
       data: JSON.stringify(msgdata),
       url: restPath+"/ros/"+namespace+"/navigation/waypoint_set",
       success: function(data){
                                     if (data.success){
                                                   console.log("successful");
                                        }
                        }
         });
}

Here the addWaypoints function is called with the latitude and longitude whenever a waypoint is added and an updated array is maintained in a global variable called waypointList. Once all the required parameters pertaining to a waypoint are finalised they are sent to flytOS using sendWaypoints function and once sent. the rest call to execute waypoints is sent to start execution.


#3

Vallabh,

Can you please tell me when the next version of FLYTSIM will be available for the waypoints apis.

Thanks.