Sailboat Support

@rhys That is fantastic! ( Also see you have a gazebo simulation of a boat on realistic water!) The landyacht sim looks very close to what I want to do with my cat. I will certainly see if I can get Gazebo sim running ASAP.

Thanks!

@skyscraper let me know if you need any help. The starting point is to get the ArduPilot Gazebo plugin built and running. The AP Dev Wiki has a section covering that and there are more details in the plugin repo. It should now run Gazebo Garden or Harmonic.

One possibility for a pure SITL model would be to adapt some of the code in the wave / surface vehicle plugin to provide the physics - although it may be a step too far for the SITL library. For accurate buoyancy modelling you need the vehicle mesh so that the changing submerged surface can be updated as the boat heels or moves through waves. The alternative is to use linear potential fluid models and assume small displacements, but for small vessels that heel considerably (and multi-hulls) this quickly gets complex as well.

1 Like

@rhs My first goal is just to get the cat flying a hull in a straight line on a reach in Acro mode . I am guessing the landyacht sim may work well enough for that? Anyway making a simplified mesh of the hull should not be too complicated. The pic shows a simple catamaran hull shape done in pure OpenSCAD. Presumably the mesh doesn’t need to be hydrodynaically smooth for the sim to work?


Anyway that is some way down the road. First I need to try to get Gazebo simulator working with ardupilot.

Thanks again!

We do have the SAIL PID controller, so it should be possible however its hard to tune because you need to be up against the SAIL_HEEL_MAX param before it does anything. I would set the param to the roll you need to just get the hull flying and then work from there. It will never sheet in to raise the hull, but it will sheet out when you get past that point. It will probably be easier to tune if it is a little too windy so the it does not have to be “subtle”.

If your trying to get more “dynamic” sailing then I would recommend increasing SCHED_LOOP_RATE we use 50 Hz by default on rover 400 is the default on copter and should work fine.

1 Like

I can probably do something with that model. Let me take a look to see if I can get the model floating and the sail articulated. Do you have a link to the original - STEP format is ok, or STL if you have it (Gazebo uses Collada, but that can be derived).

@rhys Sounds good to me! stls attached in the zip file. I have split into 3 stls; hull_platform, rig and wind sensor. (for completeness the wind sensor is meant to go on the spar sticking out of the front of the rig fwiw, so that it spends last time masked by the rig in a gybe… to be tested!)
catamarans_stls.zip (58.5 KB)

1 Like

@skyscraper - initial model here: GitHub - srmainwaring/SITL_Models at prs/pr-catarmaran. Set up with hydrodynamics and approximate inertial. Some dimensions are needed to refine the model:

  • mass and dimension of the hulls + platform
  • sail area
  • approx mass of rig and sails

Will also need rudders, if you have a STL file that would be great, otherwise rectlinear dimensions and mass will be enough for an initial approximation.

Do the hulls have a fin? If so, same question re. dimensions as for the rudder.

Question about the wind sensor: does the entire mast rotate (with the forward spar) or is the boom separate? The visual is one element but I suspect the forward spar should be fixed with the mast and the boom hinged at the gooseneck. Will need some editing of the mesh file to do this - I have the model loaded into Blender now, so should be straightforward.

@rhys. it looks great. (I have gazebo-ardupilot basically working so next is to try to do something useful!)

The rig arrangement is as shown in the video https://www.youtube.com/shorts/Jy8-cmgmLhk

(The rig is actually a development of the one in this video https://youtu.be/Us4DRlkozek?t=257 )

The stl dimensions are mm, so for reference a hull should be 830 mm long in x.

I added some foils in the attached zip.
cat_foil_stls.zip (191.4 KB)

The distance from the front of the hull to the leading edge of the foil is 340mm ( red markers in pic)
The distance from the front of the boat to the mast is 400mm (blue markers in pic)

Rudders hang on the back of the boat as shown in the youtube animation.

The following is a guess
Mass of boat should be around 1.4 kg.
C.g should be 450mm aft of front of the hull

We currently only support fixed wind sensors, we would need to add support for a second sensor to get the mast angle so the wind angle relative to the hull/flight-controller forward can be calculated.

Its not a insurmountable problem, but there will be a little dev work required.

For the purposes of the Gazebo model I’m sure you could do that calculation in Gazebo before forwarding the data to AP.

1 Like

@iampete. The advantage of this arrangement is that you get the angle of attack direct, so any error calculating the boom angle from mainsheet servo position is removed.

That is useful for sail trimming but for navigation we need to know where the wind is really coming from. As you say, we can’t really use boom angle interpolated from main sheet, so you need a second sensor of some sort. We do support directly actuated wing sails, in which case you probably could use the interpolated position.

It is something I would like to add support for at some point. Our AP Periph firmware can now to RC, MAVLink as well as servo outs, GPS compass ect over CAN. So you would only need power and CAN up to some smarts on the mast and just keep the main flight controller and batteries down in the hull.

1 Like

@skyscraper draft PR here: Gazebo: add sailing catarmaran model by srmainwaring ¡ Pull Request #113 ¡ ArduPilot/SITL_Models ¡ GitHub

There is an author section in the model.config. Please let me know what details you’d like there for yourself, and any additional notes you’d like added in the model description.

  • The model is fully rigged - all joints, plugins etc are included.
  • The inertia moments need to be corrected - current estimates are too large.
  • The AP params for sailboat provided servo control of rudders and sail, rate controller PIDs are not tuned.
  • The sail and foil lift are not working correctly at the moment.
    • Foils need the CP adjusted (currently at link origin).
    • The sail lift drag and controller plugins are mis-behaving. The sail is is generating lift when back-winded which should not happen. Currently looking into that.
  • Docs need updating. There are plugin dependencies on external wave and sailing repos which need additional explanation.

@rhys Hi again. Look forward to looking at the PR properly. My current problem is that I can’t really get the simple asv_wave-sim example working. I will PM you about it.
"

@skyscraper, sure drop me a message. You can also catch up on the AP discord server.

The model is better set up now, and I’ve run an initial tune of the AP heel controller for you catamaran and its holding a float out now when there is enough wind. The sail joint controller (in Gazebo - not AP) is still out of tune, so it’s not sheeting quite to where the AP controller would like it all the time. (In Gazebo you need to also tune the force controlled joint position and velocity controllers - it’s like having to tune your servo motors or the ESCs by hand).

Interestingly when I increase the waves slightly from flat water we start to see the difficulties in auto controlling a multi-hull. If the leeward hull catches it will pitchpole, and there is no controller to catch that (sheet out and bear away - so over it goes).

1 Like

Hi @rhys Looks brilliant in the video. The capsize is absolutely true behaviour for my cat (Will be more pronounced on this at smaller size ). Most racing model cats have foils on the rudder, which holds the back down… until it doesnt. They all flip eventually! You can see the rudder foils on most of the multihuls in this video
https://www.youtube.com/watch?v=5YQB1Gqb-1w.

Could also make the distance between the hulls shorter so it will go over sideways.

Anyway that is absolutely fantastic!

@rhs BTW the center of effort of the sail looks quite a way forward of where it should be( on old version, not looked at new version). For a very cambered foil like this in 2d it will be quite far aft compared to an aircraft wing, around 35% or a bit more of the chord of the aerofoil. Not sure but that might help the sail to set?

Yeah - it’s a bit tricky to get right. I had it further aft but the boat was rounding up (and also the sail controller was struggling as the load moved away from the pivot - the servo one, not the AP one). I’ll need to spend more time getting the controller tuned well, then I can shift it back again. The lift drag calculation is very simplistic in Gazebo, and there is not a lot of wriggle room to get nice behaviour. It’s something that would be a good add for both sail boats and aircraft.

Could try moving the daggerboards back …?

Thanks for doing this work. Absolutely brilliant!

(I put them forward because that is the modern trend ( for foiling), but it must put the boat well out of balance and make it harder to tack

It’s quite easy to move the foils about now that the model’s set up. I’ve set them up as separate links so the position and orientation can be adjusted independently of everything else. The lift calculation is relative to the foil link origin so that will adjust automatically.

I can see lots of fun to be had with this. If you crank the foils inwards and add rudder T foils you can get some foiling maybe. :slight_smile: Currently am working through the Gazebo docs, so hope to be able to contribute at some point!