"""Shared pytest fixtures for the AR-Autopilot Sprint 0 test suite.""" from __future__ import annotations import pytest from arautopilot.core import ( ActuatorConfig, ActuatorType, GainSchedulePoint, PidConfig, PidGains, ProjectConfig, VesselConfig, VesselType, ) @pytest.fixture def hydraulic_actuator() -> ActuatorConfig: """A realistic hydraulic reversible actuator config for fixture composition.""" return ActuatorConfig( type=ActuatorType.HYDRAULIC_REVERSIBLE, name="Test Hynautic-class pump", deadband_pct=7.0, min_useful_pwm_pct=12.0, asymmetry_stbd_over_port=1.0, max_rudder_angle_deg=35.0, max_rate_dps=4.0, max_current_a=20.0, feedback_required=True, ) @pytest.fixture def basic_pid() -> PidConfig: """A minimal valid cascaded PID with a 3-point gain schedule.""" return PidConfig( inner_loop_base=PidGains(kp=2.5, ki=0.15, kd=0.30), outer_loop_base=PidGains(kp=0.90, ki=0.02, kd=1.20), gain_schedule=[ GainSchedulePoint(speed_knots=5.0, gains=PidGains(kp=1.20, ki=0.03, kd=0.80)), GainSchedulePoint(speed_knots=15.0, gains=PidGains(kp=0.90, ki=0.02, kd=1.20)), GainSchedulePoint(speed_knots=28.0, gains=PidGains(kp=0.55, ki=0.01, kd=1.80)), ], rot_feedforward_gain=1.5, ) @pytest.fixture def basic_vessel(hydraulic_actuator: ActuatorConfig, basic_pid: PidConfig) -> VesselConfig: return VesselConfig( name="M/Y Test 30", type=VesselType.YACHT_MOTOR_PLANEO, length_m=30.0, displacement_t=120.0, max_speed_kn=28.0, actuator=hydraulic_actuator, pid=basic_pid, ) @pytest.fixture def basic_project(basic_vessel: VesselConfig) -> ProjectConfig: return ProjectConfig( client_name="Test Client S.L.", project_name="Sprint 0 demo project", notes="Generated by conftest fixture.", vessel=basic_vessel, )