赛派号

大疆无人机御air2放鞭炮 航迹点导入大疆无人机

学习到了如何通过经纬度和海拔设置大疆无人机航迹飞行,记录如下:

1. 使用的软件是:DJI Pilot 2.通过航迹点(经纬度以及海拔)csv文件转为kml文件。(KML文件主要用于描述地球上的地理特征,如点、线、多边形、图层、图标等,以及与这些特征相关的属性信息。KML文件可以包含地理坐标、颜色、高度、图标等元素,使其能够用于在地图上呈现丰富的地理信息。)步骤如下:

参考链接(参考代码)

 准备一些航迹点,保存为csv文件,格式如下: pointnamelonlatheightheadinggimbalspeedturnmodeactions_sequencepoint1114.355730.527968180-13AUTOH1000*SHOOTpoint2114.355730.527968160-13AUTOH1000*SHOOTpoint3114.355730.527958140-13AUTOH1000*SHOOTpoint4114.355830.527948120-13AUTOH1000*SHOOTpoint5114.355830.527938100-13AUTOH1000*SHOOTpoint6114.355830.52791880-13AUTOH1000*SHOOTpoint7114.355830.5279860-13AUTOH1000*SHOOTpoint8114.355730.52788840-13AUTOH1000*SHOOT

其中列分别是:点名、经度、维度、海拔高度、偏航角(注意所使用的大疆软件偏航角是否可以为小数,DJI Pilot软件不支持偏航角为小数,如果偏航角是小数在DJI Pilot中为0!),云台俯仰角,无人机飞行的速度,转弯模式(可能的值包括"MANUAL"、"AUTO"),在航迹点执行的动作序列(可以没有任何动作,也可以有一个或多个动作。例如表格中动作为悬停1s并拍照)

H1000 => 悬停 1000ms = 1s拍摄 => 拍照G40 =>万向架 a -40°REC => 开始视频录制STOPREC => 停止录像A-170 => 将飞机转向 -170 。航向的范围为 [-180, 180] 度,其中 0 代表正北。 3. 利用Python脚本将csv转化为kml文件 from string import Template import csv import sys import argparse import xml.etree.ElementTree as ET import simplekml from pyproj import CRS, Transformer import pandas as pd # csv to kml def generate_kml(csv_file, output_file, on_finish='hover'): CSV_HEADER = False ON_FINISH = "Hover" if on_finish == 'hover' else "GoHome" XML_string = """ chambon_small 1 Waypoint 0 FF0AEE8B 6 https://cdnen.dji-flighthub.com/static/app/images/point.png Waypoints Waypoints in the Mission.\n""" all_coordinates = "" waypoint_number = 1 waypoint_start = Template(""" Waypoint$waypoint_number 1 Waypoint #waypointStyle false $heading $turnmode $gimbal false $speed true true LineStop 0.2""") waypoint_end = Template(""" relativeToGround $lon,$lat,$height """) hover_template = Template(""" Hovering""") shoot_template = Template(""" ShootPhoto""") gimbal_template = Template(""" GimbalPitch""") aircraftyaw_template = Template(""" AircraftYaw""") record_template = Template(""" StartRecording""") stoprecord_template = Template(""" StopRecording""") all_coordinates_template = Template("$lon,$lat,$height") xml_end = Template(""" Wayline Wayline 1 50.0 5.0 $ON_FINISH UsePointSetting UsePointSetting false LineStop COMMON false false false 0.0 #waylineGreenPoly 1 relativeToGround $all_coordinates """) with open(csv_file, newline='') as csvfile: if csv.Sniffer().has_header(csvfile.read(1024)): CSV_HEADER = True csvfile.seek(0) dialect = csv.Sniffer().sniff(csvfile.read(1024)) csvfile.seek(0) csv_lines = csv.reader(csvfile, dialect) if CSV_HEADER: next(csv_lines, None) # skip the headers for row in csv_lines: if row: name, lon, lat, height, heading, gimbal, speed, turnmode, actions_sequence = row if lon[0] == '_': lon = lon[1:] if lat[0] == '_': lat = lat[1:] if (float(speed) > 15) or (float(speed)

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至lsinopec@gmail.com举报,一经查实,本站将立刻删除。

上一篇 没有了

下一篇没有了