public Vehicle(IMavlinkV2Connection connection, VehicleConfig config) { if (connection == null) { throw new ArgumentNullException(nameof(connection)); } if (config == null) { throw new ArgumentNullException(nameof(config)); } _mavlinkConnection = connection; _rtt = new RawTelemetry(_mavlinkConnection, new RawTelemetryConfig { ComponentId = config.ComponentId, HeartbeatTimeoutMs = config.HeartbeatTimeoutMs, SystemId = config.SystemId }); _params = new VehicleParameterProtocol(_mavlinkConnection, new VehicleParameterProtocolConfig { ComponentId = config.ComponentId, SystemId = config.SystemId, ReadWriteTimeoutMs = config.ReadParamTimeoutMs, TimeoutToReadAllParamsMs = config.TimeoutToReadAllParamsMs }); _vehicleCommands = new VehicleCommandProtocol(_mavlinkConnection, new CommandProtocolConfig { ComponentId = config.ComponentId, CommandTimeoutMs = config.CommandTimeoutMs, SystemId = config.SystemId }); _mission = new VehicleMissionProtocol(_mavlinkConnection, new VehicleMissionProtocolConfig { ComponentId = config.ComponentId, SystemId = config.SystemId }); _offboard = new OffboardMode(_mavlinkConnection, new OffboardModeConfig()); }
public VehiclePx4(IMavlinkV2Connection conn, VehicleConfig config) : base(conn, config) { _config = config; Connection .Where(FilterVehicle) .Where(_ => _.MessageId == HeartbeatPacket.PacketMessageId) .Cast <HeartbeatPacket>() .Select(_ => new Px4VehicleMode(_.Payload)) .Subscribe(_px4Mode); }