Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds a --image-time flag to the distance command that records when an image was captured, enabling more accurate satellite position calculations by using the actual image capture time instead of the current system time. The timestamp is stored in the output .found file.
- Adds new
strtodatetimeconverter function to parse datetime strings in YYYY-MM-DD HH:MM:SS format - Replaces automatic timestamp generation with user-provided image capture time in position records
- Updates all distance command tests and README documentation to include the new time parameter
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/providers/converters.hpp | Adds strtodatetime function to convert string timestamps to DateTime structures |
| src/command-line/parsing/options.hpp | Adds image-time option definition for the distance command |
| src/command-line/execution/executors.cpp | Modifies OutputResults to use provided imageTime instead of calling getUT1Time() |
| test/integration/integration-test.cpp | Updates integration tests to include the new --image-time parameter and removes obsolete test |
| test/command-line/parsing/parser-test.cpp | Adds parser tests for the new imageTime field |
| test/command-line/execution/executors-test.cpp | Updates executor test to include sample imageTime data |
| README.md | Updates documentation and examples to show usage of the new --image-time flag |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
nguy8tri
left a comment
There was a problem hiding this comment.
This is by no means comprehensive, but great job, just left some comments!
nguy8tri
left a comment
There was a problem hiding this comment.
Good job on the fixes. This time, my comments are more towards having you think critically about some code changes you've made. Please respond to my comments as appropriate. Also if it takes a long time for me to review your code, ping me on slack so I can make time for it.
|
It might be better to replace celestial coordinate with equatorial coordinate since equatorial coordinates are a specific definition of celestial coordinates. |
|
It seems that you changed celestial to equatorial in your PR, so I won't implement that here to prevent merge conflicts in the future |
385ce43 to
1d8013f
Compare
nguy8tri
left a comment
There was a problem hiding this comment.
Good job, just a few more minor comments.
| decimal getGreenwichMeanSiderealTime(std::time_t epochs) { | ||
| return 15 * (DECIMAL(18.697374558) + DECIMAL(24.06570982441908) * (getJulianDateTime(epochs) - DECIMAL(2451545.0))); | ||
| decimal getGreenwichMeanSiderealTime(uint64_t epochs) { | ||
| return 15 * (DECIMAL(18.697374558) + DECIMAL(24.06570982441908) * |
There was a problem hiding this comment.
We should have constants for these 3
| // This is preferable than continuing with invalid data and outputting an unintended | ||
| // result. | ||
|
|
||
| constexpr int days_in_month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; |
| // Convert to nanoseconds: seconds * NS_PER_SEC + nanoseconds | ||
| uint64_t epochs_ns = static_cast<uint64_t>(t) * NS_PER_SEC + nanosecond; | ||
|
|
||
| return { |
There was a problem hiding this comment.
Are we sure there isn't a library function that will do this for us? Please look into that
| FOUND_CLI_OPTION("isdda-radius-loss-order" , int , ISDDARadLossOrd , 4 , atoi(optarg) , kNoDefaultArgument, REQ_ASSIGN, "The Radius Loss Order ISSDA (even int)" ) \ | ||
| FOUND_CLI_OPTION("output-file" , std::string , outputFile , "" , optarg , kNoDefaultArgument, REQ_ASSIGN, "The output file (*.found)" ) \ | ||
| FOUND_CLI_OPTION("image" , found::Image , image , {} , found::strtoimage(optarg) , kNoDefaultArgument, REQ_ASSIGN, "The image to process (JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC)") \ | ||
| FOUND_CLI_OPTION("image-time" , found::DateTime , imageTime , {} , found::strtodatetime(optarg), kNoDefaultArgument, REQ_ASSIGN, "Image capture time (in UT1 in format YYYY-MM-DD HH:MM:SS.NS)" ) \ |
There was a problem hiding this comment.
Its unclear how many nano seconds, or if its required. It may add value to be flexible about the format, maybe not. Usually libraries will parse a string into a date.
|
|
||
| // Test Time (epochs in nanoseconds: 1762889400 seconds * NS_PER_SEC) | ||
| DateTime expectedImageTime{1762889400000000000ULL, 2025, 11, 11, 19, 30, 0}; | ||
| ASSERT_EQ(expectedImageTime.epochs, options.imageTime.epochs); |
There was a problem hiding this comment.
Make a helper macro that will assert over an entire Date time so we can do something like ASSET_TIME(expected, actual)
| ASSERT_GE(num, lo) << "Value " << num << " is less than lower bound " << lo; \ | ||
| ASSERT_LE(num, hi) << "Value " << num << " is greater than upper bound " << hi; | ||
|
|
||
| #define ASSERT_DATETIME_EQ(expected, actual) \ |
| --camera-focal-length 85e-3 \ | ||
| --camera-pixel-size 20e-6 \ | ||
| --reference-orientation 110,0,0 | ||
| --reference-orientation 110,0,0 \ |
There was a problem hiding this comment.
no, there should not have a line continuation at the last one.
Description
Resolves #44
Adds a time flag request to found's distance command that marks when the image was taken (in nanoseconds). This allows for a more accurate understanding of the satellite's latitude and longitude. Currently outputs time into the outputted .found file.
This PR also modifies the output of output.cpp's GetEarthCoordinates function to be ECEF coordinates. This is the standard set for representing position by NASA (example: https://ntrs.nasa.gov/api/citations/20190002515/downloads/20190002515.pdf) and other space grade receivers.
Note that the nanoseconds since epoch is being stored as an unsigned 64-bit integer throughout the code. This can reliably store up until the year 2557.
Artifacts for PR #60 (DO NOT CHANGE)