Tuesday, September 30, 2008

Autopilot: the beginning

I've delayed and delayed it.. pheraps due to some fear :) but now it's the moment to become brave and fight the monster!
I'm talking about the autopilot, pheraps one of the biggest problem to solve. Space are immense, planets and other objects are far away, they move into their orbits, so is VERY difficult travelling from outer space to an object, especially when the inertial phisic is activated. Imagine: the earth is a million km away, so you need a very big speed to reach it in reasonable time. To reach the travelling speed you need an acceleration, and it's impossible to use too much big acceleration otherwise your body will be destroyed. It means that you need a lot of time to reach the speed... and you cannot decelerate only when you're near earth.. for the same reason: you cannot decelerate too fast. So you need time also for deceleration, and you've to begin the deceleration phase when you're still away from earth.
Now try to imagine that the earth is moving around sun: you need to update always your direction if you want to reach our planet.
So it's near impossible to do it manually. You need a computer help, aka the autopilot.
There are very difficult to realize it, i'll try to list the most important:

- An autopilot cannot compute the route before the travel.. there are a lot of variable that can change during the travel, so it should work in real time and react to all the new condition that could happens. For example: a ship appears in front of us, the autopilot has to recompute new route to avoid it.
- Our autopilot should be consider the time compression. If the time is running 1000 faster, the reaction time of the autopilot should be also 1000 time faster.
- If you want to reach an object you've to consider that that object moves also into the space. Now it's at (100,100,100), a minute after it could be at (200,40,-6). So you cannot simply compute a segment from our position to actually target position: the route should be updated every second.
- Planets, Stars, stations, and so on, are solid, and you cannot pass through them. If i'm in A position, and want to reach the B position, and between A and B there is a big giant star, we need to compute a more complex route A-->point C outside star--> B

Ok, i've begin this BIG work.. for now i think that a route is composed from a set of segment joined toghether to build a complex path. So we start with a simplex sub-problem: move your ship from a fixed point A to another fixed point B without obstacles in the middle. For now we assume that our ship is stopped.
The first thing to do is to locate the B point (the destination) and rotate the ship until B is in front of us. Then we start engine and begin our travel.
In the next movie you can see this first step: there's a station into the space and we want to reach it. The autopilot rotate the ship until the nose is aligned to the point. I'ts not easy because the ship could be rotated around all the tree axis... but it works!

---

L'ho rimandato a lungo, probabilmente perche' in fondo avevo paura :) ma ora e' giunto il momento di essere coraggiosi ed affrontare il mostro!
Sto parlando dell'autopilota, uno dei problemi probabilmente piu' grossi da risolvere. Lo spazio e' immenso, i pianeti e gli altri oggetti sono molto distanti, e si muovono lungo le loro orbite, cosi' e' davvero MOLTO difficile viaggiare dallo spazio profondo fino alle prossimita' di un oggetto, specialmente se si considera la fisica inerziale. Provate ad immaginare: la terra a milioni di kilometri di distanza, avete senz'altro bisogno di una gran velocita' per raggiungerla in un tempo ragionevole. Per raggiungere una simile velocita' vi serve un'accelerazione, che non puo' essere eccessiva (altrimenti il pilota finisce spiaccicato al pavimento), e pertanto deve durare a lungo. E non potete decelerare solo quando sarete quasi arrivati, perche' per lo stesso motivo anche la decelerazione non puo' essere eccessiva, e quindi deve iniziare molto prima dell'arrivo. Non solo: durante il viaggio la terra non resta ferma ma orbita attorno al sole, pertanto la rotta va costantemente aggiornata se la vogliamo raggiungere.
Morale: navigare manualmente e' pressoche' impossibile, cosi' e' necessario ricorrere all'aiuto di un autopilota.
Un autopilota e' molto difficile da realizzare, cerchero' di elencarne i motivi principali.
- Un autopilota non puo' calcolare la rotta prima di partire, ci sono troppe variabili che possono cambiare durante il viaggio, pertanto deve eseguire i propri calcoli in tempo reale in modo da reagire prontamente a qualche nuova situazione. Ad esempio: un'astronave appare all'improvviso davanti a voi, l'autopilota deve reagire e cambiare prontamente la rotta per evitare la collisione
- Il nostro autopilota deve anche tener conto della compressione del tempo. Se il tempo va 1000 volte piu' veloce del normale, l'autopilota deve reagire 1000 volte piu' velocemente
- Se si vuole raggiungere un oggetto bisogna tener conto che questi si muove nel frattempo. Ora potrebbe essere nel punto (100,100,100), tra un minuto potrebbe essere nel punto (200,40,-6). Non possiamo percio' semplicemente calcolare il segmento che congiunge noi con la posizione dell'oggetto in questo istante: la rotta va invece aggiornata continuamente.
- I pianeti, le stelle, le stazione sono solide, e non ci passiamo passare attraverso. Se mi trovo nella posizione A, e voglio raggiungere il punto B, e in mezzo vi e' una stella gigante, dobbiamo dividere il viaggio in due tronconi, da A a un punto C fuori dalla stella, e da C a B.

Ad ogni modo ho iniziato questo grosso lavoro. Credo che riusciro' a domare questo grosso impegno solo suddividendoli in problemi piu' piccoli, pertanto per ora ho deciso di risolvere un problema piu' semplice: muovere l'astronave da un punto A ad un punto B, fermo, assumendo che l'astronave sia ferma al momento della partenza. Una rotta piu' complessa potra' quindi essere suddivisa in tante piccole rotte lineari che unite tra loro formeranno il percorso totale (avete presente il gioco della settimana enigmistica "unisci i numeri dall'1 al 50"? ecco).
Per poter raggiungere il punto B bisogna compiere due fasi, la prima che consiste nel ruotare l'astronave fino a quando il nostro "naso" punta esattamente in direzione di B, dopodiche' accelerare, viaggiare, ed iniziare la frenata per tempo.
Con oggi ho completato la prima delle due fasi: attivando l'autopilota, indipentemente dall'ortientamento della nostra nave, questa iniziera' a ruotare fino a quando avremo di fronte la nostra destinazione. Nel filmato che segue ho usato una stazione spaziale come destinazione. E potete notare che per quanto il nostro orientamento possa essere confuso, alla fine punteremo sempre verso l'obiettivo.
Non e' stato facile, l'astronave puo' ruotare lungo tre assi... ma pare funzionare!

4 comments:

Utnapishtim said...

il problema che stai affrontando è roba mica da ridere, e se vuoi curare il realismo fino in fondo temo che non ne uscirai vivo.
Esempio, in un viaggio dal sole a Tau Ceti, viaggio di 10 anni luce (circa), metti di accelerare ad 1g per metà del tempo e poi freni ad 1g fino a destinazione.
In un universo newtoniano a metà strada (circa dopo 3 anni) raggiungeresti una velocità pari a 1,62 volte quella della luce. Come intendi gestire la cosa?

PdG said...

non e' cosa da ridere no!
mi vengono gli attacchi di panico solo a pensarci.
Chiaramente dovro' concedere delle semplificazioni al modello fisico e qualche strappo alla credibilita'.
Ad ogni modo per il problema della velocita' della luce credo che utilizzero' le scappatoie di frontier: la possibolita' di accelerare il tempo anche di 1000 o piu' volte quando si viaggia all'interno di un sistema solare, ed il banale "iperspazio" per spostarsi da una stella all'altra.

Utnapishtim said...
This comment has been removed by the author.
Utnapishtim said...

Ho rimosso il vecchio commento che evidentemente ho scritto in stato allucinatorio :-)