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']['geometry'] decoded = openrouteservice.convert.decode_polyline(geometry) coordsArray = np.zeros((len(decoded["coordinates"]), 2)) for i in range(len(decoded["coordinates"])): coordsArray[i] = decoded["coordinates"][i] coordsArray[i] = decoded["coordinates"][i] 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.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.