ArduPilot / SITL_Models

Models of aircraft for SITL
70 stars 111 forks source link

Gazebo: add sailing catarmaran model #113

Closed srmainwaring closed 5 months ago

srmainwaring commented 6 months ago

Sailing Catamaran designed by Andy Little (@kwikius)

catarmaran_rigged_3

Usage

Gazebo and the plugins should be installed as per the ArduPilot Gazebo Plugin instructions.

Update the GZ_SIM_RESOURCE_PATH to include these models:

export GZ_SIM_RESOURCE_PATH=$GZ_SIM_RESOURCE_PATH:\
$HOME/SITL_Models/Gazebo/models:\
$HOME/SITL_Models/Gazebo/worlds

Waves model

The model is configured to work with the hydrodynamics plugin from the wave sim package. Follow the package instructions to set up the marine simulation.

Sail, foil, wind sensor and wind plugins

A number of additional plugins are required to support sailing vessels. These can be found at asv_sim. Installation instructions are in the repository README.

Run Gazebo

gz sim -v4 -r catamaran_waves.sdf

Run ArduPilot SITL

sim_vehicle.py -D -v Rover --model JSON --add-param-file=$HOME/SITL_Models/Gazebo/config/catamaran.param --console --map --custom-location='51.566151,-4.034345,10.0,-135'

Wave and wind settings

To run the simulation in calm seas modify the wave settings in asv_wave_sim/gz-waves-models/world_models/waves/model.sdf. There are two occurrences of the parameter block:

<wave>
  <!-- `fft` wave parameters -->
  <algorithm>fft</algorithm>
  <tile_size>256</tile_size>
  <cell_count>256</cell_count>
  <wind_speed>5.0</wind_speed>
  <wind_angle_deg>135</wind_angle_deg>
  <steepness>2</steepness>
</wave>

Update both blocks when making changes (one is for the physics, one for the visuals).

The catamaran_waves.sdf world file is configured to load a wind plugin that responds to service requests to set the wind. For ease of gyro and accelerometer calibration the wind is initially set to zero. Once the vehicle is initialised and armed the wind can be set using:

gz topic -t /wind -m  gz.msgs.Vector3d -p "x:{wind_vel_x}, y:{wind_vel_y}, z:0"

where {wind_vel_x} and {wind_vel_y} should be replaced by the desired components of the wind velocity in m/s. A good choice is "x:0, y:5, z:0" to get the boat moving, then once out of irons switch to "x:5.5, y:5.5, z:0"

The sail module in MAVProxy is useful for determining the current true and apparent wind direction.

kwikius commented 5 months ago

Looks great. My issue is that it needs a high end PC to work with the waves. That is a pity because you will lose a lot of potential users, who after getting through the installation hurdles, will then find that it locks up their PC. Maybe add another "world" where there are no waves? ( I will try to do that but will take a while!) Also wonder about chopping wind vane ( and its spar) from the rig and attaching to the front of the pod, which may be a more normal ardupilot config. Currently anyway it doesnt seem to function. I do prefer a wind vane ( and perhaps a cup anemometer) to the ultrasonic one because the visual is dynamic.

Did you increase the rig size or is that just the view. Bigger rig will of course pitchpole more easily. We could just make the hulls closer together to get it flying a hull, then less likely to pitchpole. Ideally width between hulls would be adjustable as well. Anyway it looks fantastic in the gazebo sim

kwikius commented 5 months ago

Other thing I was wondering about was making a simpler version of the hulls (and everything else) with less mesh points. Could use 1/2 the number of hull stations maybe and just simple flat plate foils, and remove complexity from the rig. Could also just use a normal mast rather than the z bend one. Not sure if that would help to speed up the sim on slow pc?

srmainwaring commented 5 months ago

catamaran_auto_4_trim