Orientate the plane in a desired direction before a flight (Python script - Soaring project)

Hi,
I need to make some tests flights with a precise orientation (North, South …) based on the horizontal wind (I’m working on a soaring project).
I’m trying to find a way to write this command in a Python script and load/use it when I’ll be on the field with a clear view of the wind direction.
I didn’t find anything in the documentation about this, only possibility seems to change the mode to “Manual” during the flight and do it myself with my RC radio … It’ll impact my tests if this can’t be done through this script.

If anyone has an idea or know how to manage that, many thanks !

Nicolas

Using scripting in Mission Planner is probably the easiest:
https://ardupilot.org/planner/docs/using-python-scripts-in-mission-planner.html

Hi Armadillo,
Thanks for your answer.

In the page “Using Python Scripts in Mission Planner” : I’m not using MP, I’m using direct commands send by Mavproxy, so I don’t see anything I can add in my script.

Tt’ll be great to have the same kind of MavLink command like “wind_dir

You should be able to do this via Lua

Hi manavgandhi17,

I tried by LUA, it’s not as flexible as with Python, can be good for ACRO mode for take off/landing, but in this case, because I’ve got some complex maths calculations to make during the flight on wind, it’s not the right way.

Or maybe using a ground weather station with a wind direction sensor, connect it to Ardupilot, and check the data :
“If wind is North, yaw to 90°” or something like that.

What do you think ?

Lua is almost certainly the “right” answer. And if you’re using an airspeed sensor, you should have onboard wind data from which to draw.

1 Like

Hi Yuri,

I’m sure that LUA is great for many things, I tried it a little and that’s clear. But my Python script embed an algorithm , it seems that it can’t work with LUA.

But, if you show me how using a single file for :

  • LUA take off
  • LUA orientation face to the wind
  • Start a Python script
  • LUA for landing (when the Python script has ended)

OK, I’m your guy :wink: (and give me your price !)

Lua Script Steps

  1. Takeoff Mode Until X Altitude
  2. Change to Circle Mode at Altitude (Couple Circles to Allow for Wind Speed/Direction Converge
  3. Get Wind Direction via Lua and set a Guided Waypoint in the Wind Direction
  4. Wait Until Aircraft on Track
  5. Start Python Script (don’t really know much about ur script so this may be more complicated)
  6. Python Script Changes to Land Mode to End
1 Like

Agree with @manavgandhi17 on all points and will add that you should be able to implement your algorithm in Lua as well. We do complex aerobatics with it already, along with coordinate, vector, and quaternion transformations. It seems there’s a knowledge gap vs an actual capability deficiency, but we won’t solve it unless you share the algorithm.

2 Likes

Ok you two, that seems great, I’ll try and reply.

Many thanks anyway !!

Hi Yuri,I’m coming back in this discussion, as I’ve posted days ago a quick view of the project I’m working on:
ArduSoar enhancement for coastal flights

The goal is to build an evolution of the “Ardusoar” module to fly over the coastal shore for NGOs missions.
Python seems to me more “open” to future scientific development than LUA does for Arduplane.
So, I’m working on a first Python script that’ll “mimic” a typical seagull flight. As I’m not an “algorithm” dev, I used all the available tools for that

Sounds interesting. If you dont mind sharing are you seeking the uplift as the sea breezes hit the rising land or using horizontal winds at sea?

Hi Rob, only horizontal winds above the sea, no thermals or other vertical lift like above the ground. That’s the challenge, as ArduSoar is working on thermals, now I have to build an algo for horizontal winds + waves “ground” effect. That’s dynamic soaring.

So changes in wind velocity or uplift caused by wind wave ineraction?

Looking forward to the updates in what sounds like a cool project.

Hi Nicolas,

I think your project is very interesting in terms of dynamic sailing. But in my opinion, the main challenge will be how to imitate the flight of a dynamic sailing bird (like an albatross) not for breaking speed records on circular trajectories but how to successfully perform enroute flights only by dynamic sailing - and not to transfer the foundings gained from the latter to Arduplane.

Like @Yuri_Rage, I think that scripting on the flight controller is the way to go.

Since we are also interested in dynamic sailing, my friend Matthias has designed and built an ingenious design , which had its successful first flight a few weeks ago. The performance data are impressive. In ground effect it doesn’t like to come down at all.

Can you say something about the aircraft you are using ?

Rolf

1 Like

Hi Rolf,

Great work, wow I like this plane !
Like you wrote, the goal here is to mimic the Albatros “way of flying”, and trying to build a plane + an algorythm that can think like this bird at 10 or 20 % (if I’m lucky) ! Actually I’m more focus on this algo development than the plane.
So, I’m trying to build this algo using research works I found in my country and everywhere : many people wrote on theory, but no one tried for real. When you want to fly above the coast you can easily lose a plane (and to be honest , multiple ones !). I’ve got a lack in aerodynamism knowledge so it’s hard to progress.
I’m thinking more on Python scripts because it can be connected to the “outside” worlds more easily, with scripts and code coming for AI for example. I didn’t understand that LUA can do this, but maybe I’m wrong.
About the plane : I worked with experts in Soaring/ground effect in mountains and slope aerobatics - it’s really specialists business - they are developing very specific planes but very fragile in the same time : so I’ll look for semi-industrial plane, designed for very high winds (F3F planes for example), carbon. But you’re design is really interesting !

I’ll be very happy to share with you many more on our projects !

Bye
Nico