pub struct SitlAutopilot { /* private fields */ }Expand description
A hardware-free autopilot stand-in for software-in-the-loop testing.
It behaves like the parts of an autopilot a ground station first talks to: it emits a
Heartbeat on demand, answers a CommandLong with a CommandAck, and speaks both
sides of the mission protocol, receiving an uploaded plan and serving it back on download.
Wire it to one end of a MemoryLink::pair and drive a ground-station Connection or a
Vehicle on the other to exercise the full connect, command,
mission, and telemetry path in a test.
Implementations§
Source§impl SitlAutopilot
impl SitlAutopilot
Sourcepub fn new(link: MemoryLink, system_id: u8, component_id: u8) -> Self
pub fn new(link: MemoryLink, system_id: u8, component_id: u8) -> Self
Sourcepub fn load_mission(&mut self, items: &[MissionItemInt])
pub fn load_mission(&mut self, items: &[MissionItemInt])
Preloads the plan the autopilot serves on a mission download.
§Arguments
items- the mission items to store.
Sourcepub async fn emit_heartbeat(&mut self) -> Result<()>
pub async fn emit_heartbeat(&mut self) -> Result<()>
Sourcepub async fn serve_once(&mut self) -> Result<Frame>
pub async fn serve_once(&mut self) -> Result<Frame>
Reads one frame and answers it the way an autopilot would.
A command is acknowledged as accepted; a mission upload is received and stored; a mission download is served from the stored plan. Any other frame is read and left unanswered. Call it in a loop to keep the autopilot responsive.
§Returns
The frame that was read.
§Errors
Returns the same errors as Connection::recv and Connection::send.