PSU 541: Artificial Intelligence Professor: Bart Massey Fall 2004 By David Allen, 11-15-2004 Project Prospectus: PSAS Rocket Simulator Introduction: The Portland State Aerospace Society (PSAS) [1] has the goal to be the first amateur group to build an actively guided rocket. The group needs a flexible simulated environment to test current and future intelligent avionics systems. I will rebuild and expand the current simulator to create a modular engineering tool for testing the fully integrated rocket, individual systems, and prototype avionics. For the first version of the simulator, I will only implement relatively simple models of the environment, rocket body and rocket systems; but I will build the code to allow easy expansion and replacement of these first models. The code will be open-source and I will document the work on the PSAS Wiki site [2]. Current Simulator and Needs: The current simulator [3] was written by Bart Massey in Nickle [4]. It is a basic simulator for a rocket with a single boost stage, a drogue chute and a main chute. It simulates a purely vertical flight path with acceleration applied by rocket boost, by gravity and by friction. The state of the rocket is used to generate system specific messages that contain pressure measurements, inertial measurements, and launch pad umbilical disconnects. Commands to ignite the engine and deploy the parachutes must be manually entered at a command prompt at the correct times. The primary enhancement requests from the PSAS team are for a fully automated simulation, for a faster simulation rate, for a more complete rocket system model, and for a more complex physics model. Automation of the simulation is highly desired. The current simulator requires the operator to manually enter simulator commands during the test flights. These commands can be initiated at the right time by looking at messages from launch control and from the flight computer. The current rate of simulation, at 20 frames per second, is much slower than data rate produced by some of the rocket sensors. The accelerometer produces 2,500 messages per second, and the gyroscope produces 833 messages per second. Not every system needs to produce data at the same rate, allowing systems to run at different rates could be very useful. Additional rocket sensors need to be implemented in the simulator. Primarily GPS messages are missing from the current simulator. The real rocket systems accept and respond to messages. A fully functioning rocket simulator would respond to messages in the same way that the real systems do. Ideally most of the real system code would be used in the simulator, but this is likely to require extensive code refactoring. Until that work is done, a simple model of message responses will probably be good enough. Improving the physics model to include full 3D motion simulation, mach boundary conditions, wind, air density and perhaps even orbital mechanics could be useful additions to support future work. I'm sure that simple models, like that of wind, could be added with little work, but the more complex models will probably have to wait. New Simulator: I will be writing the new simulator in C++ with an object oriented design. The primary target platform is Debian GNU/Linux [5], but I may also make it portable to MS Windows. I will use CppUnit [6] to unit test the code. From my personal simulation projects I have a code base for this type of work that I can pull from. I will be using rapid-prototyping and rapid-development methodologies. I intend to quickly build a basic working framework and then add more functionality based on my remaining project time and the needs of the PSAS software team. There will be five sections of work; the configuration file, the physics engine, the environment models, the rocket physics model, and the rocket systems models. The configuration file will contain all of the run-time settable simulator parameters. This will include parameters like launch location and elevation, sensor signal noise level, boost force and much more. I will keep the file format simple initially, basically a "name = value" format with sets of parameters marked with a header in the form "[set name]". The physics engine will be very basic and will tie together the environment models and the rocket physics model. It will utilize the forces reported by the environment models and the rocket physics model to calculate the rocket's motion through 3D space. Due to the tight schedule, I will probably keep the environment and rocket physics models similar to their current implementation. These models include gravity, ground, air-pressure, drag on the rocket body and on the chutes. Ideally I will spend most of my time working with the rocket systems models. These models will simulate the rocket's sensors and actuators and need to present a realistic and responsive interface to the flight computer. To complete these models I will need to work closely with the team to determine which systems must be implemented first, and how they need to interact with the real rocket hardware. The rocket will be simulated in real time. The physics engine and each rocket system will run in its own thread with individual timing. The timing rates will be specified in the configuration file and can be adjusted to get the desired performance. I don't see any immediate obstacles to simulating the rocket systems at full speed. Future Work: Continuing work on the simulator will be essential to meet the current and future needs of the PSAS team. This work will focus on making the simulator more generic, improving its models, and improving its use for testing. A more generic simulator would support advanced configuration from files. As more elements of the environmental and rocket models can be defined in configuration files, testing new designs under novel conditions will become easier. Improving the models of the environment and rocket will help to make the simulated flights much more realistic and useful. Improvements in the rocket model could include simulating what happens to the rocket and its sensor data at supersonic speeds, at high altitudes, or under unusual conditions such high spin. While simulating the behavior of rocket systems, it would be ideal to use as much of the actual rocket code as possible. Displaying the flight in 3D with the actual amateur TV overlay could improve the diagnosis of problems when things go wrong, and would be a great tool to use during public demonstrations. Turning the simulator into an fully automated rocket testing platform will help to ensure the future success and safety of PSAS rocket launches. It should be possible to run the simulation without having access to any of the actual rocket hardware, as well as running it with a selected subset. By using configuration files, it would be great to be able to be able to script flight profiles, including weather and flight glitches such as bad or missing sensor data. Ultimately these flight profiles should be strung together for automated rocket testing with logging, so that results can be reported, and reproduced. Bibliography: 1: http://psas.pdx.edu 2: http://psas.pdx.edu/RocketSim 3: http://cvs.psas.pdx.edu/c/tools/rocketsim/rocket.5c?rev=1.2 4: http://www.nickle.org 5: http://www.debian.org 6: http://cppunit.sourceforge.net/cgi-bin/moin.cgi