Anatomy of an Add-on: Buran
Posted: 23.02.2008, 23:41
This topic is a discussion about best practices for creating complex add-ons using some of the constructs coming in the next version of Celestia: Timelines, the Clickable and Visible properties, and the new component and surfacefeature object types. I'll be using the Flight of Buran add-on from Runar, Christophe, and Andrea as an example. By re-working this add-on, I in no way mean to criticize the original work. There are new features coming in Celestia that make it complex add-on creation much more straightforward that before, and a lot of the tricks that used to be required for putting objects in the right place are no longer necessary.
I'll start by describing the overall structure of the Buran mission. For simplicity, I'm going to consider just a few of the components:
- the Launch platform
- the Buran spacecraft
- the Energia rocket
- four Zenit boosters
Let's first consider Buran itself. Initially, it is on the surface of the Earth; it then lifts off from the launch pad, goes around the Earth twice, then reenters the atmosphere to land on a runway. If Buran remained on the ground the entire time, we could define it in the ssc file like this:
(I'm omitting values for the position and rotation right now to just focus on the structure of the add-on.)
The key thing in this SSC definition is that Buran is in the body fixed frame of Earth. Giving it a fixed position and orientation means that Buran will not appear relative to the surface of the Earth. BodyFixed is the appropriate reference frame to use for objects on the surface of a planet.
Once Buran lifts off from the surface, we'll use a SampledTrajectory (xyz file) for it's motion. A crucial question to ask now is what reference frame are the xyz file coordinates in? There are three reasonable choices:
- Earth-centered
- Earth-fixed
- Earth-fixed, centered on the launch site
The Earth-centered coordinate system has the same origin as the Earth-fixed system--the center of the Earth--but it doesn't rotate with the Earth. If you're working with an actual mission trajectory or simulator output, your choice of reference frame will depend on the data. With Buran, we have a bit more latitude, since we're working with a trajectory that has been hand reconstructed. If Buran was bound for the Moon, the choice would be obvious: Earth-centered, since the trajectory is essentially decoupled from the rotation of the Earth. On the other hand, if Buran remained in Earth's atmosphere, the rotating Earth-fixed frame would make more sense. Now, It looks like the xyz file that comes with the Buran add-on is in an Earth-fixed frame, but we'll going to break the trajectory into multiple phases so that we've got the flexibility to change the reference frame of the flight phase:
So that's Buran . . . We still need to fill in values for the FixedPosition and FixedRotation, but we'll get to that later. The important thing is that we have the skeleton for the mission. Unlike in 1.5.0, there are no unnamed or invisible objects required: the same Buran object is used throughout the mission.
On to Part 2: Energia and Boosters . . .
--Chris
I'll start by describing the overall structure of the Buran mission. For simplicity, I'm going to consider just a few of the components:
- the Launch platform
- the Buran spacecraft
- the Energia rocket
- four Zenit boosters
Let's first consider Buran itself. Initially, it is on the surface of the Earth; it then lifts off from the launch pad, goes around the Earth twice, then reenters the atmosphere to land on a runway. If Buran remained on the ground the entire time, we could define it in the ssc file like this:
Code: Select all
"Buran" "Sol/Earth"
{
Class "spacecraft"
Mesh "th_buran.cmod"
Radius 0.058765
OrbitFrame { BodyFixed { Center "Sol/Earth" } }
BodyFrame { BodyFixed { Center "Sol/Earth" } }
FixedPosition [ ... ]
FixedRotation { ... }
}
(I'm omitting values for the position and rotation right now to just focus on the structure of the add-on.)
The key thing in this SSC definition is that Buran is in the body fixed frame of Earth. Giving it a fixed position and orientation means that Buran will not appear relative to the surface of the Earth. BodyFixed is the appropriate reference frame to use for objects on the surface of a planet.
Once Buran lifts off from the surface, we'll use a SampledTrajectory (xyz file) for it's motion. A crucial question to ask now is what reference frame are the xyz file coordinates in? There are three reasonable choices:
- Earth-centered
- Earth-fixed
- Earth-fixed, centered on the launch site
The Earth-centered coordinate system has the same origin as the Earth-fixed system--the center of the Earth--but it doesn't rotate with the Earth. If you're working with an actual mission trajectory or simulator output, your choice of reference frame will depend on the data. With Buran, we have a bit more latitude, since we're working with a trajectory that has been hand reconstructed. If Buran was bound for the Moon, the choice would be obvious: Earth-centered, since the trajectory is essentially decoupled from the rotation of the Earth. On the other hand, if Buran remained in Earth's atmosphere, the rotating Earth-fixed frame would make more sense. Now, It looks like the xyz file that comes with the Buran add-on is in an Earth-fixed frame, but we'll going to break the trajectory into multiple phases so that we've got the flexibility to change the reference frame of the flight phase:
Code: Select all
"Buran" "Sol/Earth"
{
Class "spacecraft"
Mesh "th_buran.cmod"
Radius 0.058765
Timeline [
# Phase 1: on the launch platform
{
Beginning 2447457.5 # 23 Oct 1988, on launch platform
Ending 2447480.62566 # 15 Nov 1988 03:00 GMT, liftoff
OrbitFrame { BodyFixed { Center "Sol/Earth" } }
BodyFrame { BodyFixed { Center "Sol/Earth" } }
FixedPosition [ ... ]
FixedRotation { ... }
}
# Phase 2: lift off, orbit, reentry
{
Ending 2447480.76802 # 15 Nov 1988 06:25:00, touchdown in Baikonur
OrbitFrame { BodyFixed { Center "Sol/Earth" } }
BodyFrame { BodyFixed { Center "Sol/Earth" } }
SampledTrajectory { Source "th_buran.xyz" }
SampledOrientation "th_buran.q"
}
# Phase 3: back on the ground
{
OrbitFrame { BodyFixed { Center "Sol/Earth" } }
BodyFrame { BodyFixed { Center "Sol/Earth" } }
FixedPosition [ ... ]
FixedRotation { ... }
}
] # end timeline
}
So that's Buran . . . We still need to fill in values for the FixedPosition and FixedRotation, but we'll get to that later. The important thing is that we have the skeleton for the mission. Unlike in 1.5.0, there are no unnamed or invisible objects required: the same Buran object is used throughout the mission.
On to Part 2: Energia and Boosters . . .
--Chris