Simulation Fidelity for Software
A simulator used to verify flight software is not asked to be physically correct. It is asked to produce, at the software’s interfaces, a signal the software cannot distinguish from the flight signal in the respects the software depends on. Where it fails at that, the failure is specific and mostly documented: force, imagery and time [1][2][3]. The terramechanics and rendering fidelity questions belong to simulation and digital twins. This page covers what those gaps do to the software under test.
Fidelity is chosen per interface, not per simulator
Section titled “Fidelity is chosen per interface, not per simulator”MSL’s workstation simulator models every hardware behavior the flight software can observe, as finite state machines, integrating differential equations where the dynamics demand it [3]. The deliberate exception is content: for several science instruments it produces data that is correct in format and not in content, because the flight software depends on the format and not on the content. The rule generalizes, and it bounds what these venues can find: nothing downstream of a value the simulator did not make right [1][3].
Mars 2020’s Surface System Development Environment makes the choice explicit by keeping one interface to the flight software and three interchangeable backends behind it: a deterministic abstraction layer for force and motion, a terrain simulator with slip modeling, visual odometry, pose tracking and rendered imagery, and a motor server driving real testbed hardware over TCP/IP [2], the physical venues being the scarce resource the environment exists to conserve. The same test can be raised or lowered in fidelity without being rewritten, which is what makes the fidelity a per-run choice.
Contact force is modeled as a plane and a margin
Section titled “Contact force is modeled as a plane and a margin”The force interfaces are where the divergence is largest and best documented.
SSim does not model the physics of a drill bit in rock. It uses force feedback averaged from past flight data with a margin allocation, and bounds terrain contact forces by an assumed hardness with margin [1]. For the operational purpose, checking that a commanded sequence will complete, that is sufficient; for predicting the force a specific rock will produce, it is not, and the paper says so.
The Mars 2020 abstraction layer computes a simulated force as a function of the end-effector’s penetration into a parameterized plane, then converts that force into the strain gauge voltages the flight software actually reads [2]. Contact is a plane and a penetration depth, and the flight software sees plausible gauge counts. Docking simulation in the surface simulator used for operations does the same thing, modeling the dock as a rigid flat plane and populating the reaction forces into simulated strain gauge channels; it does not capture the post and cone contact physics, and is described as effective for finding commanding and sequencing errors rather than for predicting loads.
The consequence for verification is a clean split. Sequencing errors, state errors and command ordering errors are found in simulation. Contact dynamics, limit cycling and force sensor behavior in contact are found on hardware: thermal testing of the Perseverance arm found a limit-cycling condition during docking that required an algorithm change, which no planar contact model would have produced [8]. Docking was also exercised more than 1200 times on a hardware testbed before flight.
Sensor models exist to keep the algorithms fed
Section titled “Sensor models exist to keep the algorithms fed”The terrain simulator renders camera imagery for visual odometry, stereo ranging and map generation, and applies artificial visual texture to the terrain to guarantee the image processing has features to find [2]. The simulated world is deliberately easier to see than the real one, because the purpose is to exercise the pipeline rather than to test whether it finds features at all. Feature starvation over bland terrain, which is the dominant flight failure mode of visual odometry, is therefore not something this venue can find.
The slip model behind the imagery is described as approximated rather than as terramechanics, and the wheel drop calculation as approximated from a moving window of poses [2]. Both are adequate for the flight software’s decision logic and inadequate as predictions of vehicle behavior.
Time is the fidelity that gets traded first
Section titled “Time is the fidelity that gets traded first”Every software-only venue in the record buys throughput by abandoning real time. The MSL workstation simulator runs 2 to 10 times faster than real time depending on scenario complexity, and the trade is stated plainly: minimizing idle time and running fast costs real-time fidelity [3]. The Mars 2020 build runs 6 times faster than real time [2]. SSim executes rover behaviors up to 1000 times faster than the flight compute element [1] and does not reproduce the real-time constraints or the determinism of the flight software; it is single-threaded for repeatability where the flight software is not. The terrain simulator runs at 8 Hz of simulated time [2].
Two timing gaps follow. The first is bus response: the simulated PCI bus cannot respond on the microsecond timescale real hardware does, and its responses have to be coordinated on the simulator’s time slices [2]. The second is concurrency: a single-threaded deterministic simulator cannot produce the interleavings a preemptive multi-tasking flight software will produce on the vehicle. The sol 516 image loss is that class of defect: a background image compression task lost CPU to higher-priority communication tasks during a communication pass, and the automatic camera power off triggered before the readout completed, losing the data [7].
The workstation venues are not fidelity-free on timing, though. MSL’s flight software internal testing describes the workstation simulator running at 512 Hz, a higher rate than the real hardware testbeds, over a VxWorks simulator [4], and the avionics simulator maintains a deterministic event-driven scheduler with multiple rate groups: 1 kHz dynamics, 200 Hz bus events, a 64 Hz timing interrupt and 400 Hz IMU [3]. The scheduling structure is reproduced; the latency is not.
What no simulator injects
Section titled “What no simulator injects”Real hardware failures are not injected into hardware-in-the-loop venues, for the obvious reason that damaging the testbed is expensive [2]. Fault injection is a software venue capability instead: the MSL workstation simulator injects faults either at the functional level or by setting individual bits, and supports pause, resume and single step around the injection [3]. So faults are exercised in the venue with the least physical fidelity, which puts the burden on the fault model being right [3][6].
The onboard planner verification states the limit that follows from all of this: the problem space the planner will meet in flight is unbounded and had to be constrained to a finite set of testable units, and neither unknown deviations from predicted activity execution nor the behavioral uncertainty of flexible execution could be covered [5]. Its testable scenarios were drawn from hundreds of sols of real planning rather than generated, which is a statement about what the team trusted to be representative, and the same campaign leaned on the workstation simulator for volume and on hardware venues only where thermal fidelity was required.
The fidelity that matters is not always physical
Section titled “The fidelity that matters is not always physical”The defect study across seven spacecraft found that outdated or missing procedures were involved in one fifth of 199 critical post-launch anomalies, and that requirements changes were dominated by new requirements for rare events and for compensating hardware degradation rather than by corrections to wrong requirements [6]. Neither class is reachable by raising the fidelity of a contact model. The same study’s 311 MER developmental problem reports were useful in a way no simulator intends: the reports where testers believed the software was wrong when it was correct predicted which features would confuse operators, and drove training and documentation before launch [6].
Summary of the known divergences
Section titled “Summary of the known divergences”| Interface | What the simulator does | What it therefore cannot find |
|---|---|---|
| Contact force | penetration into a parameterized plane converted to strain gauge voltages [2]; historical averages with margin [1] | contact dynamics, limit cycling, load prediction [8] |
| Camera imagery | rendered with artificial texture added to guarantee features [2] | feature starvation and the visual odometry failures that follow from it [1] |
| Slip and wheel drop | approximated models, not terramechanics [2] | mobility performance, sinkage, embedding |
| Concurrency | single-threaded deterministic execution [1] | priority inversion under load, as on sol 516 [7] |
| Timing | 2 to 1000 times real time, deterministic single-threaded execution [1][3] | interrupt latency, race conditions, priority inversion under load |
| Bus response | coordinated on simulator time slices [2] | microsecond-scale hardware response behavior |
| Instrument data | correct format, sometimes not correct content [3] | anything downstream of instrument data values |
| Hardware faults | injected in software only, functionally or bitwise [3] | failure modes the fault model does not contain [6] |
References
- Verma, V. and Leger, C. (2019). SSim: NASA Mars Rover Robotics Flight Software Simulation
. IEEE Aerospace Conference. Source
BibTeX
@inproceedings{verma2019ssim, title = {SSim: NASA Mars Rover Robotics Flight Software Simulation}, author = {Verma, Vandi and Leger, Chris}, booktitle = {IEEE Aerospace Conference}, pages = {1-11}, address = {Big Sky, Montana}, year = {2019}, doi = {10.1109/aero.2019.8741862}, abstract = {Each new Mars rover has pursued increasingly richer science while tolerating a wider variety of environmental conditions and hardware degradation over longer mission operation duration. Sojourner operated for 83 sols (Martian days), Spirit for 2208 sols, and Opportunity is at 5111 sols, and Curiosity operation is ongoing at 2208 sols. To handle this increase in capability, the complexity of onboard flight software has increased. MSL (also known as Curiosity), uses more flight software lines of code than all previous missions to Mars combined, including both successes and failures[1]. MSL has more than 4,200 commands with as many as dozens of arguments, 54,000 parameters, and tens of thousands of additional state variables. A single high-level command may perform hours of configurable robotic arm and sampling behavior. Incorrect usage can result in the loss of an activity or the loss of the mission. Surface Simulation (“SSim”) was developed to address the challenge of making full and effective use of many capabilities of MSL, while managing complexity and risk. SSim is software that performs rapid context sensitive simulation of flight software. NASA Mars missions are comprised of three phases: several months of Cruise, a brief but exciting Entry Descent and Landing (EDL), and a Surface mission that typically lasts as long as the hardware survives. SSim is meant for use during the surface phase when the mission fulfills its primary objectives. The focus of SSim on MSL was the robotic flight software, including rover mobility and navigation, robotic arm manipulation, and sample acquisition, processing, and delivery. It can execute behaviors in simulation a thousand times faster than they execute in real time on the flight compute element. SSim is used by rover drivers to develop and validate command sequences throughout the planning cycle. SSim has been used to plan all of the Curiosity robotic operations since landing and is expected to continue to be used for the remaining life of the rover. Due to the impact of SSim on MSL, the Mars 2020 mission plans to increase the scope of SSim during flight operations, simulating not only rover planner operations, but all surface operations, including the instrument, power, thermal and telecommunication behavior. SSim is part of the Rover Sequencing and Visualization (RSVP) suite of Rover Planning tools [2]. In the paper we provide an overview of SSim architecture, design, implementation, and usage on MSL, as well as an overview of plans for Mars 2020.} } - Brooks, S., Litwin, T., Biesiadecki, J., Abcouwer, N., Del Sesto, T., McHenry, M., Myint, S., Twu, P. and Wai, D. (2022). Testing Mars 2020 Flight Software and Hardware in the Surface System Development Environment
. IEEE Aerospace Conference. Source
BibTeX
@inproceedings{brooks2022testing, title = {Testing Mars 2020 Flight Software and Hardware in the Surface System Development Environment}, author = {Brooks, Sawyer and Litwin, Todd and Biesiadecki, Jeffrey and Abcouwer, Neil and Del Sesto, Tyler and McHenry, Michael and Myint, Steven and Twu, Philip and Wai, Dennis}, booktitle = {IEEE Aerospace Conference}, pages = {1-13}, address = {Big Sky, Montana}, year = {2022}, doi = {10.1109/aero53065.2022.9843794}, abstract = {The Mars 2020 (M2020) Perseverance Rover is NASA's most advanced planetary rover mission to date. It includes a novel Sample Caching Subsystem (SCS) which will collect rock cores for possible future return to Earth, as well as an improved mobility system with enhanced autonomous navigation which will enable it to traverse faster and farther than prior rovers. The development of both systems required extensive flight software and flight hardware testing. To support this testing, we developed the Surface System Development Environment (SSDEV) and used it for a wide variety of testing. SSDEV is a bundled subset of M2020 Flight Software which runs on commercially available Linux computers and can be combined with multiple backend options for simulation and hardware control. The SSDEV architecture enabled our teams to perform much more testing of flight software and flight hardware than would have otherwise been possible. As a secondary benefit, the SSDEV-based test campaigns also helped our teams enter the operations phase of the mission with greater readiness of operations products and tools. In this paper, we summarize the motivation for SSDEV, provide an overview of the SSDEV architecture, list several examples of how SSDEV was used, and summarize lessons learned. SSDEV is not a substitute for integrated testing with flight-like avionics, but it enabled substantially more testing than would have otherwise been possible and also provided some unique benefits. We recommend architectures like SSDEV to future projects that need to perform extensive hardware and software testing using a limited set of flight-like avionics.} } - Henriquez, D., Canham, T., Chang, J. T. and McMahon, E. (2008). Workstation-Based Avionics Simulator to Support Mars Science Laboratory Flight Software Development
. AIAA SPACE Conference and Exposition. Source
BibTeX
@inproceedings{henriquez2008workstation, title = {Workstation-Based Avionics Simulator to Support Mars Science Laboratory Flight Software Development}, author = {Henriquez, David and Canham, Timothy and Chang, Johnny T. and McMahon, Elihu}, booktitle = {AIAA SPACE Conference and Exposition}, year = {2008}, doi = {10.2514/6.2008-6550}, abstract = {The Mars Science Laboratory developed the WorkStation TestSet (WSTS) to support flight software development. The WSTS is the non-real-time flight avionics simulator that is designed to be completely software-based and run on a workstation class Linux PC. This provides flight software developers with their own virtual avionics testbed and allows device-level and functional software testing when hardware testbeds are either not yet available or have limited availability. The WSTS has successfully off-loaded many flight software development activities from the project testbeds. At the writing of this paper, the WSTS has averaged an order of magnitude more usage than the project's hardware testbeds.} } - Jones, J. D. and Lam, D. (2011). Mars Science Laboratory Flight Software Internal Testing
. NASA Jet Propulsion Laboratory, Undergraduate Student Research Program Final Report. Source
BibTeX
@techreport{jones2011mars, title = {Mars Science Laboratory Flight Software Internal Testing}, author = {Jones, Justin D. and Lam, Danny}, institution = {NASA Jet Propulsion Laboratory, Undergraduate Student Research Program Final Report}, year = {2011}, url = {https://dataverse.jpl.nasa.gov/dataset.xhtml?persistentId=hdl:2014/43488} } - Parjan, S. and Gaines, D. (2024). In OBP We Trust: Verification and Validation of the M2020 On Board Planner Flight Software
. IEEE Aerospace Conference. Source
BibTeX
@inproceedings{parjan2024obp, title = {In OBP We Trust: Verification and Validation of the M2020 On Board Planner Flight Software}, author = {Parjan, Shreya and Gaines, Dan}, booktitle = {IEEE Aerospace Conference}, address = {Big Sky, Montana}, year = {2024}, doi = {10.48577/jpl.67lmez}, abstract = {With a planned deployment to the Perseverance roverin October 2023, the Mars 2020 On Board Planner (OBP) flightsoftware (FSW) will allow the rover to conserve energy and au-tonomously perform more activities when surplus resources (i.e.energy, data volume, time) are available. This functionality iscritical to support efficient resource management and maximizethe productivity of the vehicle as the rover’s battery degradesover time, particularly as the Mars Sample Return mission(MSR) may rely on Perseverance to facilitate sample deliveryto the return lander. Up until OBP’s deployment, operatorshave used the Master/Sub-Master paradigm (M/SM) for allMars missions to-date, in which rigid plans are uplinked to therover based on highly conservative models of activity resourceconsumption and duration that can unnecessarily constrain on-board plans. Thus, OBP must be robust enough to merit thetrust of mission science and operations personnel and preservethe health and safety of the spacecraft. To this end, we havecompleted a thorough verification and validation (V&V) cam-paign of the first iteration of OBP that will be deployed to therover as part of new Simple Planner (SP) operations paradigm.The campaign heavily relied on software testing to ensure thatcore flight software capabilities were met and that the softwarecomprehensively covered potential edge cases. In this paper,we motivate the need for a thorough V&V campaign going intothe deployment of On Board Planner to the Perseverance rover,contextualize how OBP integrates with the rest of the vehicle’sflight software, and leverage three case studies to evidence howtesting provided critical support towards the successful infusionof onboard scheduling software on the rover.} } - Lutz, R. R. and Mikulski, I. C. (2003). Patterns of Software Defect Data on Spacecraft
. NASA Office of Safety and Mission Assurance, Jet Propulsion Laboratory. Source
BibTeX
@techreport{lutz2003patterns, title = {Patterns of Software Defect Data on Spacecraft}, author = {Lutz, Robyn R. and Mikulski, Ines Carmen}, institution = {NASA Office of Safety and Mission Assurance, Jet Propulsion Laboratory}, year = {2003}, url = {https://dataverse.jpl.nasa.gov/dataset.xhtml?persistentId=hdl:2014/7132} } - Siegfriedt, R. S., Girerd, A., Hazelrig, J., Gaines, D., Fosse, E., Appakonam, A., Waldram, N., Plave, A. and Rozek, M. (2023). Enabling Parallel Activities for Mars 2020 Rover Surface Operations
. IEEE Aerospace Conference. Source
BibTeX
@inproceedings{siegfriedt2023enabling, title = {Enabling Parallel Activities for Mars 2020 Rover Surface Operations}, author = {Siegfriedt, Rebekah S. and Girerd, Andre and Hazelrig, James and Gaines, Daniel and Fosse, Elyse and Appakonam, Ashwin and Waldram, Nicholas and Plave, Andrew and Rozek, Matthew}, booktitle = {IEEE Aerospace Conference}, address = {Big Sky, Montana}, year = {2023}, doi = {10.48577/jpl.obe5e4}, abstract = {Level 1 requirements levied on the Mars 2020 mission from NASA Headquarters challenged the Mars 2020 surface mission (also known as the Perseverance rover) to perform significantly better relative to the 2012 Mars Science Lab (MSL) surface mission (also known as the Curiosity rover). In one and a quarter Mars years, the Perseverance rover was expected to drive 50 percent farther and collect over twice as many samples as its predecessor, Curiosity. In order to reach these requirements, Mars 2020 came up with five guiding principles, two of which were “Be fast, be flexible: perform flight and ground functions more quickly” and “Do more science: increase the time that the vehicle is actively pursuing science on Mars''. These guiding principles required the mission to lay the groundwork early on for more surface activities to be performed in parallel, such as thinking while driving. Parallelism enabled both direct efficiency gains, such as completing multiple activities simultaneously during a given time frame, and indirect gains, such as increased available energy and better informed tactical planning due to more data being available sooner. These efficiency gains allowed the rover to complete more complex plans and better handle adversity such as data return disruptions. Although the mission planned to test and approve most of the parallel activities in the development phase, limitations on budget, time and personnel drove the majority of parallel activity testing and approvals to occur in the operations phase. Ideally, any activity can run concurrently with any other activity, but constraints such as Electromagnetic Interference (EMI), hardware safety, and resource utilization prevent some activities from running in parallel. In order to coordinate these behaviors on the rover, the mission needed an efficient and streamlined mechanism to manage them on the ground and maximize the amount of time the rover could pursue science on Mars. In response to this challenge, the Mars 2020 Surface Operations Team overhauled a legacy product from MSL called the Parallelism Matrix. Over the course of the primary mission, the Mars 2020 Parallelism Team made the following improvements: established a process to triage untested activity parallelism, enabled automatic updates to the matrix after downlinked data was analyzed, created a thorough testing campaign to investigate and approve untested parallel interactions, and provided a tool to autonomously track executed parallel activities as soon as data hit the ground.This paper will discuss: similarities and differences between the Perseverance and Curiosity missions with respect to maximizing science exploration time, Mars 2020’s new Flight Software (FSW) capabilities that enabled more parallelism, the Surface EMI testing campaign, the Surface Operations Parallelism Working Group efforts, Surface Operations parallelism tools and processes, the current state of parallel activity efforts on Mars 2020, the measurable benefits and achievements of parallelism, and the lessons learned and recommendations for the future.} } - Brooks, S., Townsend, J., Collins, C., Carsten, J., Frost, M., Reid, J., Robinson, M. and Warner, A. (2022). Docking the Mars 2020 Perseverance Robotic Arm
. IEEE Aerospace Conference. Source
BibTeX
@inproceedings{brooks2022docking, title = {Docking the Mars 2020 Perseverance Robotic Arm}, author = {Brooks, Sawyer and Townsend, Julie and Collins, Curtis and Carsten, Joseph and Frost, Matthew and Reid, Jason and Robinson, Matthew and Warner, Antonia}, booktitle = {IEEE Aerospace Conference}, pages = {1-12}, address = {Big Sky, Montana}, year = {2022}, doi = {10.1109/aero53065.2022.9843517} }