Spaceship Paths

All about writing scripts for Celestia in Lua and the .cel system
Topic author
Dark Hunter1357
Posts: 9
Joined: 29.06.2008
With us: 16 years 7 months

Spaceship Paths

Post #1by Dark Hunter1357 » 29.06.2008, 21:51

Hello!
I'm new to celestia scripting and i have been searching for a guide to learn how to make a ship fly on a specific path.
So far, no luck...

Can you help me find such guides? And examples would help me even more then guides probably...

Tank you for taking your time reading this.

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 4 months
Location: NY, USA

Re: Spaceship Paths

Post #2by selden » 30.06.2008, 01:08

Dark Hunter1357,

One way to predefine a spacecraft's path is to use a trajectory file.
It's a file which contains the t,x,y,z coordinates of the spacecraft's flight path. SampledOrbit and SampledTrajectory declarations are described at
http://en.wikibooks.org/wiki/Celestia/T ... mpledOrbit

An example included with Celestia is the orbit path of the Cassini Saturn probe.

Celestia v1.6 adds the ability to use t,x,y,z,xv,yv,zv trajectories.

The JPL Horizons ephemeris service can create trajectory files for existing spacecraft. http://ssd.jpl.nasa.gov/?horizons

JAQAR's SWINGBY program can be used to create partial trajectories within the solar system. It doesn't compute takeoff and landing paths. http://www.jaqar.com/swingby.html

Both Horizons and SwingBy trajectory files do need to be edited slightly to be compatible with Celestia.


Does this help?
Selden

Topic author
Dark Hunter1357
Posts: 9
Joined: 29.06.2008
With us: 16 years 7 months

Re: Spaceship Paths

Post #3by Dark Hunter1357 » 30.06.2008, 08:48

I read the guide, but i still don't understand some of the things...

In the ssc, what do i type to add the xyz file?
And in the xyz file, whot is the meaning of every column ? I just can't find this basic information in the guide...

Code: Select all

1626080.5 -2005030086 3926697456 -1297200844
1626160.5 -1990637300 3914315212 -1291965931
1626240.5 -1976103346 3901677488 -1286645716
1626320.5 -1961428114 3888784762 -1281239527
1626400.5 -1946613748 3875634611 -1275746559
1626480.5 -1931658654 3862223506 -1270166148
1626560.5 -1916561919 3848551478 -1264497520
1626640.5 -1901325069 3834616567 -1258739813
1626720.5 -1885947673 3820416236 -1252892304
1626800.5 -1870430733 3805948751 -1246954114
1626880.5 -1854774406 3791209916 -1240924345
1626960.5 -1838976910 3776198081 -1234802188
1627040.5 -1823040312 3760912118 -1228586649
1627120.5 -1806965886 3745346949 -1222276785
1627200.5 -1790752347 3729499169 -1215871696
1627280.5 -1774400463 3713365852 -1209370292
1627360.5 -1757909946 3696942638 -1202771576
1627440.5 -1741280956 3680226943 -1196074528

This is one of the examples i found in celestia. What does every column stands for ?

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 4 months
Location: NY, USA

Re: Spaceship Paths

Post #4by selden » 30.06.2008, 11:20

The columns of xyz files are described in the WikiBook at the link that I provided above:
wikibook wrote:Each set of numbers consists of a TDB Julian date followed by x, y and z positions measured in kilometers.

The positions are in the coordinate system that is specified in the object's SSC declaration, the same declaration which invokes the trajectory file.
Selden

Topic author
Dark Hunter1357
Posts: 9
Joined: 29.06.2008
With us: 16 years 7 months

Re: Spaceship Paths

Post #5by Dark Hunter1357 » 30.06.2008, 15:54

I'm sorry then... I didn't know they were talking about these numbers.

I can't understand however, if x = 0; y = 0; z = 1, will this be set to above the sun, or above the earth, or above the moon/sun/planet of which the spaceship is orbiting ?

In other words, were is the 0 in this coordinate system ?

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 4 months
Location: NY, USA

Re: Spaceship Paths

Post #6by selden » 30.06.2008, 16:10

Dark Hunter1357 wrote:I'm sorry then... I didn't know they were talking about these numbers.

I can't understand however, if x = 0; y = 0; z = 1, will this be set to above the sun, or above the earth, or above the moon/sun/planet of which the spaceship is orbiting ?

In other words, were is the 0 in this coordinate system ?

Please reread the WikiBook section. All of the details are there.
wikibook wrote:They are positions within the coordinate system associated with the object. By default, for example, the SampledOrbit for a spaceprobe orbiting the Sun would contain heliocentric Ecliptic J2000 coordinates.

For example, here's what's in spacecraft.ssc for Cassini:

Code: Select all

"Cassini" "Sol"
{
   Class "spacecraft"
   Mesh "cassini.3ds"
   Radius 0.011

   InfoURL "http://saturn.jpl.nasa.gov/home/index.cfm"

   Beginning 2450736.893877314 # 1997 Oct 15 09:27:11

   SampledOrbit   "cassini.xyz"

   FixedRotation { }
}

Since Cassini is defined relative to the Sun,

Code: Select all

"Cassini" "Sol"

The xyz coordinates in the trajectory file are relative to the center of the Sun.
Selden

Topic author
Dark Hunter1357
Posts: 9
Joined: 29.06.2008
With us: 16 years 7 months

Re: Spaceship Paths

Post #7by Dark Hunter1357 » 30.06.2008, 21:16

Tank you now i understand it... And i'm sorry but when i read that in the wiki guide it said: [quote=wikibook]coordinate system associated with the object[/quote]
Which object ??


Is there anyway of finding out what are the x,y,z position of an object associated whit the object my spaceship is orbiting ?

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 4 months
Location: NY, USA

Re: Spaceship Paths

Post #8by selden » 30.06.2008, 22:01

Dark Hunter1357 wrote:Tank you now i understand it... And i'm sorry but when i read that in the wiki guide it said:
wikibook wrote:coordinate system associated with the object
Which object ??
The object for which you want to specify an xyz trajectory.

When you define any object in an SSC file for Celestia, you have to specify the coordinate system that you're using to specify its position or orbit. If you don't specify a coordinate system, Celestia assumes Equatorial J2000 centered on the parent object if the parent is a planet or moon,. Ecliptic J2000 if the parent object is the Sun. Celestia v1.5.1 lets you specify any of a multitude of coordinate systems. You need to read Celestia's documentation very carefully to learn about them all.

If you want your spaceship only to travel around one planet, then you should use a coordinate system centered on that planet.
If you want your spaceship to travel between planets, then you should use a coordinate system centered either on the Sun or on the Solar System Barycenter.

Is there anyway of finding out what are the x,y,z position of an object associated whit the object my spaceship is orbiting ?

Yes.

If it's an imaginary planet that you created yourself, you'll have to write a Lua (CELX) script and call the function getposition. (Ask for help in the scripting Forum if you need it.)

If it's a real planet in our solar system, you can either use a CelX script or you can ask the JPL Horizons ephemeris server.

But, again, you also need to specify which coordinate system the xyz position should be provided in:
one centered on the Sun, one centered on the Solar System Barycenter, one centered on the planet, etc.

The Ecliptic J2000 coordinate system centered on the Solar System Barycenter probably would be the easiest to use in Celestia . It's often called the "universal coordinate system" in Celestia's documentation.
Selden

Topic author
Dark Hunter1357
Posts: 9
Joined: 29.06.2008
With us: 16 years 7 months

Re: Spaceship Paths

Post #9by Dark Hunter1357 » 30.06.2008, 23:08

I don't think that i need to start a new thread about the Lau (CELX) script.
May i ask you about it please ?

I know how to make the celx file, just tell me what to type in it.

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 4 months
Location: NY, USA

Re: Spaceship Paths

Post #10by selden » 01.07.2008, 00:24

I'll have to leave it to one of the CelX experts to help with that part.
Selden


Return to “Scripting”