ggAstro Astronautics¶
ggame extensions for modeling spacecraft in planetary orbit
Rocket¶
-
class
ggame.astro.Rocket(planet, **kwargs)[source]¶ Rocket is a class for simulating the motion of a projectile through space, acted upon by arbitrary forces (thrust) and by gravitaitonal attraction to a single planetary object.
Initialize the Rocket object.
Example:
rocket1 = Rocket(earth, altitude=400000, velocity=7670, timezoom=2)Required parameters:
- planet: Reference to a Planet object.
Optional keyword parameters are supported:
- bitmap: url of a suitable bitmap image for the rocket (png recommended) default is ggimages/rocket.png
- bitmapscale: scale factor for bitmap. Default is 0.1
- velocity: initial rocket speed. default is zero.
- directiond: initial rocket direction in degrees. Default is zero.
- direction: initial rocket direction in radians. Default is zero.
- tanomalyd: initial rocket true anomaly in degrees. Default is 90.
- tanomaly: initial rocket true anomaly in radians. Default is pi/2.
- altitude: initial rocket altitude in meters. Default is zero.
- showstatus: boolean displays flight parameters on screen. Default is True.
- statuspos: tuple with x,y coordinates of flight parameters. Default is upper left.
- statuslist: list of status names to include in flight parameters. Default is all, consisting of: “velocity”, “acceleration”, “course”, “altitude”, “thrust”, “mass”, “trueanomaly”, “scale”, “timezoom”, “shiptime”
- leftkey: a ggame key identifier that will serve as the “rotate left” key while controlling the ship. Default is ‘left arrow’.
- rightkey: a ggame key identifier that will serve as the “rotate right” key while controlling the ship. Default is ‘right arrow’.
Following parameters may be set as a constant value, or pass in the name of a function that will return the value dynamically or the name of a ggmath UI control that will return the value.
- timezoom scale factor for time zoom. Factor = 10^timezoom
- heading direction to point the rocket in (must be radians)
- mass mass of the rocket (must be kg)
- thrust thrust of the rocket (must be N)
Animation related parameters may be ignored if no sprite animation:
- bitmapframe ((x1,y1),(x2,y2)) tuple defines a region in the bitmap
- bitmapqty number of bitmaps – used for animation effects
- bitmapdir “horizontal” or “vertical” use with animation effects
- bitmapmargin pixels between successive animation frames
- tickrate frequency of spacecraft dynamics calculations (Hz)
-
addStatusReport(statuslist, statusfuncs, statusselect)[source]¶ Accept list of all status names, all status text functions, and the list of status names that have been selected for display.
-
dynamics(timer)[source]¶ Perform one iteration of the simulation using runge-kutta 4th order method.
Planet¶
-
class
ggame.astro.Planet(**kwargs)[source]¶ Initialize the Planet object.
Optional keyword parameters are supported:
- viewscale pixels per meter in graphics display. Default is 10.
- radius radius of the planet in meters. Default is Earth radius.
- planetmass mass of the planet in kg. Default is Earth mass.
- color color of the planet. Default is greenish (0x008040).
- viewalt altitude of initial viewpoint in meters. Default is rocket altitude.
- viewanom true anomaly (angle) of initial viewpoint in radians. Default is the rocket anomaly.
- viewanomd true anomaly (angle) of initial viewpoing in degrees. Default is the rocket anomaly.