Commit a8e2ed07 authored by luroth's avatar luroth
Browse files

import possibility added

parent dbb7b63e
This diff is collapsed.
......@@ -67,11 +67,11 @@ server_ <- function(input, output, session) {
###################
# Read preconfigured sensor / lens combination from JSON file
preconfigured_sensors_and_lens <- fromJSON("sensors.json")
#preconfigured_sensors_and_lens <- fromJSON("sensors.json")
# Update selection field
isolate({
updateSelectInput(session, "sensor_and_lens_select", selected = list.select(preconfigured_sensors_and_lens, name)[[1]], choices = c("Custom", lapply(list.select(preconfigured_sensors_and_lens, name), "[[", 1)))
})
#isolate({
# updateSelectInput(session, "sensor_and_lens_select", selected = list.select(preconfigured_sensors_and_lens, name)[[1]], choices = c("Custom", lapply(list.select(preconfigured_sensors_and_lens, name), "[[", 1)))
#})
# Hide other tabs on startup
hideTab(inputId = "config_tab", target = "Imaging")
hideTab(inputId = "config_tab", target = "Mapping")
......@@ -125,7 +125,7 @@ server_ <- function(input, output, session) {
# Set sensor selection writeable
shinyjs::toggleState("sensor_and_lens_select", TRUE)
if(input$sensor_and_lens_select == "Custom") {
if(TRUE) { # input$sensor_and_lens_select == "Custom"
# If Custom, enable editing of sensor values in GUI
shinyjs::toggleState("d_sensor_x", TRUE)
shinyjs::toggleState("d_sensor_y", TRUE)
......@@ -147,7 +147,7 @@ server_ <- function(input, output, session) {
# Observe sensor selection
observeEvent(input$sensor_and_lens_select, {
if(input$sensor_and_lens_select == "Custom") {
if(TRUE) { # input$sensor_and_lens_select == "Custom"
# If Custom, enable editing of sensor values in GUI
fields_editable <- TRUE
} else {
......@@ -1080,6 +1080,21 @@ server_ <- function(input, output, session) {
}
)
observe({
req(input$settings)
settings <- fromJSON(input$settings$datapath)
for(param in names(settings$input))
{
if(length(settings$input[param][[1]])==1) {
value <- settings$input[param][[1]][[1]]
name <- param
session$sendInputMessage(name, list(value=value))
}
}
})
output$download_report <- downloadHandler(
filename = function() { paste('all_graphs.pdf', sep='') },
content = function(file) {
......
......@@ -17,6 +17,17 @@ default_flip_camera <- FALSE
default_plot_size_x <- 1.5
default_plot_size_y <- 2
default_position_precision <- 3
default_sensor_name <- "Sony A9 on DJI M600P"
default_d_sensor_x<- 35.6
default_d_sensor_y<- 23.8
default_n_pix_x<- 6000
default_n_pix_y<- 4000
default_lens_aperture<- 8
default_focal_lenght<- 55
default_t_max<- 32000
default_ISO_max<- 6400
default_freq_max<- 2
default_flight_max<- 15
default_position_edge1_lat <- 47.450812627526901
default_position_edge1_long <- 8.682496912397921
......@@ -41,31 +52,31 @@ ui_ <- fluidPage(
tabPanel("Sensor/Lens",
h4("Sensor"),
fluidRow(
column(8, selectInput("sensor_and_lens_select", label=NA, choices=NA)),
column(8, textInput("sensor_and_lens_select", label=NA, value= default_sensor_name)),
column(4, actionButton("sensor_and_lens_edit", "Save settings"))
),
fluidRow(
column(6, numericInput("d_sensor_x", "Sensor size, width (mm)", width = "100%", value=NA, step=0.1)),
column(6, numericInput("d_sensor_y", "Sensor size, height (mm)", width = "100%", value=NA, step=0.1))
column(6, numericInput("d_sensor_x", "Sensor size, width (mm)", width = "100%", value=default_d_sensor_x, step=0.1)),
column(6, numericInput("d_sensor_y", "Sensor size, height (mm)", width = "100%", value=default_d_sensor_y, step=0.1))
),
fluidRow(
column(6, numericInput("n_pix_x", "Number of recorded pixels in x (px)", width = "100%", value=NA, step=1)),
column(6, numericInput("n_pix_y", "Number of recorded pixels in y (px)", width = "100%", value=NA, step=1))
column(6, numericInput("n_pix_x", "Number of recorded pixels in x (px)", width = "100%", value=default_n_pix_x, step=1)),
column(6, numericInput("n_pix_y", "Number of recorded pixels in y (px)", width = "100%", value=default_n_pix_y, step=1))
),
fluidRow(
column(6, numericInput("t_max", "Max. shutter speed (1/s)", width = "100%", value=NA, step=1000)),
column(6, numericInput("ISO_max", "Max. film speed (ISO)", width = "100%", value=NA, step=1000))
column(6, numericInput("t_max", "Max. shutter speed (1/s)", width = "100%", value=default_t_max, step=1000)),
column(6, numericInput("ISO_max", "Max. film speed (ISO)", width = "100%", value=default_ISO_max, step=1000))
),
fluidRow(
column(6, numericInput("freq_max", "Max. recording freqency (1/s)", width = "100%", value=NA)),
column(6, numericInput("flight_max", "Max. flight time (min)", width = "100%", value=NA))
column(6, numericInput("freq_max", "Max. recording freqency (1/s)", width = "100%", value=default_freq_max)),
column(6, numericInput("flight_max", "Max. flight time (min)", width = "100%", value=default_flight_max))
),
htmlOutput("d_pix_output"),
hr(),
h4("Lens"),
fluidRow(
column(6, numericInput("f", "Focal length (mm)", width = "100%", value=NA, step=1)),
column(6, selectInput("aperture", "Aperture (f-number)", width = "100%", choices = aperture_values))
column(6, numericInput("f", "Focal length (mm)", width = "100%", value=default_focal_lenght, step=1)),
column(6, selectInput("aperture", "Aperture (f-number)", width = "100%", choices = aperture_values, selected=default_lens_aperture))
)
),
......@@ -153,6 +164,7 @@ ui_ <- fluidPage(
)
),
hr(),
img(src="ETHLogo_black_20.png"),
div(HTML("<br />Group of crop science<br />Lukas Roth (lukas.roth@usys.ethz.ch)<br />(c) 2018"))
......@@ -214,7 +226,6 @@ ui_ <- fluidPage(
htmlOutput("campaign_settings"),
h4("Restrictions"),
htmlOutput("restrictions"),
div(downloadButton("download_params", "Download parameters as JSON")),
div(downloadButton("download_report", "Download all graphs as PDF"))
),
column(7,
......@@ -224,6 +235,15 @@ ui_ <- fluidPage(
)
)
),
tabPanel("Load/Save",
h4("Save campaign to file"),
downloadButton("download_params", "Download as JSON"),
h4("Load campaign from file"),
fileInput("settings", "Open JSON",
multiple = FALSE,
accept = c("text/json",
".json"))
)
)
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment