-
Notifications
You must be signed in to change notification settings - Fork 17
Home
Welcome to the PyUAVSim wiki!
Objective of the simulator is to provide a light weight end-to-end simulator for learning and designing autopilots for UAVs - different forms and kinds. PyUAVSim will enable
- Trimming UAV
- Stability analysis through linearization
- Design and test autopilot
- Sensor models and state estimation
- Path planning
How to use PyUAVSim for accomplishing each of the above is documented here along with some miscellaneous notes and observations
Trim refers to the UAV in equilibrium. Note that the states need not be zero. For example, the altitude which is a state need not be zero. It can be a constant.
The apps/fixedwing_uav_trim can be used to trim your UAV. Note that you have to edit and supply the right configuration file that describes the airframe parameters. Here we use aerosonde.yaml. The script for trimming the UAV is below:
from fixedwing_uav_trim import AppFixedWingUAVTrim
import numpy as np
import mpl_toolkits.mplot3d as a3
import pylab as pl
#ax is required for initiazling the app to support animation
ax = a3.Axes3D(pl.figure(1))
ax.set_xlim3d(0, 200)
ax.set_ylim3d(-100, 100)
ax.set_zlim3d(0, 40)
initial_state = [0, 0, 0, 35.0, 0., 0.0, 0, 0, 0, 0, 0, 0]
uav = AppFixedWingUAVTrim(initial_state, 0, '../configs/aerosonde.yaml', ax)
uav.trim(35., 0.025, 100, 10000) #here is where we are trimming to Va = 25 m/s, gamma = 0.025 rad, R = 100 m
#Animate this with the following script. Feel free to add plotting routines
pl.show()
for m in range(npoints):
uav.update_state(dt = 1/200.)
if m%25==0:
uav.update_view()
pl.pause(.01)
You can watch a video of the trim app in action here
The actual trim routine is implemented in uav/dynamics (line 370 onward). Yes the trim routine can be improved!