def prepare_route(self, json_route: dict, gps_home: GeoPoint):
     home_gps = Vector3r(gps_home.latitude, gps_home.longitude, 0.0)
     self._parse_json_route(json_route)
     self._prepare_ned_route(home_gps)
 def from_gps_to_ned(target_position: Vector3r, home_gps: Vector3r):
     n, e, d = pymap3d.geodetic2ned(target_position.x_val,
                                    target_position.y_val,
                                    target_position.z_val, home_gps.x_val,
                                    home_gps.y_val, home_gps.z_val)
     return Vector3r(n, e, -d)
 def _prepare_ned_route(self, home_gps):
     for point in self.gps_route:
         route_ned_point = self.from_gps_to_ned(
             Vector3r(point.x_val, point.y_val, -point.z_val),
             Vector3r(home_gps.x_val, home_gps.y_val, home_gps.z_val))
         self.route.append(route_ned_point)
 def _parse_json_route(self, json_route: dict):
     point_list = json_route['route']
     self.gps_route = [
         Vector3r(point[0], point[1], point[2]) for point in point_list
     ]
Example #5
0
import setup_path 
import airsim
from airsim import Vector3r, Quaternionr, Pose
from airsim.utils import to_quaternion
import numpy as np
import time
import sys
import os

client = airsim.VehicleClient()
client.confirmConnection()

markerDurationSeconds = int(sys.argv[4])

client.simPlotPoints(points = [Vector3r(float(sys.argv[1]), float(sys.argv[2]), float(sys.argv[3]))], color_rgba=[1.0, 1.0, 0.0, 1.0], size = 20, duration = markerDurationSeconds, is_persistent = False)

time.sleep(markerDurationSeconds)

client.simFlushPersistentMarkers() 
import setup_path
import airsim
from airsim import Vector3r, Quaternionr, Pose
from airsim.utils import to_quaternion
import numpy as np
import time

client = airsim.VehicleClient()
client.confirmConnection()

# plot red arrows for 30 seconds
client.simPlotArrows(
    points_start=[
        Vector3r(x, y, 0)
        for x, y in zip(np.linspace(0, 10, 20), np.linspace(0, 0, 20))
    ],
    points_end=[
        Vector3r(x, y, 0)
        for x, y in zip(np.linspace(0, 10, 20), np.linspace(10, 10, 20))
    ],
    color_rgba=[1.0, 0.0, 1.0, 1.0],
    duration=30.0,
    arrow_size=10,
    thickness=1)

# plot magenta arrows for 15 seconds
client.simPlotArrows(
    points_start=[
        Vector3r(x, y, -3)
        for x, y in zip(np.linspace(0, 10, 20), np.linspace(0, 0, 20))
    ],