Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagohm committed Feb 29, 2024
2 parents ab7b723 + dc5fc4a commit b44e250
Show file tree
Hide file tree
Showing 415 changed files with 12,648 additions and 4,713 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022-2023 Tiago Melo
Copyright (c) 2022-2024 Tiago Melo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,19 @@
[![Active Development](https://img.shields.io/badge/Maintenance%20Level-Actively%20Developed-brightgreen.svg)](https://gist.github.com/cheerfulstoic/d107229326a01ff0f333a1d3476e068d)
[![CI](https://github.com/tiagohm/nebulosa/actions/workflows/ci.yml/badge.svg)](https://github.com/tiagohm/nebulosa/actions/workflows/ci.yml)
[![CodeFactor](https://www.codefactor.io/repository/github/tiagohm/nebulosa/badge/main)](https://www.codefactor.io/repository/github/tiagohm/nebulosa/overview/main)

The complete integrated solution for all of your astronomical imaging needs.

## Building

### Pre-requisites

* Java 17
* Node 20.9.0 or newer

### Steps

* `./gradlew api:bootJar`
* `cd desktop`
* `npm i`
* `npm run electron:build`
8 changes: 5 additions & 3 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ import org.springframework.boot.gradle.tasks.bundling.BootJar

plugins {
kotlin("jvm")
id("org.springframework.boot") version "3.2.2"
id("org.springframework.boot") version "3.2.3"
id("io.spring.dependency-management") version "1.1.4"
kotlin("plugin.spring")
kotlin("kapt")
id("io.objectbox")
}

dependencies {
implementation(project(":nebulosa-alignment"))
implementation(project(":nebulosa-astap"))
implementation(project(":nebulosa-astrometrynet"))
implementation(project(":nebulosa-alpaca-indi"))
implementation(project(":nebulosa-batch-processing"))
implementation(project(":nebulosa-common"))
implementation(project(":nebulosa-guiding-phd2"))
Expand Down Expand Up @@ -43,7 +45,7 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-undertow")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
kapt("org.springframework:spring-context-indexer:6.1.3")
kapt("org.springframework:spring-context-indexer:6.1.4")
testImplementation(project(":nebulosa-skycatalog-stellarium"))
testImplementation(project(":nebulosa-test"))
}
Expand All @@ -60,6 +62,6 @@ tasks.withType<BootJar> {
kapt {
arguments {
arg("objectbox.modelPath", "$projectDir/schemas/objectbox.json")
arg("objectbox.myObjectBoxPackage", "nebulosa.api.entities")
arg("objectbox.myObjectBoxPackage", "nebulosa.api.database")
}
}
62 changes: 52 additions & 10 deletions api/src/main/kotlin/nebulosa/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ URL: `localhost:{PORT}/ws`
```json5
{
"camera": {},
"state": "EXPOSURING",
"state": "CAPTURE_STARTED|EXPOSURE_STARTED|EXPOSURING|WAITING|SETTLING|EXPOSURE_FINISHED|CAPTURE_FINISHED",
"exposureAmount": 0,
"exposureCount": 0,
"captureElapsedTime": 0,
Expand Down Expand Up @@ -152,7 +152,7 @@ URL: `localhost:{PORT}/ws`
"canRelativeMove": false,
"canAbort": false,
"canReverse": false,
"reverse": false,
"reversed": false,
"canSync": false,
"hasBacklash": false,
"maxPosition": 0,
Expand Down Expand Up @@ -181,16 +181,35 @@ URL: `localhost:{PORT}/ws`

### DARV Polar Alignment

#### DARV_ALIGNMENT.ELAPSED
#### DARV.ELAPSED

```json5
{
"camera": {},
"guideOutput": {},
"id": "",
"remainingTime": 0,
"progress": 0.0,
"direction": "EAST",
"state": "FORWARD"
"state": "FORWARD|BACKWARD"
}
```

### Three Point Polar Alignment

#### TPPA.ELAPSED

```json5
{
"id": "",
"elapsedTime": 0,
"stepCount": 0,
"state": "SLEWING|SOLVING|SOLVED|COMPUTED|FAILED|FINISHED",
"rightAscension": "00h00m00s",
"declination": "00d00m00s",
"azimuthError": "00d00m00s",
"altitudeError": "00d00m00s",
"totalError": "00d00m00s",
"azimuthErrorDirection": "",
"altitudeErrorDirection": ""
}
```

Expand All @@ -200,23 +219,46 @@ URL: `localhost:{PORT}/ws`

```json5
{
"state": "EXPOSURING|CAPTURED|FAILED",
"exposureTime": 0,
"savedPath": "",
// CAMERA.CAPTURE_ELAPSED
"capture": {},
"message": ""
}
```

### Sequencer

#### SEQUENCER.ELAPSED

```json5
{
"id": 0,
"elapsedTime": 0,
"remainingTime": 0,
"progress": 0.0,
// CAMERA.CAPTURE_ELAPSED
"capture": {}
}
```

#### FLAT_WIZARD.FRAME_CAPTURED
### INDI

#### DEVICE.PROPERTY_CHANGED, DEVICE.PROPERTY_DELETED

```json5
{
"exposureTime": 0,
"savedPath": ""
"device": {},
"property": {}
}
```

#### FLAT_WIZARD.FAILED
#### DEVICE.MESSAGE_RECEIVED

```json5
{
"device": {},
"message": ""
}
```
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package nebulosa.api.alignment.polar

import nebulosa.api.alignment.polar.darv.DARVStartRequest
import nebulosa.api.alignment.polar.tppa.TPPAStartRequest
import nebulosa.api.beans.converters.indi.DeviceOrEntityParam
import nebulosa.indi.device.camera.Camera
import nebulosa.indi.device.guide.GuideOutput
import org.springframework.web.bind.annotation.PutMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import nebulosa.indi.device.mount.Mount
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("polar-alignment")
Expand All @@ -19,12 +18,31 @@ class PolarAlignmentController(
fun darvStart(
@DeviceOrEntityParam camera: Camera, @DeviceOrEntityParam guideOutput: GuideOutput,
@RequestBody body: DARVStartRequest,
) {
polarAlignmentService.darvStart(camera, guideOutput, body)
) = polarAlignmentService.darvStart(camera, guideOutput, body)

@PutMapping("darv/{id}/stop")
fun darvStop(@PathVariable id: String) {
polarAlignmentService.darvStop(id)
}

@PutMapping("tppa/{camera}/{mount}/start")
fun tppaStart(
@DeviceOrEntityParam camera: Camera, @DeviceOrEntityParam mount: Mount,
@RequestBody body: TPPAStartRequest,
) = polarAlignmentService.tppaStart(camera, mount, body)

@PutMapping("tppa/{id}/stop")
fun tppaStop(@PathVariable id: String) {
polarAlignmentService.tppaStop(id)
}

@PutMapping("tppa/{id}/pause")
fun tppaPause(@PathVariable id: String) {
polarAlignmentService.tppaPause(id)
}

@PutMapping("darv/{camera}/{guideOutput}/stop")
fun darvStop(@DeviceOrEntityParam camera: Camera, @DeviceOrEntityParam guideOutput: GuideOutput) {
polarAlignmentService.darvStop(camera, guideOutput)
@PutMapping("tppa/{id}/unpause")
fun tppaUnpause(@PathVariable id: String) {
polarAlignmentService.tppaUnpause(id)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,44 @@ package nebulosa.api.alignment.polar

import nebulosa.api.alignment.polar.darv.DARVExecutor
import nebulosa.api.alignment.polar.darv.DARVStartRequest
import nebulosa.api.alignment.polar.tppa.TPPAExecutor
import nebulosa.api.alignment.polar.tppa.TPPAStartRequest
import nebulosa.indi.device.camera.Camera
import nebulosa.indi.device.guide.GuideOutput
import nebulosa.indi.device.mount.Mount
import org.springframework.stereotype.Service

@Service
class PolarAlignmentService(
private val darvExecutor: DARVExecutor,
private val tppaExecutor: TPPAExecutor,
) {

fun darvStart(camera: Camera, guideOutput: GuideOutput, darvStartRequest: DARVStartRequest) {
fun darvStart(camera: Camera, guideOutput: GuideOutput, darvStartRequest: DARVStartRequest): String {
check(camera.connected) { "camera not connected" }
check(guideOutput.connected) { "guide output not connected" }
darvExecutor.execute(darvStartRequest.copy(camera = camera, guideOutput = guideOutput))
return darvExecutor.execute(camera, guideOutput, darvStartRequest)
}

fun darvStop(camera: Camera, guideOutput: GuideOutput) {
darvExecutor.stop(camera, guideOutput)
fun darvStop(id: String) {
darvExecutor.stop(id)
}

fun tppaStart(camera: Camera, mount: Mount, tppaStartRequest: TPPAStartRequest): String {
check(camera.connected) { "camera not connected" }
check(mount.connected) { "mount not connected" }
return tppaExecutor.execute(camera, mount, tppaStartRequest)
}

fun tppaStop(id: String) {
tppaExecutor.stop(id)
}

fun tppaPause(id: String) {
tppaExecutor.pause(id)
}

fun tppaUnpause(id: String) {
tppaExecutor.unpause(id)
}
}
46 changes: 40 additions & 6 deletions api/src/main/kotlin/nebulosa/api/alignment/polar/darv/DARVEvent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@ package nebulosa.api.alignment.polar.darv

import nebulosa.api.messages.MessageEvent
import nebulosa.guiding.GuideDirection
import nebulosa.indi.device.camera.Camera
import nebulosa.indi.device.guide.GuideOutput
import java.time.Duration

sealed interface DARVEvent : MessageEvent {

val camera: Camera

val guideOutput: GuideOutput
val id: String

val remainingTime: Duration

Expand All @@ -21,5 +17,43 @@ sealed interface DARVEvent : MessageEvent {
val state: DARVState

override val eventName
get() = "DARV_ALIGNMENT.ELAPSED"
get() = "DARV.ELAPSED"

data class Started(
override val id: String,
override val remainingTime: Duration,
override val direction: GuideDirection,
) : DARVEvent {

override val progress = 0.0
override val state = DARVState.INITIAL_PAUSE
}

data class Finished(
override val id: String,
) : DARVEvent {

override val remainingTime = Duration.ZERO!!
override val progress = 0.0
override val state = DARVState.IDLE
override val direction = null
}

data class InitialPauseElapsed(
override val id: String,
override val remainingTime: Duration,
override val progress: Double,
) : DARVEvent {

override val state = DARVState.INITIAL_PAUSE
override val direction = null
}

data class GuidePulseElapsed(
override val id: String,
override val remainingTime: Duration,
override val progress: Double,
override val direction: GuideDirection,
override val state: DARVState,
) : MessageEvent, DARVEvent
}
Loading

0 comments on commit b44e250

Please sign in to comment.