karla

  • ****
  • 458
Wind direction sensor, wind vane 360 degrees
« on: September 28, 2018, 07:23:30 am »
Hello,
Today there is no way to determine the direction of the wind right?

I desire this function for my autonumous sailboat development.

In the Airspeed module we have the AnalogAirspeed input from some hardware sensors, but there is no way to detect something like 'AnalogWindDirection' at the moment right?
Even if that signal was provided by the supported devices.
« Last Edit: October 13, 2018, 09:15:29 am by karla »

Re: Wind direction sensor, wind vane 360 degrees
« Reply #1 on: September 28, 2018, 09:19:58 am »
Some thoughts...

This doesn't help you but I recall that for the GPS groundspeed based airspeed, that wind speed and direction is calculated internally (maybe only for fixed wing?).  A programmer could make a simple change so you could get those values.

The problem though is that a sailboat is a much different animal.  An algorithm would have to be developed.  Maybe you could look at the tilt of the deck.  For a given main sail angle, the deck is probably tilted the least when the sail points straight into the wind.  You would have to take the GPS ground speed into account there because a boat dead in the water with main sail free to rotate would have a different sail angle than a boat that has motion from coasting, even though it is coasting to a stop.

This would be a direction, but not an accurate velocity.  It wouldn't change much, so once it was estimated, it could be tweaked a little each time you turn the boat around for tacking.  Another problem would be how to estimate it at the beginning of a run.  Run the main sail from one extreme to another and look for the most level main deck?  I guess that would work.

You could have a weather vane mounted on the deck and a way of reading it's angle, via something like a battery voltage input.  Any weather vane system would have issues with the boat moving this way and the wind that way and the boat speed throwing the wind direction off.

You could have a weather vane that moves a mag chip like on a GPS.  The readout would be relative to the boat, but that would probably work too.  Making 360 turns over and over would require some figuring for how to do it without cables that get twisted.  You could thus mount the mag chip fixed and just put a magnet on the weather vane.  That might be the best way.

For a human pilot, I think an interesting way would be a good FPV system, even with multiple cameras, so you could watch the main sail from the back of the boat, like a real pilot would have done.  :)  Of course you would want another camera looking out the front, etc.
« Last Edit: September 28, 2018, 09:28:59 am by TheOtherCliff »

karla

  • ****
  • 458
Re: Wind direction sensor, wind vane 360 degrees
« Reply #2 on: September 29, 2018, 06:21:40 am »
Cool,

You could have a weather vane mounted on the deck and a way of reading it's angle, via something like a battery voltage input.

This is the weather vane I consider to use.


Its explained here
( https://www.raspberrypi.org/learning/sensing-the-weather/lesson-4/worksheet/ ).
Its just like you describe, an output of different Voltages indicating what of the 16 directions the wind is coming from.
I would not mount it on the deck but at the top of the mast.
The airspeed is already taken care of by existing software, no need.

Cliff, If this wind direction function would be developed properly (no creative workarounds and not using functions that was intended for something else), What steps would it include'?

Getting this function done is really just the beginning.
An algorithm to determine something like Sail State = tacking mode or no tacking mode, to reach target destination needs to be developed. But thats another story.

Autonomous SailDrones are inspiring :)
« Last Edit: September 29, 2018, 06:27:24 am by karla »

Re: Wind direction sensor, wind vane 360 degrees
« Reply #3 on: September 30, 2018, 08:28:56 am »
For a given boat with a given load, you could use a calculation to give you sail and rudder settings based on angle and speed of the wind relative to boat path as drawn on a map.  Given start and finish locations and absolute wind direction calculate wind angle relative to boat path.  If you can sail straight there, you do.  If you can't then there is a best tacking setup of sail and rudder that is the limit of that calculation for best speed or angle into the wind.  Which of the two directions to tack is just which angle you are closer to and perhaps how long a run you can make on each of the two tacking directions.

Given that as a program and the constraint that you make as few turns as possible when tacking, then in open water it would always turn only once when needing to tack upwind.

You would run this calculation continuously to handle inaccuracy and changing wind to name a few things.  If a turn gets messed up a little, it would immediately know and give you a new best course right when it changes.  Then there is what to do about land or water obstacles that get in the way of tacking or even a simple straight path that doesn't require tacking.  What if there are a lot of moving boats in the water?  That is another good reason to just have it tell you current trim after each problem avoidance (rather than try to plot a complete course).

The program output would be different for different boats because one may make better angle into the wind than the other.  So there would be tuning or at least fiddling with some parameters.

It depends on the degree of accuracy you need.  If you have wind direction and wind speed as detected on the moving boat, and you have a GPS to give you vehicle direction and speed, you simply subtract the GPS speed/direction from the detected wind speed/direction (vector subtraction) to get the absolute wind speed and direction.

Even with mediocre wind measurement accuracy, a well tuned program that constantly measures the wind and calculates the best current course and sail / rudder would get you there very well I would guess.

karla

  • ****
  • 458
Re: Wind direction sensor, wind vane 360 degrees
« Reply #4 on: September 30, 2018, 02:55:31 pm »
Yes :) the code logics all sounds so simple and straight forward

If you have wind direction and wind speed as detected on the moving boat, and you have a GPS to give you vehicle direction and speed, you simply subtract the GPS speed/direction from the detected wind speed/direction (vector subtraction) to get the absolute wind speed and direction.

Yes, very useful to also get the observed wind speed, but how to do it?
The wind direction can use the analog adc0 etc input like for voltage, but what about the wind speed?
It seems its a digital signal from the anemometer, not analog.
https://www.raspberrypi.org/learning/sensing-the-weather/guides/wind_speed/

How to hook that up to a revo board?

Thanks a lot Cliff

P.S.
maybe there are analog airspeed sensors to use...
« Last Edit: September 30, 2018, 03:02:46 pm by karla »

Re: Wind direction sensor, wind vane 360 degrees
« Reply #5 on: September 30, 2018, 04:49:51 pm »
I would guess that you would need a cup anemometer of some sort.  Three or four cups on a horizontal pinwheel type.  One that is attached to a simple electric motor so that you get voltage proportional to wind speed.  The code already knows how to read two voltages that come from battery voltage and current sensors.  This is a simple enough project that you could easily design and build it yourself.

Maybe even use a brushless motor.  It would need diodes to rectify the output and a capacitor to smooth the output.  On second thought, maybe not.  Used a brushed motor because diodes don't conduct below a minimum voltage so it would show zero in light wind.

Other solutions require that the sensor pivot and point into the wind and would have to be designed to avoid the issue of a cable getting wrapped up and twisted.

WIndmill water pump style would give both direction and speed.

I would guess that the standard airplane pitot tube type would not not work at the low speeds you are interested in.

I have not seen one, but I can imagine a wind sock style that measures the angle of the wind sock.

karla

  • ****
  • 458
Re: Wind direction sensor, wind vane 360 degrees
« Reply #6 on: October 01, 2018, 09:00:56 pm »
Thanks Cliff,

Yes agree the cup anemometer likely more suited for the purpose of low speed than the air pressure tube kind.

I would guess that you would need a cup anemometer of some sort.  Three or four cups on a horizontal pinwheel type.  One that is attached to a simple electric motor so that you get voltage proportional to wind speed.  The code already knows how to read two voltages that come from battery voltage and current sensors.  This is a simple enough project that you could easily design and build it yourself.

However, I ran across a really interesting new type of both air direction and air speed sensor that use bluetooth and no cables all over the boat and a solar cell to power it up.

https://vaavud.com/products/wind-meters/ultrasonic

But what do you think, can it be read by a bluetooth device and understood by the Librepilot FC?
Would be very good, but I do understand its likely impossible.

Any thoughts appreciated

/Karl

Re: Wind direction sensor, wind vane 360 degrees
« Reply #7 on: October 01, 2018, 10:56:18 pm »
You could put a Bluetooth on the FC to convert it into serial, but it would need a driver to convert the serial data into sensor values.  Of course it would then need more code to actually do something with the sensor values.

I was observing a medical intravenous fluids rate sensor and rate controller at the hospital a while back and they just clamp the clear tube into the machine and it determines the flow rate somehow.  I wonder if it is also ultrasonic.

karla

  • ****
  • 458
Re: Wind direction sensor, wind vane 360 degrees
« Reply #8 on: October 04, 2018, 05:03:22 pm »
Thanks Cliff,
I have ordered the basic wind vane and the anemometer mentioned at start of this thread.
Will see if I can hook them up. If so I will try move forward, if not better give it a pass.
Thanks a lot
K

karla

  • ****
  • 458
Re: Wind direction sensor, wind vane 360 degrees
« Reply #9 on: October 14, 2018, 05:07:50 pm »
Ho ho : )
I received the wind vane and the anemometer.



Managed to connect the wind vane to the voltage sensor of Revo pwr port in such a way that the voltage in the GCS PFD gadget no longer report the volts of my on-board LiPo but shows direction of where the wind is coming from.

Wind from degrees : Volt displayed
. 0/360 : 1.9V
. 90 : 3.0V
. 180 : 2.5V
. 270 : 3.3V

In total it shows 16 different Voltages corresponding to direction degrees in between the above.
The anemometer, windspeed, seems more difficult to connect so I just put it aside for a while.
So far so good :)

Knowing this set up will only report the apparent wind angle (due to the boat tilting, boat speed, sail changing airflow, etc), I will regard it as the True Wind angle for now anyway. Knowing there is a huge area of improvement in accuracy later on to develop, like getting an ultrasonic sensor with onboard compass providing the true wind direction compensated for tilt of boat as well as wind speed directly and wireless connecting to the FC.

Question;
Any suggestions as to were would be a good point in the code to implement an interrupt in the execution of the waypoints?
Path follower module?
Path desired UAVObject?
I will need to get access to the Voltage for wind direction and then determine something like what  sail mode is the boat in, then make some changes in sail sheeting and maybe course heading.

I realize I am just tampering around here, but my goal is to use the Path planner to set some waypoints from the map. This will provide the desired directions and positions I want the boat to visit, regardless of direction of the wind (and other obstacles).

This is what works already, see the video.
However, I do the sheeting of the sails manually based on a FPV camera view of the sail and boat.
The boat is completely unaware of the fact that it can not sail straight in to the wind.
The FC think its a car and its using the GroundPathFollowerSettings to execute the Waypoints.



I am thinking first to develop an awareness of what current SailMode (SM) the boat is in
(given the destination). There are some distinct five basic sail modes:
1. Close hauled (tacking: this is only done when target is located in a heading of the No-go zone),
2. Close reach
3. Beam reach
4. Broad reach
5. Run



These directions are all relative to the true wind angle (TWA) and not to the apparent wind angle (AWA), that I am getting now, I know, I know.

I will stay out of the first SM (tacking) for now, since its much more complex than all the others.
The Close hauled tacking SM will work very differently. It will keep the optimal sailing sheeting for this particular boat at all times, but instead change the course/heading of the boat to sail. Eventually it needs to tack to reach its destination.

But for SM 2-5 it just need to keep the course as today but the new feature will be autonomous sheeting of the sails according to the different wind directions. I can provide the best setting for the sail sheeting actuator for each SM (accessory 0). But where to save it so it will be executed?

Its interesting that any progress that will work for this little boat can be scaled up to much larger yachts. Also, the current professional SailDrones/SailBots are using several computers and sensors and I think we could achieve close to the same with much less.

Ideas much appreciated as always.
« Last Edit: October 20, 2018, 05:00:50 pm by karla »

Re: Wind direction sensor, wind vane 360 degrees
« Reply #10 on: October 27, 2018, 06:39:38 am »
I would guess those angles are very boat dependant and so they should be configuration parameters.  Some boats can barely make headway into the wind at all.  Deep and heavy keel, jib sail, different kinds of sails.

I would break it down into several layers:
- Calculate / update the running estimate of the absolute and relative (for a given heading in the current wind) wind direction.
- Configuration UAVO that can handle most of the common sail types, configuration for how to run each sail given a particular wind angle wind speed, and ship speed (I imagine that data is all needed for some conditions at least).  Thinks like for a given heading, you need the sails looser to get started and tighter for better speed once you get going.
- Generally, startup from any heading relative to the wind.  Recovery from not enough speed crossing the "no go zone".
- Manual "steering" that knows wind direction, adjusts rudder and sail automatically to sail in the manually steered direction.  Including transitions, even transitions across the "no go zone".
- Automatic tacking (it assumes a single tack, but it could be more if it slips a lot) when it knows it can't get there directly or slips enough to miss (assumes infinite ocean size with no obstacles).
- Obstacle avoidance with multiple tacking if somehow given "obstacles" to avoid, e.g. line segments for coast or line segments drawn surrounding an island.  Given a destination it will get there.  E.g. straight upwind in a fairly narrow channel you don't have to calculate any tacks.  Includes recovery close to an obstacle with decisions that keep it away from it.
- Ship and shore (etc.) avoidance e.g. with air sonar, water depth sonar, computer vision, or other means.
- Waypoint, follow me, or other advanced features.
« Last Edit: October 27, 2018, 07:17:12 am by TheOtherCliff »