Spacecraft body vector

All about writing scripts for Celestia in Lua and the .cel system
Topic author
mwjohnston
Posts: 6
Joined: 12.02.2010
With us: 14 years 9 months

Spacecraft body vector

Post #1by mwjohnston » 02.03.2010, 23:00

I have been using Celestia to visalize the attitude of an AFRL spacecraft (not yet launched) named DSX.
I successfully scripted in a ScriptedOrbit and ScriptedRotation.
Visually the attitudes look correct. The Spacecraft ADCS software generates vectors for Sun in the body frame and Earth in the body frame.
I would like to perform a more precise verification. (I am 3D geometry challenged.)

The main problem I am having is the ADCS software produces a quaternion that rotates the body frame and Celestia rotates the body.

How do I get the rotation (orientation?) for the space craft mesh in the space craft body frame?

Thanks

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

Re: Spacecraft body vector

Post #2by selden » 03.03.2010, 19:45

Body Frames in Celestia are defined relative to some previously declared body.

In other words, you probably could define an intermediate (invisible) body and define its orientation using the given quaternions.
Selden

Topic author
mwjohnston
Posts: 6
Joined: 12.02.2010
With us: 14 years 9 months

Re: Spacecraft body vector

Post #3by mwjohnston » 04.03.2010, 14:36

Thanks for replying Seldon,
I tried your suggestion.
It looks like the space craft is not following the invisible object's orientation.
Similar to
BodyFrame for ScriptedRotation

here is my .scc file:


"DSX_rt_shadow" "Sol/Earth"
{
# Class "invisible"
Class "spacecraft"
Mesh "dsx.cmod"
Radius 0.04
ScriptedRotation
{
Module "DSX_RT_scripts"
Function "rt_attitude"

DSXqw -0.013119672
DSXqx -0.5275975
DSXqy 0.849344615
DSXqz -0.009081684
}

ScriptedOrbit {
Module "DSX_RT_scripts"
Function "rt_pos"

DSXx 1761.798693
DSXy -5456.007139
DSXz 10947.38138
}

orbitframe { EquatorJ2000 { center "sol/earth" } }

bodyframe { EquatorJ2000 { center "sol/earth" } }
}

"DSX_rt" "Sol/Earth"
{
# Class "invisible"
Class "spacecraft"
Mesh "dsx.cmod"
Radius 0.04

ScriptedOrbit {
Module "DSX_RT_scripts"
Function "rt_pos"

DSXx 1761.798693
DSXy -5456.007139
DSXz 10947.38138
}

orbitframe { EquatorJ2000 { center "sol/earth" } }
Albedo 0.30

bodyframe { BodyFixed { Center "sol/earth/DSX_rt_shadow"} }
}



Thanks

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

Re: Spacecraft body vector

Post #4by selden » 04.03.2010, 21:33

Although your ssc looks to me like it ought to work, I'm wondering if there's a bug in Celestia which depends on how bodies are related.

You might try making "DSX_rt" a child of "DSX_rt_shadow". That is, include the name of the body being used as the reference in the "path" of the final body.

For example,

Code: Select all

"DSX_rt_shadow" "Sol/Earth" {...}
"DSX_rt" "Sol/Earth/DSX_rt_shadow" {...}


Does doing this make it rotate any differently?

Also, what version of Celestia are you using? 1.6.0 or one built from the current developmental source?
I'm wondering if this is a bug which has been fixed in the code that's on SourceForge.
Selden

Topic author
mwjohnston
Posts: 6
Joined: 12.02.2010
With us: 14 years 9 months

Re: Spacecraft body vector

Post #5by mwjohnston » 04.03.2010, 21:48

If I make the above change, the rotation is not affected.
The shadow moves about 13Km from the space craft.

I am using the official release. I can try the latest version soon.
I could also try to debug this if I knew what to look for.

Thanks

Topic author
mwjohnston
Posts: 6
Joined: 12.02.2010
With us: 14 years 9 months

Re: Spacecraft body vector

Post #6by mwjohnston » 04.03.2010, 22:10

To clarify. I am using 1.6.0

Topic author
mwjohnston
Posts: 6
Joined: 12.02.2010
With us: 14 years 9 months

Re: Spacecraft body vector

Post #7by mwjohnston » 04.03.2010, 22:59

I downloaded the latest code.
The dsx_rt attitude is not the same as dsx_rt_shadow.
They are now at the same center.

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

Re: Spacecraft body vector

Post #8by selden » 05.03.2010, 12:57

Unfortunately, I'm not a quaternions expert. Hopefully Chris will be able to help when he gets back.
Selden


Return to “Scripting”