Like or Follow Us
FreeFlyer Visualization Tips and TricksDecember 16, 2019
One of the most powerful capabilities in FreeFlyer is the ability to produce custom visualizations that allow you to portray your mission in the best light! FreeFlyer’s scripting language allows you to build movie-quality camera manipulation directly into your Mission Plan.
When you run a Mission Plan, all of the output that is generated appears in a Workspace on the Output screen. The Output Properties tab on the right-hand side of the page displays detailed information about the view properties at any given point in time. Because these details update as you manipulate a view, this tab can be a great tool for learning how to set up views and camera properties in your script. Simply configure your ideal view using the mouse controls, take note of the view properties that are reported in the Output Properties tab, then set those values appropriately in your script by changing the properties on the ViewWindow object! Now, the next time you run your Mission Plan and update the ViewWindow, the output will already be set up in your desired configuration.
ViewWindow1.CurrentViewpoint.ThreeDView.Source = Spacecraft1.ObjectId;
ViewWindow1.CurrentViewpoint.ThreeDView.Target = Spacecraft1.ObjectId;
ViewWindow1.CurrentViewpoint.ThreeDView.RightAscension = 236;
ViewWindow1.CurrentViewpoint.ThreeDView.Declination = -144;
ViewWindow1.CurrentViewpoint.ThreeDView.Radius = 1000;
Camera Manipulation: Zoom
A basic zoom out or in can make a major impact on your Mission Plan views, allowing you to smoothly transition from a big-picture view of a scenario to focusing on a single satellite. You can implement a zoom in FreeFlyer by incrementing or decrementing the ThreeDView.Radius property in a loop. The example below demonstrates zooming out to a 10000 km radius view, pausing for 1 second, then zooming back in to 1000 km.
// Zoom out
While (ViewWindow1.CurrentViewpoint.ThreeDView.Radius < 10000);
ViewWindow1.CurrentViewpoint.ThreeDView.Radius += 10;
// Zoom in
While (ViewWindow1.CurrentViewpoint.ThreeDView.Radius > 1000);
ViewWindow1.CurrentViewpoint.ThreeDView.Radius -= 10;
Camera Manipulation: Pan in Right Ascension and/or Declination
You can edit your viewing angle directly in FreeFlyer script by adjusting the ThreeDView.RightAscension and ThreeDView.Declination properties. By updating these properties incrementally in a loop similarly to the zoom example above, you can produce a camera rotation around your object of interest. Valid right ascension values range from 0 to 360 degrees and valid declination values range from -180 to 180 degrees, so be sure to account for those ranges in your script to avoid errors caused by invalid values! A great way to handle this kind of rotation is to create Procedures that you can call from any point in your script, rather than repeating chunks of code multiple times.
Define Procedure PanRA(ViewWindow vw, Variable incrementRA);
vw.CurrentViewpoint.ThreeDView.RightAscension = (vw.CurrentViewpoint.ThreeDView.RightAscension + incrementRA + 360) % 360;
Define Procedure PanDec(ViewWindow vw, Variable incrementDec);
vw.CurrentViewpoint.ThreeDView.Declination = (vw.CurrentViewpoint.ThreeDView.Declination + incrementDec + 360 + 180) % 360 - 180;
For i = 0 to 360;
Call PanRA(ViewWindow1, -1);
For i = 0 to 360;
Call PanDec(ViewWindow1, 1);
For i = 0 to 360;
Call PanRA(ViewWindow1, 1);
Call PanDec(ViewWindow1, 1);
Update Output While Maneuvering or Stepping to a Condition
Using a WhileStepping or WhileManeuvering loop allows you to update visualizations (and perform other tasks) while propagating your Spacecraft to a specific condition or performing a maneuver. This prevents jarring “jumps” in visualization that can happen when using the “Step to” or “Maneuver” commands, which do not allow for view updates while the internal propagation is happening.
// "Step to" can create jumps in tail visualization
Step Spacecraft1 to (Spacecraft1.OrbitApogee());
// Use WhileStepping instead for a smooth tail
WhileStepping Spacecraft1 to (Spacecraft1.OrbitApogee());
Want to seamlessly transition between two different views to represent different parts of your Mission Plan? You can use a WindowOverlay to create a “fade” effect that makes a great transition. First, create a WindowOverlay object with a rectangle shape that is the size of the entire ViewWindow. Set the color to Black and the FillOpacity to 0.
woFade.Shapes.Type = "Rectangle";
woFade.Shapes.SetSize(0, 1, 1);
woFade.Shapes.SetPosition(0, 0, 0);
woFade.Shapes.RectangleOptions.BorderWidth = 0;
woFade.Shapes.RectangleOptions.FillColor = ColorTools.Black;
woFade.Shapes.RectangleOptions.FillOpacity = 0;
Then, to “fade out”, incrementally adjust the FillOpacity property until it reaches 1, and to “fade in”, decrement it back down to 0!
// Fade out
While (woFade.Shapes.RectangleOptions.FillOpacity <= (1 - 0.005));
woFade.Shapes.RectangleOptions.FillOpacity += 0.005;
// Change Viewpoint
// Fade in
While (woFade.Shapes.RectangleOptions.FillOpacity >= (0 + 0.005));
woFade.Shapes.RectangleOptions.FillOpacity -= 0.005;
FreeFlyer’s scripting language gives you the power to control every aspect of your visualizations! A few final general tips for improving visualizations are presented here:
- Use the replay toolbar in the top right portion of the Output tab to review parts of a Mission Plan after it has been run! The replay toolbar allows you to play a Mission Plan forward or backward, speed up or slow down playback, jump to specific parts of the output, or step through the playback frame by frame, all while still offering the ability to fully manipulate the view.
- If you’ve manipulated a view in an output window and wish to return it to its original settings, right-click anywhere in the window and select “Reconnect Automation”.
- Use an Alias to avoid having to type long property names.
- Load 3D models into the Spacecraft object to see your own satellite in FreeFlyer.
- Create pre-defined Viewpoint objects that can be assigned to your ViewWindow by changing the ViewWindow.CurrentViewpoint property.
- Use PointGroups or GraphicsOverlays to visualize complex Terrain on the ground.
Alias cameraRA = ViewWindow1.CurrentViewpoint.ThreeDView.RightAscension;
Alias cameraDec = ViewWindow1.CurrentViewpoint.ThreeDView.Declination;
FreeFlyer Astrodynamics Tool