Write a function to calculate the trajectory of a spacecraft given initial conditions for Impulse Space.
Assume ideal two-body motion around a point mass at the origin. Implement universal-variable Kepler propagation for a spacecraft's three-dimensional position and velocity. Return the state at each requested, nonnegative time.
Signature: def calculate_trajectory(initial_position, initial_velocity, mu, times):
Positions, velocities, mu, and times use consistent units. Return a list of objects containing time, position, and velocity. times is sorted in nondecreasing order, and valid inputs avoid collisions with the central body.
def calculate_trajectory(initial_position, initial_velocity, mu, times):