Servers by jDrones

Displaying a GPS Route (By Waypoints) on Mission Planner

Hello there, hope you are all doing well. I am working on a navigation project right now. According to a starting and goal location, I use Open Route Service to create a GPS Route. I have the coordinates (lateral and longitudinal) of the route (it has around 50 waypoints). Is there any way for me to add those coordinates to Mission Planner one by one? I mean I do not want an autonomous navigation. I just want to have the route showing up on mission planner. I tried creating a mission, but the vehicle moves autonomously and I do not see the route on Mission Planner - by the way vehicle just moves forward, not following my route. For an example I will show you my code:

import openrouteservice
import folium
from openrouteservice.directions import directions
import json
import itertools
import pickle
import numpy as np
import matplotlib.pyplot as plt
from geopy.geocoders import Nominatim
from dronekit import connect, VehicleMode, LocationGlobalRelative, Command, LocationGlobal
from pymavlink import mavutil

print('Connecting...')
vehicle = connect('tcp:127.0.0.1:5762')
vehicle.mode = VehicleMode("AUTO")

coords = ((vehicle.location.global_relative_frame.lon, vehicle.location.global_relative_frame.lat),(28.87180, 41.00560))
client = openrouteservice.Client(key='hidden for safety purposes') # Specify your personal API key

geometry = client.directions(coords)['routes'][0]['geometry']
decoded = openrouteservice.convert.decode_polyline(geometry)
coordsArray = np.zeros((len(decoded["coordinates"]), 2))
for i in range(len(decoded["coordinates"])):
    coordsArray[i][0] = decoded["coordinates"][i][1]
    coordsArray[i][1] = decoded["coordinates"][i][0]

cmds = vehicle.commands
cmds.download()
cmds.wait_ready()
# Save the vehicle commands to a list
missionlist=[]
# Modify the mission as needed. For example, here we change the
# first waypoint into a MAV_CMD_NAV_TAKEOFF command.

for i in range(len(coordsArray)):
    cmd = Command(0,0,0, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT,
    mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 0, 0, 0, 0, 0, 0,coordsArray[i, 1], coordsArray[i, 0], 100)

    missionlist.append(cmd)
# Araca yükleniyor...
missionlist[0].command=mavutil.mavlink.MAV_CMD_NAV_TAKEOFF
cmds.clear()
for cmd in missionlist:
    cmds.add(cmd)
cmds.upload()

Can you help me with that, I just need for Mission Planner to show the route just like a GPS Navigation app.

Modify your python program so that it print’s() the coordinates (lat/lon/alt) on a text file, take any working file.waypoints file, and insert in it the coordinates using a text editor with column select capability (copy/paste, inserting lines if needed), or do the same with a spreadsheet.

Create a .txt file in MP format. Then write a script that reads each line and uploads it to the autopilot accordingly. Once it is uploaded to the autopilot you can click Read on MP and it will copy the waypoints on the autopilot to the map. It’s not too hard. I have a program that does it.

Servers by jDrones