## Testing Attitude Paramenters

Conversations pertaining to the testing of GMAT

### Testing Attitude Paramenters

1) Spacecraft Attitude Parameters

Test input/output in Quaternian, Euler Angles( 1-2-1, 3-2-1, .... 12 orientations), and Direction Cosine Matrices
Test Attitude rate with angular velocity, Euler angle rates Input/Output

2) Test model selection

Test spacecraft modeled as spin stabilized with various moments of inertia
Test attitude in local frames such as MJ2000, VNB, LVLH, and User defined
JTichy

Posts: 26
Joined: Tue May 12, 2009 9:02 pm

### Re: Testing Attitude Paramenters

I am a new user of GMAT and a relatively newly-retired engineer; I would really welcome an opportunity to support GMAT development, and I think my best place to do so is in the testing area. In the 30+ years of my career, I have always been either blessed or cursed, depending on your perspective, with the ability to use software in ways that cause it not to behave as its developers intended!

Is there some reference material available on how formal testing is to be done and reported?

At the moment, I have found a very perplexing behavior in the Quaternion parameter. Although the Quaternion seems to work fine in Report files, I don't seem to be able to use either the entire 4-element Quaternion or any of its elements on the RHS of an assignment statement (aka Equation). Here is an illustration:

Code snippet begins:

%----------------------------------------
%---------- Variables
%----------------------------------------
Create Array QuatTest1x4[1,4] QuatTest4x1[4,1] QuatTest4[4];
Create Variable QuatTestElement1 Q1Test;

%----------------------------------------
%---------- Mission Sequence
%----------------------------------------

BeginMissionSequence;
% This works:
GMAT Q1Test = DefaultSC.Q1;

% Uncomment the next three GMAT lines to see the error concerning
% using xxx.Quaternion on RHS of equation
% GMAT QuatTest1x4 = DefaultSC.Quaternion;
% GMAT QuatTest4x1 = DefaultSC.Quaternion;
% GMAT QuatTest4 = DefaultSC.Quaternion;

% Uncomment the next GMAT line to see the error concerning
% using xxx.Quaternion(Index) on RHS of equation
%GMAT QuatTestElement1 = DefaultSC.Quaternion(1);

Propagate DefaultProp(DefaultSC) {DefaultSC.ElapsedSecs = 12000.0};

Code snippet ends.

If I try to use DefaultSC.Quaternion on the RHS, I get:
1: **** ERROR **** Interpreter Exception:
The command "QuatTest1x4 = DefaultSC.Quaternion;" failed validation. Types of left and right of the equal sign are not compatible.
The command "QuatTest4x1 = DefaultSC.Quaternion;" failed validation. Types of left and right of the equal sign are not compatible.
The command "QuatTest4 = DefaultSC.Quaternion;" failed validation. Types of left and right of the equal sign are not compatible.

If I try to use DefaultSC.Quaternion(1) on the RHS, I get:
1: **** ERROR **** Interpreter Exception: "DefaultSC.Quaternion" is not an Array in line:
" 174: GMAT QuatTestElement1 = DefaultSC.Quaternion(1);"

2: **** ERROR **** Interpreter Exception: Undefined function, object, or disallowed object field "DefaultSC.Quaternion(1)" found in line:
" 174: GMAT QuatTestElement1 = DefaultSC.Quaternion(1);"

I've tried looking through the C++ code to see if I could figure out if I am simply using the variable in a way in which it is not intended, but everywhere I find Quaternion defined, it appears to be an Rvector, and I assume that means that I can assign it to another 4-element Array, or that I can at least assign an element of it to a Variable. What really seems peculiar is that ReportFile handles it without any problem at all.

I hope this actually contributes to GMAT development in some way, and that I'm not just making some dumb mistake in understanding how it is to be used. And I do hope I can find an opportunity to contribute to GMAT's further development.
drdanguitr

Posts: 11
Joined: Thu Mar 28, 2013 8:04 pm

### Re: Testing Attitude Paramenters

Hi drdanguitr, thanks for the post.

Regarding your bigger question about testing, we could always use more testing! I think we would all be really appreciative if you wanted to dig around a bit and test different parts, and provided bug reports and the like.

We have a pretty robust test process we use, but unfortunately it's mostly stored on an internal server due to size limitations (there's a lot of data). But, you can see enough that you can get an idea of what we're doing. Using attitude as an example, we have a development spec we've written to describe how the feature works. At the bottom of that document is a section called Test Procedures that has some tables of tests we've written. The tests themselves are implemented as GMAT scripts that are run every night against that day's code and compared to truth data. See the Script Testing wiki page for some details on how this works. That page is not entirely up to date, but it gives an idea. Test reports are sent to the gmat-buildtest mailing list.

We also have a separate system that tests GUI interactions; that one is also stored internally, and I don't have a lot of data about it. It tries to test the Windows GUI pretty thoroughly, and it seems to do a pretty good job.

When we find an issue, we check it into our bug tracker as a bug or a feature request. With these two methods combined, we're pretty confident that we've fixed most of the bigger issues, and that we know about a good percentage of the others, even if we haven't fixed them yet.

What we really need are beta testers; folks who try to use GMAT to model actual missions and scenarios and report back their issues. However you'd like to contribute, I'd start by following some of the GMAT tutorials, and if you find things, check them into our bug tracker (searching first of course to make sure they're not already there!).
Joel J. K. Parker
Flight dynamics engineer, GMAT team
http://gmatcentral.org
jjkparker

Posts: 617
Joined: Thu Jan 07, 2010 9:48 pm
Location: NASA Goddard Space Flight Center, Greenbelt, MD

### Re: Testing Attitude Paramenters

It looks to me like you found a legitimate bug (and a gap in all that testing). Can you pare the script down a bit and attach it to a new bug in our bug tracker? You'll have to create an account there, but it's free and you can do it yourself.
Joel J. K. Parker
Flight dynamics engineer, GMAT team
http://gmatcentral.org
jjkparker

Posts: 617
Joined: Thu Jan 07, 2010 9:48 pm
Location: NASA Goddard Space Flight Center, Greenbelt, MD

### Re: Testing Attitude Paramenters

Thank you, jjkparker,

I've submitted one bug report, with more to follow as soon as I convince myself they are real bugs and not errors on my part.

I am looking at some launch/ascent trajectories, both from Earth and from the Moon, and from early results, it looks like it may be a fertile field for beta testing. I have not yet found posts from anyone else doing launch/ascent, so I may be exercising things in some untested ways.

Apologies if I submit some "bugs" that turn out to be user errors; I will try to avoid that but I am still coming up the learning curve.
drdanguitr

Posts: 11
Joined: Thu Mar 28, 2013 8:04 pm

### Re: Testing Attitude Paramenters

No problem; thank you for taking the time to help us out.

We are starting an effort next week to work on launch modeling; I would be very interested to hear what you're looking for in that area.
Joel J. K. Parker
Flight dynamics engineer, GMAT team
http://gmatcentral.org
jjkparker

Posts: 617
Joined: Thu Jan 07, 2010 9:48 pm
Location: NASA Goddard Space Flight Center, Greenbelt, MD

### Re: Testing Attitude Paramenters

I was going to take it in baby steps:
1. First phase
Launch from the Moon so I didn't need to worry about atmosphere, and could easily achieve SSTO; Just focus on getting the gravity turn to work, then focus on an algorithm to target a given orbit state by adjusting burn time, gravity turn timing/initial pitch rate, thrust level, etc. Play with that whole thing for a while to see what it was sensitive to and what it wasn't. Probably, for starters, even turn off the fuel depletion option on the finite burn so that would be one less thing to worry about.

2. Second Phase
Stay with the Moon, but increase the realism (for example, use fuel depletion plus realistic masses and Isp/thrust values(e. g. Lunar Module)) and see if I can approximately reproduce an Apollo lunar launch/ascent. (Or a Surveyor descent: same math, different sign for the velocity!)

3. Beyond Phase 2
Then I would have to decide which thing I wanted to add in next: atmosphere or staging. Right now, I think I would probably stay with a Lunar launch until I got the hang of multistage operations. Then as the last step, I'd start working with launches from Earth that would have the whole enchilada: drag, staging, throttleable engines, Isp changes with altitude, etc.

That's just the strawman I've got in my head, and it allows me time to educate myself better on launch/ascent control algorithms. What was your planned approach?

I just realized that after this post I need to start a new topic, it's getting beyond attitude parameters.
drdanguitr

Posts: 11
Joined: Thu Mar 28, 2013 8:04 pm

### Re: Testing Attitude Paramenters

Hi, thanks for the response.

Right now, our launch modeling needs are pretty simple: we're planning to add a simple curve-fit launch model that simply models a cubic or quartic curve from the launch site to the burnout location.

Note that actual physical modeling of the ascent is something we're not really planning to dive into; that could get very complicated, and it's not really our focus area. But, if you have any ideas or interests here, we're happy to discuss!
Joel J. K. Parker
Flight dynamics engineer, GMAT team
http://gmatcentral.org
jjkparker

Posts: 617
Joined: Thu Jan 07, 2010 9:48 pm
Location: NASA Goddard Space Flight Center, Greenbelt, MD

### Re: Testing Attitude Paramenters

Filed two bug reports on 17 May: GMT-3944 and GMT-3945. Sorry, I should have posted that information on this thread.
drdanguitr

Posts: 11
Joined: Thu Mar 28, 2013 8:04 pm

### Re: Testing Attitude Paramenters

Sorry drdanguitr, that was a spam post earlier; I've since deleted it. Sorry for the inconvenience.
Joel J. K. Parker
Flight dynamics engineer, GMAT team
http://gmatcentral.org
jjkparker

Posts: 617
Joined: Thu Jan 07, 2010 9:48 pm
Location: NASA Goddard Space Flight Center, Greenbelt, MD

Next