Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions .vscode/.ropeproject/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# The default ``config.py``
# flake8: noqa


def set_prefs(prefs):
"""This function is called before opening the project"""

# Specify which files and folders to ignore in the project.
# Changes to ignored resources are not added to the history and
# VCSs. Also they are not returned in `Project.get_files()`.
# Note that ``?`` and ``*`` match all characters but slashes.
# '*.pyc': matches 'test.pyc' and 'pkg/test.pyc'
# 'mod*.pyc': matches 'test/mod1.pyc' but not 'mod/1.pyc'
# '.svn': matches 'pkg/.svn' and all of its children
# 'build/*.o': matches 'build/lib.o' but not 'build/sub/lib.o'
# 'build//*.o': matches 'build/lib.o' and 'build/sub/lib.o'
prefs['ignored_resources'] = ['*.pyc', '*~', '.ropeproject',
'.hg', '.svn', '_svn', '.git', '.tox']

# Specifies which files should be considered python files. It is
# useful when you have scripts inside your project. Only files
# ending with ``.py`` are considered to be python files by
# default.
# prefs['python_files'] = ['*.py']

# Custom source folders: By default rope searches the project
# for finding source folders (folders that should be searched
# for finding modules). You can add paths to that list. Note
# that rope guesses project source folders correctly most of the
# time; use this if you have any problems.
# The folders should be relative to project root and use '/' for
# separating folders regardless of the platform rope is running on.
# 'src/my_source_folder' for instance.
# prefs.add('source_folders', 'src')

# You can extend python path for looking up modules
# prefs.add('python_path', '~/python/')

# Should rope save object information or not.
prefs['save_objectdb'] = True
prefs['compress_objectdb'] = False

# If `True`, rope analyzes each module when it is being saved.
prefs['automatic_soa'] = True
# The depth of calls to follow in static object analysis
prefs['soa_followed_calls'] = 0

# If `False` when running modules or unit tests "dynamic object
# analysis" is turned off. This makes them much faster.
prefs['perform_doa'] = True

# Rope can check the validity of its object DB when running.
prefs['validate_objectdb'] = True

# How many undos to hold?
prefs['max_history_items'] = 32

# Shows whether to save history across sessions.
prefs['save_history'] = True
prefs['compress_history'] = False

# Set the number spaces used for indenting. According to
# :PEP:`8`, it is best to use 4 spaces. Since most of rope's
# unit-tests use 4 spaces it is more reliable, too.
prefs['indent_size'] = 4

# Builtin and c-extension modules that are allowed to be imported
# and inspected by rope.
prefs['extension_modules'] = []

# Add all standard c-extensions to extension_modules list.
prefs['import_dynload_stdmods'] = True

# If `True` modules with syntax errors are considered to be empty.
# The default value is `False`; When `False` syntax errors raise
# `rope.base.exceptions.ModuleSyntaxError` exception.
prefs['ignore_syntax_errors'] = False

# If `True`, rope ignores unresolvable imports. Otherwise, they
# appear in the importing namespace.
prefs['ignore_bad_imports'] = False

# If `True`, rope will insert new module imports as
# `from <package> import <module>` by default.
prefs['prefer_module_from_imports'] = False

# If `True`, rope will transform a comma list of imports into
# multiple separate import statements when organizing
# imports.
prefs['split_imports'] = False

# If `True`, rope will remove all top-level import statements and
# reinsert them at the top of the module when making changes.
prefs['pull_imports_to_top'] = True

# If `True`, rope will sort imports alphabetically by module name instead
# of alphabetically by import statement, with from imports after normal
# imports.
prefs['sort_imports_alphabetically'] = False

# Location of implementation of
# rope.base.oi.type_hinting.interfaces.ITypeHintingFactory In general
# case, you don't have to change this value, unless you're an rope expert.
# Change this value to inject you own implementations of interfaces
# listed in module rope.base.oi.type_hinting.providers.interfaces
# For example, you can add you own providers for Django Models, or disable
# the search type-hinting in a class hierarchy, etc.
prefs['type_hinting_factory'] = (
'rope.base.oi.type_hinting.factory.default_type_hinting_factory')


def project_opened(project):
"""This function is called after opening the project"""
# Do whatever you like here!
Binary file added .vscode/.ropeproject/objectdb
Binary file not shown.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": "C:\\Users\\jthompson\\AppData\\Local\\Continuum\\anaconda3\\python.exe"
}
3 changes: 3 additions & 0 deletions StkAutomation/Matlab/STK Astrogator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# STK Astrogator Object Model

These scripts walk though the [STK Astrogator](https://help.agi.com/stk/index.htm#astrogator.htm) object model.
105 changes: 105 additions & 0 deletions StkAutomation/Matlab/STK Astrogator/slewToManeuvers.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
%% slewToManeuvers
% When an Astrogator satellite maneuvers by default the manuever will adjust
% the attitude to align with the thrust direction, but it will not slew.
% This script allows the satellite to slew into and out of the maneuver.
% Inputs

% Which Satellite
satName = 'Satellite1';

% Where to point when thrusting
onScheduleAlignedVector = ['Satellite/',satName,' TotalThrust'];
onScheduleConstrainedVector = ['CentralBody/Earth EclipticNormal'];
bodyDirAligned = [0,0,1]; % [x,y,z] components for the body aligned vector

% Where to point when not thrusting
offScheduleAlignedVector = ['Satellite/',satName,' Nadir(Detic)'];
offScheduleConstrainedVector = ['Satellite/',satName,' Sun'];
bodyDirConstrained = [1,0,0]; % [x,y,z] components for the body constrained vector

% Slew options
slewDur = 60; % [s]

% Minimum thrust threshold. (Don't enter 0 or else numerical issues may cause problems)
thrustingThreshold = 0.000001; % [N]

%% Code

% Connect to the satellite
app = actxGetRunningServer('STK11.Application');
root = app.Personality2;
sc = root.CurrentScenario;
sat = root.GetObjectFromPath(['Satellite/',satName]);

% Create the thrust calc scalar
cs = sat.Vgt.CalcScalars;
if cs.Contains('Thrust')
thrustcs = cs.Item('Thrust');
else
thrustcs = cs.Factory.Create('Thrust','Thrust Mag','eCrdnCalcScalarTypeVectorMagnitude');
end
thrustcs.InputVector = sat.Vgt.Vectors.Item('TotalThrust');

% Create the thrusting condition
con = sat.Vgt.Conditions;
if con.Contains('Thrusting')
thrustcon = con.Item('Thrusting');
else
thrustcon = con.Factory.Create('Thrusting','Is Thrusting?','eCrdnConditionTypeScalarBounds');
end
thrustcon.Scalar = sat.Vgt.CalcScalars.Item('Thrust');
quantity = root.ConversionUtility.NewQuantity('Force','N',thrustingThreshold);
thrustcon.SetMinimum(quantity);

% Create the pointing vectors
vec = sat.Vgt.Vectors;
if ~vec.Contains('AlignedDir')
cmd = ['VectorTool * Satellite/',satName,' Create Vector AlignedDir "Scheduled"'];
root.ExecuteCommand(cmd);
end
cmd = ['VectorTool * Satellite/',satName,' Modify Vector AlignedDir "Scheduled" Schedule "Satellite/',satName,' Thrusting.SatisfactionIntervals Interval List"'];
root.ExecuteCommand(cmd);
cmd = ['VectorTool * Satellite/',satName,' Modify Vector AlignedDir "Scheduled" OnSchedule "',onScheduleAlignedVector,'"'];
root.ExecuteCommand(cmd);
cmd = ['VectorTool * Satellite/',satName,' Modify Vector AlignedDir "Scheduled" OffSchedule "',offScheduleAlignedVector,'"'];
root.ExecuteCommand(cmd);
cmd = ['VectorTool * Satellite/',satName,' Modify Vector AlignedDir "Scheduled" SlewWindowDuration ',num2str(slewDur)];
root.ExecuteCommand(cmd);
cmd = ['VectorTool * Satellite/',satName,' Modify Vector AlignedDir "Scheduled" SlewTiming FavorOffSchedule'];
root.ExecuteCommand(cmd);

if ~vec.Contains('ConstrainedDir')
cmd = ['VectorTool * Satellite/',satName,' Create Vector ConstrainedDir "Scheduled"'];
root.ExecuteCommand(cmd);
end
cmd = ['VectorTool * Satellite/',satName,' Modify Vector ConstrainedDir "Scheduled" Schedule "Satellite/',satName,' Thrusting.SatisfactionIntervals Interval List"'];
root.ExecuteCommand(cmd);
cmd = ['VectorTool * Satellite/',satName,' Modify Vector ConstrainedDir "Scheduled" OnSchedule "',onScheduleConstrainedVector,'"'];
root.ExecuteCommand(cmd);
cmd = ['VectorTool * Satellite/',satName,' Modify Vector ConstrainedDir "Scheduled" OffSchedule "',offScheduleConstrainedVector,'"'];
root.ExecuteCommand(cmd);
cmd = ['VectorTool * Satellite/',satName,' Modify Vector ConstrainedDir "Scheduled" SlewWindowDuration ',num2str(slewDur)];
root.ExecuteCommand(cmd);
cmd = ['VectorTool * Satellite/',satName,' Modify Vector ConstrainedDir "Scheduled" SlewTiming FavorOffSchedule'];
root.ExecuteCommand(cmd);

% Set attitude
sat.Attitude.Basic.SetProfileType('eProfileAlignedAndConstrained');
sat.Attitude.Basic.Profile.AlignedVector.ReferenceVector = ['Satellite/',satName,' AlignedDir'];
sat.Attitude.Basic.Profile.ConstrainedVector.ReferenceVector = ['Satellite/',satName,' ConstrainedDir'];
[x,y,z] = sat.Attitude.Basic.Profile.AlignedVector.Body.QueryXYZ;
xyz = [x,y,z];
% Check to make sure there are no co-aligned vectors
if sum(xyz == bodyDirConstrained) ~= 3
sat.Attitude.Basic.Profile.AlignedVector.Body.AssignXYZ(bodyDirAligned(1),bodyDirAligned(2),bodyDirAligned(3))
sat.Attitude.Basic.Profile.ConstrainedVector.Body.AssignXYZ(bodyDirConstrained(1),bodyDirConstrained(2),bodyDirConstrained(3))
else
sat.Attitude.Basic.Profile.ConstrainedVector.Body.AssignXYZ(bodyDirConstrained(1),bodyDirConstrained(2),bodyDirConstrained(3))
sat.Attitude.Basic.Profile.AlignedVector.Body.AssignXYZ(bodyDirAligned(1),bodyDirAligned(2),bodyDirAligned(3))
end

MCS = sat.Propagator.MainSequence;
maneuvers = FilterSegmentsByType(MCS,'Maneuver',[]);
for i = 1:length(maneuvers)
maneuvers(i).Maneuver.AttitudeControl.CustomFunction = 'eVAEnablePageDefintion';
end
Loading