-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into feature/ans-33
- Loading branch information
Showing
28 changed files
with
3,732 additions
and
1,174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
const std = @import("std"); | ||
const astroz = @import("astroz"); | ||
const Datetime = astroz.time.Datetime; | ||
const coordinates = astroz.coordinates; | ||
const Datetime = astroz.Datetime; | ||
const EquatorialCoordinateSystem = astroz.EquatorialCoordinateSystem; | ||
|
||
pub fn main() !void { | ||
const declination = coordinates.Declination.init(40, 10, 10); | ||
const ra = coordinates.RightAscension.init(19, 52, 2); | ||
const j2000 = coordinates.EquatorialCoordinateSystem.init(declination, ra); | ||
const declination = EquatorialCoordinateSystem.Declination.init(40, 10, 10); | ||
const ra = EquatorialCoordinateSystem.RightAscension.init(19, 52, 2); | ||
const j2000 = EquatorialCoordinateSystem.init(declination, ra); | ||
|
||
std.debug.print("Precessed to July 30, 2005:\n{any}", .{j2000.precess(Datetime.initDate(2005, 7, 30))}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
const std = @import("std"); | ||
const astroz = @import("astroz"); | ||
const Tle = astroz.Tle; | ||
const constants = astroz.constants; | ||
const Spacecraft = astroz.Spacecraft; | ||
|
||
pub fn main() !void { | ||
var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | ||
defer _ = gpa.deinit(); | ||
const allocator = gpa.allocator(); | ||
|
||
const raw_tle = | ||
\\1 55909U 23035B 24187.51050877 .00023579 00000+0 16099-2 0 9998 | ||
\\2 55909 43.9978 311.8012 0011446 278.6226 81.3336 15.05761711 71371 | ||
; | ||
var test_tle = try Tle.parse(raw_tle, allocator); | ||
defer test_tle.deinit(); | ||
var sc = Spacecraft.init("dummy_sc", test_tle, 300.000, Spacecraft.SatelliteSize.Cube, constants.earth, allocator); | ||
defer sc.deinit(); | ||
|
||
sc.angular_velocity = .{ 0.0, 0.0, 0.0 }; | ||
|
||
const dt = 120.0; // 2 mins time step | ||
const simulation_time = 3 * 24 * 60 * 60.0; // 3 days in seconds | ||
const orbital_period = 90 * 60.0; // 90 minutes orbital period | ||
var t: f64 = 0; | ||
|
||
while (t < simulation_time) : (t += dt) { | ||
// Simulate a dramatic torque effect | ||
const torque_x = 0.001 * @sin(2 * std.math.pi * t / (orbital_period * 2)); | ||
const torque_y = 0.0005 * @cos(2 * std.math.pi * t / (orbital_period * 3)); | ||
const torque_z = 0.0002 * @sin(2 * std.math.pi * t / orbital_period); | ||
|
||
// Update angular velocity based on torque (simplified) | ||
sc.angular_velocity[0] += torque_x * dt; | ||
sc.angular_velocity[1] += torque_y * dt; | ||
sc.angular_velocity[2] += torque_z * dt; | ||
|
||
// Update attitude | ||
sc.updateAttitude(); | ||
sc.propagateAttitude(dt); | ||
|
||
// Simulate simple circular orbit | ||
const orbit_radius = 7000.0; | ||
const x = orbit_radius * @cos(2 * std.math.pi * t / orbital_period); | ||
const y = orbit_radius * @sin(2 * std.math.pi * t / orbital_period); | ||
const z = 0.0; | ||
|
||
std.log.debug("Showing orbiting info: {d},{d},{d},{d},{d},{d},{d},{d},{d},{d},{d}\n", .{ | ||
t, | ||
sc.quaternion[0], | ||
sc.quaternion[1], | ||
sc.quaternion[2], | ||
sc.quaternion[3], | ||
sc.angular_velocity[0], | ||
sc.angular_velocity[1], | ||
sc.angular_velocity[2], | ||
x, | ||
y, | ||
z, | ||
}); | ||
} | ||
} |
Oops, something went wrong.