Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [sc-71] Astroz: Usage in Readme #7

Merged
merged 3 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 50 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ Astronomical and Spacecraft Toolkit Written in Zig for Zig!

## Features / Plans

NOTE this is new and I'm adding to in my free time so things might take some time to get implemented unless there are contributors

### Spacecraft

- [x] CCSDS Packet Parsing (basic implementation)
- [ ] VITA49 Packet Parsing
- [x] CCSDS Packets
- [ ] VITA49 Packets

### Astronomical

Expand All @@ -18,6 +16,53 @@ NOTE this is new and I'm adding to in my free time so things might take some tim
- [x] Astronomical Computation
- [ ] Orbital Mechanics

## Install

**Please use the master branch of the zig repository as that is what I'm developing against**

The easiest way I've found to get started with dependencies in zig is the following.
- in your `main.zig` import the dependency.

```zig
const astroz = @import("astroz");

```

- run `zig fetch --save git+https://github.com/ATTron/astroz/#HEAD`
- inside `build.zig`

```zig
const package = b.dependency("astroz", .{
.target = target,
.optimize = optimize,
});

const module = package.module("astroz");

exe.root_module.addImport("astroz", module);

b.installArtifact(exe);

```

## Usage

Please use the master branch of the zig repository as that is what I'm developing against
### Example

#### precess a star to July 30, 2005

```zig
const std = @import("std");
const astroz = @import("astroz");
const coordinates = astroz.coordinates;
const Datetime = astroz.time.Datetime;

pub fn main() !void {
const declination = coordinates.Declination.new(40, 10, 10);
const ra = coordinates.Right_Ascension.new(19, 52, 2);
const j2000 = coordinates.Equatorial_Coordinate_System.new(declination, ra);

std.debug.print("Precessed to July 30, 2005:\n{any}", .{j2000.precess(Datetime.new_date(2005, 7, 30))});
}

```
2 changes: 1 addition & 1 deletion build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// This is a [Semantic Version](https://semver.org/).
// In a future version of Zig it will be used for package deduplication.
.version = "0.0.0",
.version = "0.0.1",

// This field is optional.
// This is currently advisory only; Zig does not yet do anything
Expand Down
10 changes: 5 additions & 5 deletions src/lib.zig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const ccsds = @import("ccsds.zig");
const constants = @import("constants.zig");
const time = @import("time.zig");
const coordinates = @import("coordinates.zig");
const calculations = @import("calculations.zig");
pub const ccsds = @import("ccsds.zig");
pub const constants = @import("constants.zig");
pub const time = @import("time.zig");
pub const coordinates = @import("coordinates.zig");
pub const calculations = @import("calculations.zig");
Loading