欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ArduPilot-sitl仿真-Mission Planner联合显示

程序员文章站 2022-07-02 22:07:59
...

ArduPilot-sitl仿真-Mission Planner联合显示

To start the simulator first change directory to the vehicle directory. For example, for the multicopter code change to ardupilot/ArduCopter:

cd ardupilot/ArduCopter

Then start the simulator using sim_vehicle.py. The first time you run it you should use the -w option to wipe the virtual EEPROM and load the right default parameters for your vehicle.

sim_vehicle.py -w

After the default parameters are loaded you can start the simulator normally. First kill the sim_vehicle.py you are running using Ctrl-C. Then:

sim_vehicle.py --console --map

如果要采用flightgear 额外需要

Install FlightGear from the terminal:

sudo apt-get install flightgear

Open a new command prompt and run the appropriate shell file for your
vehicle in /ardupilot/Tools/autotest/: fg_plane_view.sh (Plane) and
fg_quad_view.sh (Copter).

This will start FlightGear.

Start SITL in the terminal in the normal way. In this case we’re
specifying the start location as San Francisco airport (KSFO) as this
is an interesting airport with lots to see:

sim_vehicle.py -L KSFO

SITL with MAVProxy (UDP)
SITL can connect to multiple ground stations by using MAVProxy to forward UDP packets to the GCSs network address (for example, forwarding to another Windows box or Android tablet on your local network). The simulated vehicle can then be controlled and viewed through any attached GCS.

First find the IP address of the machine running the GCS. How you get the address is platform dependent (on Windows you can use the ‘ipconfig’ command to find the computer’s address).

Assuming the IP address of the GCS is 192.168.14.82, you would add this address/port as a MAVProxy output using:

output add 192.168.14.82:14550

在电脑中打开Mission Planner , 选择UDP连接,并设置对应的端口号。如下图所示。
ArduPilot-sitl仿真-Mission Planner联合显示

此时,就可以完成代码sitl仿真与电脑的通信。

本人采用的是Vmware 虚拟机和主机进行链接,在ubuntu 中,
Enter the following commands in the MAVProxy Command Prompt.

mode guided
arm throttle
takeoff 40

Copter should take off to an altitude of 40 metres and then hover (while it waits for the next command).解锁,起飞后。
可以在地面站中采用mavlink形式读取日志信息,也可以通过地面站实时显示飞行数据。并通过MP中的转换成matlab文件完成在Matlab中的数据显示(日志文件有两种格式,都表示同样的信息)。 亲测有效!

相关标签: 个人总结