{# ---------------------------------------------------------------- #} {# general geometry and properties#} {# ---------------------------------------------------------------- #} {# geometry #} {# hull geometry #} {%- set hull_length = 4.7 -%} {%- set hull_max_diameter = 1.6 -%} {# gondola geometry #} {%- set gondola_length = 0.4 -%} {%- set gondola_width = 0.17 -%} {%- set gondola_height = 0.1 -%} {# fin geometry #} {%- set fin_root_chord = 0.465 -%} {%- set fin_thickness = 0.01 -%} {%- set fin_span = 0.39 -%} {# center of volume as measured from the nose #} {%- set hull_cov = 2.22 -%} {# distances: prefix d_ is measured from a specific point and prefix r_ is measured from CoV #} {# measured in body NED frame #} {# gondola distance from nose and height #} {%- set d_gon_x = 2 -%} {%- set r_gon_y = 0 -%} {%- set r_gon_z = 0.8486 -%} {# payload distance from nose and height #} {%- set d_pl_x = 2.4 -%} {%- set r_pl_z = 0.784 -%} {# thrust point distance from front of gondola and height #} {%- set d_p_x = 0.1 -%} {%- set r_p_z = 0.8486 -%} {# start of fin distance from nose and distance from center of hull #} {%- set d_fin_x_s = 3.635 -%} {%- set r_fin_rad = 0.5634 -%} {# actuator distances #} {# motor distance from gondola #} {%- set d_mot_y = 0.45 -%} {# thruster rod radius #} {%- set mot_rod_r = 0.01 -%} {# thruster prop radius (13") #} {%- set mot_prop_r = 0.1651 -%} {# thruster prop height #} {%- set mot_prop_h = 0.02 -%} {# rudder prop radius (5") #} {%- set rud_prop_r = 0.0635 -%} {# rudder prop height #} {%- set rud_prop_h = 0.02 -%} {# masses #} {# hull mass #} {%- set hull_mass = 1.7 -%} {# hull volume #} {%- set hull_volume = 5.97 -%} {# gondola mass #} {%- set gondola_mass = 3.3 -%} {# payload mass #} {%- set pl_mass = 1.05 -%} {# fin mass #} {%- set fin_mass = 0.055 -%} {# material properties #} {# air density (at MSL 15 deg) #} {%- set air_density = 1.225 -%} {# gas density (Helium) #} {%- set gas_density = 0.175 -%} {# motor properties #} {# maximum thruster rotational velocity (rad/s) #} {%- set mot_max_vel = 1500 -%} {# maximum thruster lift (kg) #} {%- set mot_max_thrust_kg = 1.62 -%} {# main thrusters time constant #} {%- set mot_tau = 0.05 -%} {# maximum thruster angle (rad) #} {%- set mot_max_angle = 135 * np.pi / 180 -%} {# maximum rudder rotational velocity (rad/s) #} {%- set rud_max_vel = 1500 -%} {# maximum rudder lift (kg) #} {%- set rud_max_thrust_kg = 0.24 -%} {# rudder motor time constant #} {%- set rud_tau = 0.025 -%} {# aerodynamic properties #} {# added mass due to the hull coefficients #} {%- set k_axial = 0.04662 -%} {%- set k_transverse = 0.9147 -%} {%- set k_rotation = 0.75567 -%} {# added mass due to the fins coefficients #} {%- set m_added_fins_k44 = 1 -%} {%- set m_added_fins_efficiency_factor = 0.191395 -%} {# ---------------------------------------------------------------- #} {# positions #} {# ---------------------------------------------------------------- #} {# spawn height above ground #} {%- set origin_height = 2 -%} {# hull center of volume #} {%- set origin_x = hull_cov - hull_length/2 -%} {%- set origin_y = 0 -%} {%- set origin_z = origin_height + hull_max_diameter/2 + gondola_height + 0.2 -%} {# ---------------------------------------------------------------- #} {# calculations #} {# ---------------------------------------------------------------- #} {# gas mass #} {%- set gas_mass = gas_density*hull_volume -%} {# total mass #} {%- set total_mass = hull_mass + gas_mass + gondola_mass + 4*fin_mass + pl_mass -%} {# distances (calculate from hull ellipsoid geometry) #} {# gondola center #} {%- set r_gon_x = hull_cov - d_gon_x -%} {# payload center #} {%- set r_pl_x = hull_cov - d_pl_x -%} {# thrust center #} {%- set r_p_x = hull_cov - (d_p_x + d_gon_x - gondola_length/2)-%} {# fin center #} {%- set r_fin_x = hull_cov - (d_fin_x_s + fin_root_chord/2) -%} {%- set r_fin_center_rad = r_fin_rad + fin_span/2 -%} {# center of gravity coordinate #} {%- set r_g_x = (gondola_mass*r_gon_x + 4*fin_mass*r_fin_x + pl_mass*r_pl_x)/total_mass -%} {%- set r_g_y = 0 -%} {%- set r_g_z = (gondola_mass*r_gon_z + pl_mass*r_pl_z)/total_mass -%} {# moment of inertia #} {# hull #} {%- set hull_ixx = (1/3)*hull_mass*((hull_max_diameter/2)**2 + (hull_max_diameter/2)**2) -%} {%- set hull_iyy = (1/3)*hull_mass*((hull_max_diameter/2)**2 + (hull_length/2)**2) -%} {%- set hull_izz = (1/3)*hull_mass*((hull_max_diameter/2)**2 + (hull_length/2)**2) -%} {# gas #} {%- set gas_ixx = (1/5)*gas_mass*((hull_max_diameter/2)**2 + (hull_max_diameter/2)**2) -%} {%- set gas_iyy = (1/5)*gas_mass*((hull_max_diameter/2)**2 + (hull_length/2)**2) -%} {%- set gas_izz = (1/5)*gas_mass*((hull_max_diameter/2)**2 + (hull_length/2)**2) -%} {# gondola #} {%- set gondola_ixx = (1/12)*gondola_mass*(gondola_height**2 + gondola_width**2) + gondola_mass*r_gon_x**2 -%} {%- set gondola_iyy = (1/12)*gondola_mass*(gondola_height**2 + gondola_length**2) + gondola_mass*r_gon_y**2 -%} {%- set gondola_izz = (1/12)*gondola_mass*(gondola_width**2 + gondola_length**2) + gondola_mass*r_gon_z**2 -%} {# payload #} {%- set payload_ixx = pl_mass*r_pl_x**2 -%} {%- set payload_iyy = 0 -%} {%- set payload_izz = pl_mass*r_pl_z**2 -%} {# fins #} {%- set fins_ixx = 4*((1/12)*fin_mass*(fin_span**2) + fin_mass*r_fin_x**2) -%} {%- set fins_iyy = 2*((1/12)*fin_mass*fin_root_chord**2 + fin_mass*r_fin_center_rad**2 + (1/12)*fin_mass*(fin_root_chord**2 + fin_span**2) + fin_mass*(r_fin_center_rad**2 + 0*r_fin_x**2)) -%} {%- set fins_izz = fins_iyy -%} {# total mass moment of inertia #} {%- set ixx = hull_ixx + gas_ixx + gondola_ixx + fins_ixx + payload_ixx -%} {%- set iyy = hull_iyy + gas_iyy + gondola_iyy + fins_iyy + payload_iyy -%} {%- set izz = hull_izz + gas_izz + gondola_izz + fins_izz + payload_izz -%} {# actuator properties #} {# simulation motor slowdown #} {%- set sim_rotor_slow = 10 -%} {# thruster motor constant #} {%- set mot_coeff = (mot_max_thrust_kg * 9.81)/(mot_max_vel**2) -%} {# thruster motor constant #} {%- set rud_coeff = (rud_max_thrust_kg * 9.81)/(rud_max_vel**2) -%} {# ---------------------------------------------------------------- #} {# macros #} {# ---------------------------------------------------------------- #} {%- macro inertial(m, ixx, iyy, izz) -%} {{m}} {{ixx}} {{iyy}} {{izz}} {%- endmacro -%} {%- macro inertial_offset(m, ixx, iyy, izz, x, y, z) -%} {{ x }} {{ y }} {{ z }} 0 0 0 {{m}} {{ixx}} {{iyy}} {{izz}} {%- endmacro -%} {%- macro cylinder(r, h) -%} {{r}} {{h}} {%- endmacro -%} {%- macro box(x, y, z) -%} {{x}} {{y}} {{z}} {%- endmacro -%} {%- macro thruster(motor_num, direction, reverse, parent, mass, dist_x, dist_y, dist_z, roll, pitch, radius, height, tau, max_vel, motor_constant, moment_constant, drag_coeff, roll_coeff) -%} {{ origin_x + dist_x }} {{ origin_y + dist_y }} {{ origin_z + dist_z }} {{ roll }} {{ pitch }} 0 {{ inertial(mass, mass*height**2, mass*(1/12)*((2*radius)**2 + height**2), mass*(1/12)*((2*radius)**2 + height**2))|indent(6) }} false false {{ radius * 2 / 0.25711 }} {{ radius * 2 / 0.25711 }} {{ height / 0.00959 }} model://cloudship/meshes/prop_{{ direction }}.dae {{ mot_prop_h }} {{ radius }} rotor_{{ motor_num }} {{ parent }} 0 0 1 -1e+16 1e+16 0 0 {# Only to visualize motor spin #} rotor_{{ motor_num }}_joint rotor_{{ motor_num }} {{ direction }} {{ reverse }} {{ tau }} {{ tau }} {{ max_vel }} {{ motor_constant }} {{ moment_constant }} {{ drag_coeff }} {{ roll_coeff }} /gazebo/command/motor_speed {{ motor_num }} /motor_speed/{{ motor_num }} {{sim_rotor_slow}} {%- endmacro -%} {%- macro fin(name, roll, y, z) -%} {{ r_fin_x - fin_root_chord/2 }} {{ y }} {{ z }} {{ roll }} 0 0 {{ box(fin_root_chord, fin_thickness, fin_span * 2) | indent(8) }} {{ r_fin_x - fin_root_chord/2 }} {{ y }} {{ z }} {{ roll }} 0 0 {{ box(fin_root_chord, fin_thickness, fin_span * 2) | indent(8) }} {%- endmacro -%} {# ---------------------------------------------------------------- #} {# SDF description #} {# ---------------------------------------------------------------- #} false false {# Airship #} {{ origin_x }} {{ origin_y }} {{ origin_z }} 0 0 0 {{ inertial_offset(total_mass, ixx, iyy, izz, r_g_x, r_g_y, -r_g_z)|indent(6) }} true false {# Hull #} {{ hull_length / 2 }} {{ hull_max_diameter / 2 }} {{ hull_max_diameter / 2 }} model://cloudship/meshes/ellipsoid.stl 0 0 0 0 0 0 {{ hull_length / 2 }} {{ hull_max_diameter / 2 }} {{ hull_max_diameter / 2 }} model://cloudship/meshes/ellipsoid.stl {# Gondola #} {{ r_gon_x }} {{ r_gon_y }} {{ -r_gon_z + gondola_height / 2 }} 0 0 0 {{ box(gondola_length, gondola_width, gondola_height * 2) | indent(8) }} {{ r_gon_x }} {{ r_gon_y }} {{ -r_gon_z }} 0 0 0 {{ box(gondola_length, gondola_width, gondola_height) | indent(8) }} {# Payload #} {{ r_pl_x }} {{ 0 }} {{ -r_pl_z }} {{ np.pi / 2 }} 0 0 {{ cylinder(0.05, 0.1) | indent(8) }} {{ r_pl_x }} {{ 0 }} {{ -r_pl_z }} {{ np.pi / 2 }} 0 0 {{ cylinder(0.05, 0.1) | indent(8) }} {# Fins #} {{ fin("fin_top", 0, 0, r_fin_rad - fin_span/2) }} {{ fin("fin_port", -np.pi / 2, r_fin_rad - fin_span/2, 0) }} {{ fin("fin_sb", np.pi / 2, -r_fin_rad + fin_span/2, 0) }} {{ r_fin_x - fin_root_chord/2 }} {{ 0 }} {{ -r_fin_rad - fin_span/2 }} 0 0 0 {{ fin_root_chord }} {{ fin_thickness }} {{ fin_span }} model://cloudship/meshes/fin_prop.stl {{ r_fin_x - fin_root_chord/2 }} {{ 0 }} {{ -r_fin_rad + fin_span }} 0 0 0 {{ box(fin_root_chord, fin_thickness, fin_span) | indent(8) }} {{ r_fin_x - fin_root_chord/2 }} {{ 0 }} {{ -r_fin_rad - fin_span/2 }} 0 0 0 {{ fin_root_chord }} {{ fin_thickness }} {{ fin_span }} model://cloudship/meshes/fin_prop.stl {# GPS joint which includes GPS plugin #} model://gps 0 0 0 0 0 0 gps gps::link hull {# Thrusters Rod #} {{ origin_x + r_p_x }} {{ origin_y }} {{ origin_z - r_p_z }} 0 0 0 {%- set thrusters_rod_mass = 0.5 -%} {{ inertial(thrusters_rod_mass, thrusters_rod_mass * (1/12)*(3*mot_rod_r**2 + (2*d_mot_y)**2), thrusters_rod_mass * 0.5*mot_rod_r**2, thrusters_rod_mass * (1/12)*(3*mot_rod_r**2 + (2*d_mot_y)**2))|indent(6) }} false false 0 0 0 {{ np.pi / 2 }} 0 0 {{ cylinder(mot_rod_r, 2*d_mot_y) | indent(8) }} {{ mot_prop_h }} {{ d_mot_y }} 0 0 {{ np.pi / 2 }} 0 {{ 1.1 * mot_prop_r }} {{ 1.1 * mot_prop_r }} {{ mot_prop_h }} model://cloudship/meshes/prop_gaurd.stl {{ mot_prop_h }} {{ -d_mot_y }} 0 0 {{ np.pi / 2 }} 0 {{ 1.1 * mot_prop_r }} {{ 1.1 * mot_prop_r }} {{ mot_prop_h }} model://cloudship/meshes/prop_gaurd.stl 0 {{ (d_mot_y - gondola_width/2)/2 + gondola_width/2 }} 0 {{np.pi / 2}} 0 0 {{ cylinder(mot_rod_r, d_mot_y - gondola_width/2) | indent(8) }} 0 {{ -((d_mot_y - gondola_width/2)/2 + gondola_width/2) }} 0 {{np.pi / 2}} 0 0 {{ cylinder(mot_rod_r, d_mot_y - gondola_width/2) | indent(8) }} hull thrusters_rod 0 1 0 -{{ np.pi }} {{ np.pi }} 0.1 1 {# Thrusters #} {{ thruster(0, "ccw", false, "thrusters_rod", 0.0025, r_p_x + mot_prop_h / 2 + mot_rod_r, d_mot_y, - r_p_z - mot_rod_r / 2, 0, np.pi / 2, mot_prop_r, mot_prop_h, mot_tau, mot_max_vel, mot_coeff, 0, 0.000806428, 0.000001) }} {{ thruster(1, "cw", false, "thrusters_rod", 0.0025, r_p_x + mot_prop_h / 2 + mot_rod_r, -d_mot_y, - r_p_z, 0, np.pi / 2, mot_prop_r, mot_prop_h, mot_tau, mot_max_vel, mot_coeff, 0, 0.000806428, 0.000001) }} {{ thruster(3, "cw", true, "hull", 0.0015, r_fin_x - fin_root_chord/2, 0, -r_fin_rad, np.pi / 2, 0, rud_prop_r, rud_prop_h, rud_tau, rud_max_vel, rud_coeff, 0, 0.000806428, 0.000001) }} {# Plugins #} {# Airship Dynamics #} hull {{ hull_volume }} {{ air_density }} 0.34094584 6.89645916 0.8003539 6.89645916 -0.8003539 0.03909877 -0.8003539 4.51385307 0.8003539 4.51385307 {{ hull_cov }} 3.758 3.884 0.7454 -0.9576310423950283 0.5829522229750153 1.9534480725890846 -1.1196943420983705 0.552208563394833 19.098 0.35 /wind_vel {# IMU #} hull /imu {# Magnetometer #} 20 0.0004 6.4e-06 600 /mag {# Barometer #} 10 /baro {# MAVLink #} /imu /gps /mag /baro INADDR_ANY 14560 4560 false /dev/ttyACM0 921600 INADDR_ANY 14550 false false true true true false 0 0 {{ mot_max_vel }} 0 0 velocity rotor_1_joint 1 0 {{ mot_max_vel }} 0 0 velocity rotor_2_joint 2 0 -{{ mot_max_angle }} 0 0 position 80 0 0 0.0 0.0 {{ mot_max_angle/2 }} -{{ mot_max_angle/2 }} thrusters_rod_joint 3 0 {{ rud_max_vel }} 0 0 velocity rotor_3_joint
80