How to obtain acceleration and angular velocity control inputs to track a fixed-wing UAV trajectory?

I want to track a given trajectory for a fixed-wing UAV. This example from UAV toolbox does the exact task, but I am not able to understand what are it's control inputs (u). Can someone please explain how can I obtain these control inputs or is there any other way to get the tracking done in a simple manner and obtain the acceleration and angular velocity inputs?

 Accepted Answer

Hi Shubham,
You can check the exampleHelperUAVDerivatives.m file in the example you referred to. This file should be in the same folder you had the example mlx file.
You can also check the reference page https://www.mathworks.com/help/uav/ref/fixedwing.html for more details on the fixed wing kinematic model we used in the example and check the example https://www.mathworks.com/help/uav/ug/tuning-waypoint-follower-for-fixed-wing.html for a Simulink implementation of a similar controller.
Thanks,
Jianxin

10 Comments

Thanks for the suggestion. It helped me get some idea about what those functions are doing. However, I checked the guidance model used for the fixedwing object and that model is oversimplified for my application. I want to use a proper point mass model for a fixedwing aircraft whic involves Lift terms, Thrust control, angle of attack control and so on. I want to use these detailed equations. I tried coding them in the exampleHelperDerivatives file. Since I want to control angle of attack via a first order dynamics, I need to find the commanded angle by solving a transcendental equation. Now when this code is run, MATLAB is repeatedly giving warning while solving the transcendental equation (I am using the solve(eqn) function).
Can you please let me know what might be going wrong?
I am attaching the paper from which the guidance model is taken and is coded. (Eqn No: 2, 3, 10 , 11, 12)
I am also attaching my MATLAB codes which are modified files equivalent to the exampleHelper files given.
I would be really grateful if you could help me.
Edit: The code is possibly running in an infinite loop. I tried running it for few hours, and it was still not finished alongwith warnings while solving the transcendental equation.
Thanks
Shubham
Hi Shubham,
Although it might not be exactly the same Plant model, but you can check the controller desing in our Approximate hight fidelity UAV Plant example and Transistion between UAV Plant example. The first example is available since 20b and the second example is available since 21a.
As for your specific controller helpUAVDerivative.m, you probably could consider three approaches:
  1. Solve the transcendental equation outside the integration loop once and use the analytical solution in your controller. In which case, you symbols would contain all the changing variables such as ac, gammac, gamma and thrust.
  2. Solve the transcendental equation numerically inside the integration loop using fsolve. This should be faster than using the symbolic equation.
  3. When your ac angles are small (< 14 degrees), you can approximate the sin(ac) == ac in your equation and use the simplified equation to solve ac analytically.
I think option 3 might be viable, given that usually UAV's angle of attack is quite small.
Thanks,
Jianxin
Thank you, Jianxin. The small angle approximation is perfectly working and I am getting reasonable solution. I had to modify the code to incorporate the desiredHeading (as provided by the Dubins path planner) in the controlled trajectory.
I am still facing a minor issue. At some sharp turns, my UAV model is not able to do it properly. It tries to execute such turns by making a circular detour and thus ends up taking more time to reach the goal. Can you suggest what can I do to fix it?
This is a snip of the trajectory plot. The thicker curve represents the trajectory executed while the thinner is the one it should have executed.
Hi Shubham,
It seems that this is an issue with the control strategy. A fixed-wing UAV should be able to make the turn shown in your figure. The thicker curve is actually a lot more aggressive comparing to the reference track. But since this is from an external paper, you might have to debug your implementation of that paper. You might also want to check whether ac value is too high to make small angle approximation valid during your simulation.
Thanks,
Jianxin
Okay, I will check that. I have another query. I want to see if an UAV equipped with only IMU is allowed to traverse on this path (simulated trajectory using the above formulation), then how will it actually drift from the desired trajectory. So, to do this, I tried adding noise to the derivative terms (accelerations and angular velocity) in the helpUAVDerivs file where all the equations are defined. However, there was no drift in the output trajectory with sensor noise, also the computation time to give an output was high. Any idea what should do to model the drift induced by using inertial sensors?
Thanks.
I am adding a random number to the derivative of velocity. Now every time there is a call to ode45 function, this random number is different. This is probably why, the function takes a lot of time to integrate.
Can you please guide me as to how can I add noise externally without multiple calls to ode45?
Hi Shubham,
If you want to simulate noise affecting your controller, you should perturb the output state of the integrator, pass it into the controller and drive the UAV. The feedback loop should look like:
You should not add random noise to the derivative of your plant model.
Thanks,
Jianxin
Hi Jianxin,
In my case, I want to simulate the IMU sensor readings i.e. Noise must be added to the acceleration and angular velocity. These quantities are then integerated to obtain the states (position, velocity, orientation). Acceleration and angular velocity are not states and they appear in only derivative form.
I am not sure how to go about implementing your suggestion.
Thanks
The link does not seem to work as it says the page doesn' t exist. Anyway, Thank you for all the help Jianxin. Your inputs have been crucial in developing the understanding of my problem.

Sign in to comment.

More Answers (0)

Products

Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!