Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
Usgscsm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
aflab
astrogeology
Usgscsm
Commits
0d7d91b7
Unverified
Commit
0d7d91b7
authored
4 years ago
by
Stuart Sides
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #325 from jessemapel/std_logging
Added the ability to log to standard out and standard error
parents
aa9b736d
ce82ca6c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+2
-0
2 additions, 0 deletions
CMakeLists.txt
README.md
+42
-17
42 additions, 17 deletions
README.md
include/usgscsm/UsgsAstroPlugin.h
+0
-1
0 additions, 1 deletion
include/usgscsm/UsgsAstroPlugin.h
src/UsgsAstroPlugin.cpp
+15
-2
15 additions, 2 deletions
src/UsgsAstroPlugin.cpp
with
59 additions
and
20 deletions
CMakeLists.txt
+
2
−
0
View file @
0d7d91b7
...
@@ -17,6 +17,7 @@ endif()
...
@@ -17,6 +17,7 @@ endif()
option
(
USGSCSM_EXTERNAL_DEPS
"If the library should be built with external or embedded dependencies"
OFF
)
option
(
USGSCSM_EXTERNAL_DEPS
"If the library should be built with external or embedded dependencies"
OFF
)
if
(
USGSCSM_EXTERNAL_DEPS
)
if
(
USGSCSM_EXTERNAL_DEPS
)
message
(
STATUS
"Using external dependencies"
)
# CSM API library
# CSM API library
find_path
(
CSM_INCLUDE_DIR NAMES
"csm.h"
find_path
(
CSM_INCLUDE_DIR NAMES
"csm.h"
PATH_SUFFIXES
"csm"
PATH_SUFFIXES
"csm"
...
@@ -32,6 +33,7 @@ if(USGSCSM_EXTERNAL_DEPS)
...
@@ -32,6 +33,7 @@ if(USGSCSM_EXTERNAL_DEPS)
find_package
(
ale REQUIRED
)
find_package
(
ale REQUIRED
)
set
(
ALE_TARGET ale::ale
)
set
(
ALE_TARGET ale::ale
)
else
()
else
()
message
(
STATUS
"Using embedded dependencies"
)
# CSM API library
# CSM API library
add_subdirectory
(
csm
)
add_subdirectory
(
csm
)
set
(
CSM_INCLUDE_DIR /csm
)
set
(
CSM_INCLUDE_DIR /csm
)
...
...
This diff is collapsed.
Click to expand it.
README.md
+
42
−
17
View file @
0d7d91b7
#
CSM-CameraModel
#
USGSCSM
Community Sensor Model (CSM) compliant sensor models created by USGS Astrogeology
Community Sensor Model (CSM) compliant sensor models created by USGS Astrogeology
Science Center.
Science Center.
CSM-CameraModel
contains t
wo
different sensor models. The first, is a generic
USGSCSM
contains t
hree
different sensor models. The first, is a generic
framing camera model written from scratch. The second is a generic line scan
framing camera model written from scratch. The second is a generic line scan
camera model based on code from BAE Systems Information and Electronic Systems
camera model based on code from BAE Systems Information and Electronic Systems
Integration Inc.
Integration Inc.
The third is a generic SAR sensor model.
## Using
CSM-CameraModel
## Using
USGSCSM
This library is a CSM plugin library that is intended to be dynamically loaded
This library is a CSM plugin library that is intended to be dynamically loaded
at run time along side the
at run time along side the
...
@@ -30,6 +30,16 @@ server for generating these,
...
@@ -30,6 +30,16 @@ server for generating these,
[
pfeffernusse
](
https://github.com/USGS-Astrogeology/pfeffernusse
)
. The swagger
[
pfeffernusse
](
https://github.com/USGS-Astrogeology/pfeffernusse
)
. The swagger
specification is located on
specification is located on
[
swaggerhub
](
https://app.swaggerhub.com/apis/USGS-Astro/pfeffernusse2/0.1.4-oas3
)
.
[
swaggerhub
](
https://app.swaggerhub.com/apis/USGS-Astro/pfeffernusse2/0.1.4-oas3
)
.
You can also use
[
ALE
](
https://github.com/USGS-Astrogeology/ale
)
directly with
metakernels to generate the auxiliary JSON file.
## Enabling logging
You can enable logging of the internal operations in the sensor models by setting
the
`USGSCSM_LOG_FILE`
environment variable to the file you would like to log to.
You can also log to standard out by setting it to
`stdout`
or standard error
by setting it to
`stderr`
. Note that these logs can become quite large, multiple
GBs.
---
---
...
@@ -42,28 +52,43 @@ specification is located on
...
@@ -42,28 +52,43 @@ specification is located on
This repository has all of its external c++ dependencies included in it. The
This repository has all of its external c++ dependencies included in it. The
excellent header-only JSON library
excellent header-only JSON library
[
JSON for Modern C++
](
https://github.com/nlohmann/json
)
is included directly in
[
JSON for Modern C++
](
https://github.com/nlohmann/json
)
is included directly in
the source code. The other two dependencies, the CSM API library, and gtest
the source code. The other three dependencies, The Abstraction Library for
are included as git submodules. When you clone this library make sure you add
Ephemerides, the CSM API library, and googletest are included as git submodules.
the
`--recursive`
flag to your
`git clone`
command. Alaterntively, you can run
When you clone this library make sure you add the
`--recursive`
flag to your
`git submodule update --init --recursive`
after cloning. The library can also be
`git clone`
command. Alterntively, you can run
compiled against an installed versions of the CSM API by setting the BUILD_CSM
`git submodule update --init --recursive`
after cloning.
flag to OFF during cmake configuration.
You can also install the build requirements using Conda with the provided
`environment.yml`
file. The following commands will create a new environment
to build against. Note that googletest cannot be installed via anaconda and must
be available within the source code. You can remove the googletest dependency
by disabling the tests.
## Building CSM-CameraModel
```
conda env create -n usgscsm -f environment.yml -y
```
CSM-CameraModel uses a standard cmake build system. To compile the library, and
## Building USGSCSM
USGSCSM uses a standard cmake build system. To compile the library and
tests use the following commands:
tests use the following commands:
1.
`mkdir build && cd build`
1.
`mkdir build && cd build`
2.
`cmake .. && cmake --build .`
2.
`cmake .. && cmake --build .`
## Testing CSM-CameraModel
If you are using external dependencies via Conda or system level installations
add the
`-DUSGSCSM_EXTERNAL_DEPS=ON`
flag to the cmake command.
You can also disable the tests and the googletest dependency by adding the
`-DUSGSCSM_BUILD_TESTS=OFF`
flag to the cmake command.
## Testing USGSCSM
All of the tests for
CSM-CameraModel
are written in the googletests framework
All of the tests for
USGSCSM
are written in the googletests framework
and are run via ctest. To run all of the tests simply run
`ctest`
in the build.
and are run via ctest. To run all of the tests simply run
`ctest`
in the build.
All of the tests are purposefully written to use generic data that values have
All of the tests are purposefully written to use generic data that values have
been hand validated
for
. This data can be found under
`tests/data`
.
been hand validated. This data can be found under
`tests/data`
.
## Code Style
## Code Style
...
...
This diff is collapsed.
Click to expand it.
include/usgscsm/UsgsAstroPlugin.h
+
0
−
1
View file @
0d7d91b7
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
#include
<Version.h>
#include
<Version.h>
#include
<nlohmann/json.hpp>
#include
<nlohmann/json.hpp>
#include
"spdlog/sinks/basic_file_sink.h"
#include
"spdlog/spdlog.h"
#include
"spdlog/spdlog.h"
class
UsgsAstroPlugin
:
public
csm
::
Plugin
{
class
UsgsAstroPlugin
:
public
csm
::
Plugin
{
...
...
This diff is collapsed.
Click to expand it.
src/UsgsAstroPlugin.cpp
+
15
−
2
View file @
0d7d91b7
...
@@ -16,6 +16,9 @@
...
@@ -16,6 +16,9 @@
#include
<csm.h>
#include
<csm.h>
#include
<math.h>
#include
<math.h>
#include
"spdlog/sinks/basic_file_sink.h"
#include
"spdlog/sinks/stdout_color_sinks.h"
#include
<nlohmann/json.hpp>
#include
<nlohmann/json.hpp>
using
json
=
nlohmann
::
json
;
using
json
=
nlohmann
::
json
;
...
@@ -50,12 +53,22 @@ UsgsAstroPlugin::UsgsAstroPlugin() {
...
@@ -50,12 +53,22 @@ UsgsAstroPlugin::UsgsAstroPlugin() {
std
::
shared_ptr
<
spdlog
::
logger
>
m_logger
=
spdlog
::
get
(
"usgscsm_logger"
);
std
::
shared_ptr
<
spdlog
::
logger
>
m_logger
=
spdlog
::
get
(
"usgscsm_logger"
);
if
(
!
m_logger
)
{
if
(
!
m_logger
)
{
if
(
logFile
==
"stdout"
)
{
std
::
shared_ptr
<
spdlog
::
logger
>
m_logger
=
spdlog
::
stdout_color_mt
(
"usgscsm_logger"
);
}
else
if
(
logFile
==
"stderr"
)
{
std
::
shared_ptr
<
spdlog
::
logger
>
m_logger
=
spdlog
::
stderr_color_mt
(
"usgscsm_logger"
);
}
else
{
std
::
shared_ptr
<
spdlog
::
logger
>
m_logger
=
std
::
shared_ptr
<
spdlog
::
logger
>
m_logger
=
spdlog
::
basic_logger_mt
(
"usgscsm_logger"
,
logFile
);
spdlog
::
basic_logger_mt
(
"usgscsm_logger"
,
logFile
);
}
}
}
}
}
}
}
}
}
UsgsAstroPlugin
::~
UsgsAstroPlugin
()
{}
UsgsAstroPlugin
::~
UsgsAstroPlugin
()
{}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment