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;
Figure 1: Output Properties Tab
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; Update ViewWindow1; End; // Zoom in While (ViewWindow1.CurrentViewpoint.ThreeDView.Radius > 1000); ViewWindow1.CurrentViewpoint.ThreeDView.Radius -= 10; Update ViewWindow1; End;
Figure 2: Zoom In and Out.
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; EndProcedure; Define Procedure PanDec(ViewWindow vw, Variable incrementDec); vw.CurrentViewpoint.ThreeDView.Declination = (vw.CurrentViewpoint.ThreeDView.Declination + incrementDec + 360 + 180) % 360 – 180; EndProcedure; Variable i; For i = 0 to 360; Call PanRA(ViewWindow1, -1); Update ViewWindow1; End; For i = 0 to 360; Call PanDec(ViewWindow1, 1); Update ViewWindow1; End; For i = 0 to 360; Call PanRA(ViewWindow1, 1); Call PanDec(ViewWindow1, 1); Update ViewWindow1; End;
Figure 3: Adjust the right ascension and declination of the camera view through script.
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 Update ViewWindow1; Step Spacecraft1 to (Spacecraft1.OrbitApogee()); Update ViewWindow1; // Use WhileStepping instead for a smooth tail WhileStepping Spacecraft1 to (Spacecraft1.OrbitApogee()); Update ViewWindow1; End;
Figure 4: Output of using “Step to” (left) versus “WhileStepping” (right).
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.
WindowOverlay woFade; woFade.RemoveAllShapes(); woFade.AddShape(); 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; Update ViewWindow1; End; // Change Viewpoint // Fade in While (woFade.Shapes.RectangleOptions.FillOpacity >= (0 + 0.005)); woFade.Shapes.RectangleOptions.FillOpacity -= 0.005; Update ViewWindow1; End;
Figure 5: Fade Effect.
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:
Figure 6: Replay Toolbar.
Figure 7: Reconnect Automation.
Alias cameraRA = ViewWindow1.CurrentViewpoint.ThreeDView.RightAscension; Alias cameraDec = ViewWindow1.CurrentViewpoint.ThreeDView.Declination;