I am trying to write a python script for GMAT to detect contacts between a satellite and a ground station. I have declared the contact locator as such:

access_event = gmat.Construct("ContactLocator","CL")
access_event.SetField("Target" ,"Sat0")


I am also propagating the satellite with the function

for j in range(int(num_steps)):

I am not sure how to run the contact locator to get results. Any help would be great.


1 Answer 1


I am trying to do the same thing, so if you have found an answer please post it!

One method that does work is to generate and run a script using the gmat objects, so I am doing: -

script = sv.GetGeneratingString() + "\n\n"
script = script + gs.GetGeneratingString() + "\n\n"
script = script + fm.GetGeneratingString() + "\n\n"
script = script + rkprop.GetGeneratingString() + "\n\n"
script = script + ct.GetGeneratingString() + "\n\n"
script = script + "BeginMissionSequence;" + "\n\n"
script = script + "Propagate RKProp(I_01_01) {I_01_01.ElapsedDays = 5};" + "\n\n"
f = open(<file path>,'w')

where sv, gs, fm, rkprop & ct are the spacecraft, ground station, force model, propagator & contact locator objects previously configured.

This does generate the contact locator output file, but is rather clumsy and ideally you'd have programmatic access to the contacts without having to parse the contact file afterwards.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.