Mars lander

Screenshot 0
Landing on Mars is hard.

One of the main difficulties is that the atmosphere isn't thick enough to stop a landing craft. It can slow the lander enough to deploy a parachute, and the parachute can slow the lander to a few tens of metres per second. But that isn't slow enough - the crash would be comparable to hitting a concrete block while breaking the speed limit on a motorway.

Another challenge is that the journey from leaving earth to deploying the solar panels has many steps, and testing them all accurately is very difficult. Each needs to succeed.

The simulation here is meant to show how some of the steps involved in landing a space probe on Mars would work.

The simulation is loosely based around the Schiaparelli Probe, but the details are slightly different. The suspected failure that lead to the loss of the Schiaparelli probe isn't replicated here because it's a 2-dimensional simulation.

The simulation here is made slightly easier by the lack of a requirement to ditch the parachute. The real probe had to ditch the parachute, and then fly to the ground, landing away from where the parachute might drift.

The simulation is below. Edit the javascript and press submit to control the spacecraft. An example script is there to show how the spacecraft can be controlled, but the example won't manage to land the probe.







Instructions

Your aim is to touch the ground at a speed of 6 m/s or preferably less.
To help you with that, you have the following: The thrusters will be necessary both for hitting the planet at the right angle, and slowing for the final descent.
Your task is to write a javascript program to control the lander. The important part is the timestep function, which takes as input the timestep length (dt), the sensors object, the output object and a state object.
The sensors object looks like this:
        var sensors = {
                pressure: pressure * factor,   // accuracy is limited at speed.
                radarLeft: radarLeft,          // accurate if heatshield released and low enough
                radarRight: radarRight,        // accurate if heatshield released and low enough
                angle: angle,             // inaccurate in atmo
                altitude: altitude,       // inaccurate in atmo
                velocityVertical: vv,     // inaccurate in atmo unless radar working
                velocityHorizontal: vh,   // inaccurate in atmo unless radar working
                acceleration: magnitude(acceleration) // accurate, scalar
        };
Angles are in radians. Velocities and acceleration are in m/s and m/s/s. Distances in m. Pressure in Pa.
The output object looks like this:
var output = {
                parachuteDeploy: false,
                parachuteCut: false,
                releaseHeatShield: false,
                retrosLeft: false,
                retrosRight: false,
                messages: []
};

The state object is persistent from timestep to timestep: If you create a field in it, the field will still be there next timestep.



© Hugo2015. Session @sessionNumber