Skip to content

Commit

Permalink
Merge pull request #260 from JuliaRobotics/feature/setlocalonly
Browse files Browse the repository at this point in the history
adding local memory only feature,
  • Loading branch information
dehann committed Feb 18, 2019
2 parents 76b33a2 + 05d117c commit d2408c6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
11 changes: 9 additions & 2 deletions examples/marine/rov/highend/synchronySDKIntegration.jl
Expand Up @@ -40,14 +40,21 @@ $(SIGNATURES)
Get Graff configuration, default filepath location assumed as `~/Documents/graffConfig.json`.
"""
function loadGraffConfig(;
console::Vector{Symbol}=[],
filepath::AS=joinpath(ENV["HOME"],"Documents","graffConfig.json")
) where {AS <: AbstractString}
#
println(" - Retrieving Graff Configuration...")
configFile = open(filepath)
configData = JSON.parse(readstring(configFile))
close(configFile)
Unmarshal.unmarshal(GraffConfig, configData) # graffConfig =
cfg = Unmarshal.unmarshal(GraffConfig, configData) # graffConfig =

:userId in console ? (println("userId: "); cfg.userId = readline(stdin);) : nothing
:robotId in console ? (println("robotId: "); cfg.robotId = readline(stdin);) : nothing
:sessionId in console ? (println("sessionId: "); cfg.sessionId = readline(stdin);) : nothing

return cfg
end

"""
Expand Down Expand Up @@ -119,7 +126,7 @@ function initialize!(sslaml::GraffSLAM;
if isSessionExisting(slam_client.graffconf, sslaml.robotId, sslaml.sessionId)
@warn "There is already a session named '$sessionId' for robot '$robotId'. This example will fail if it tries to add duplicate nodes. We strongly recommend providing a new session name."
print(" Should we delete it? [Y/N] - ")
if lowercase(strip(readline(STDIN))) == "y"
if lowercase(strip(readline(stdin))) == "y"
deleteSession(sslaml.graffconf, sslaml.robotId, sslaml.sessionId)
println(" -- Session '$sessionId' deleted!")
else
Expand Down
20 changes: 17 additions & 3 deletions src/cloudgraphs/CloudGraphIntegration.jl
Expand Up @@ -328,6 +328,19 @@ function usecloudgraphsdatalayer!()
nothing
end

function uselocalmemoryonly!()
IIF.setdatalayerAPI!(
addvertex= IIF.localapi.addvertex!,
getvertex= IIF.localapi.getvertex,
makeaddedge= IIF.localapi.makeaddedge!,
getedge= IIF.localapi.getedge,
outneighbors= IIF.localapi.outneighbors,
updatevertex= IIF.localapi.updatevertex!,
deletevertex= IIF.localapi.deletevertex!,
deleteedge= IIF.localapi.deleteedge!,
cgEnabled= false )
nothing
end



Expand Down Expand Up @@ -360,6 +373,7 @@ Get all Neo4j node IDs in current session.
function getAllExVertexNeoIDs(conn::Neo4j.Connection;
ready::Int=1,
backendset::Int=1,

sessionname::AS="",
robotname::AS="",
username::AS="",
Expand Down Expand Up @@ -738,7 +752,7 @@ function askneo4jcredentials!(;addrdict=Dict{AbstractString,AbstractString}() )
info("Please enter information for Neo4j DB:")
for n in need
info(n)
str = readline(STDIN)
str = readline(stdin)
addrdict[n] = str
if length(str) > 0
if str[end] == "\n"
Expand All @@ -760,7 +774,7 @@ function askmongocredentials!(;addrdict=Dict{AbstractString,AbstractString}() )
for n in need
info(n)
n == "mongoHost" && haskey(addrdict, "neo4jHost") ? print(string("[",addrdict["neo4jHost"],"]: ")) : nothing
str = readline(STDIN)
str = readline(stdin)
addrdict[n] = str
if length(str) > 0
if str[end] == "\n"
Expand Down Expand Up @@ -809,7 +823,7 @@ function consoleaskuserfordb(;nparticles=false, drawdepth=false, clearslamindb=f
n == "user" ? print("[]: ") : nothing
n == "robot" ? print("[]: ") : nothing
n == "multisession" ? print("comma separated list session names/[n]: ") : nothing
str = readline(STDIN)
str = readline(stdin)
addrdict[n] = str
if length(str) > 0
if str[end] == "\n"
Expand Down

0 comments on commit d2408c6

Please sign in to comment.