Skip to content

Commit deccef6

Browse files
authored
Merge pull request #233 from NavAbility/23Q2/maint/cleanup_v0.6
Use P1 and cleanup
2 parents fe1f705 + 0f42cf6 commit deccef6

18 files changed

+282
-135
lines changed

.JuliaFormatter.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ long_to_short_function_def = true
1010
always_use_return = false
1111
whitespace_in_kwargs = true #
1212
annotate_untyped_fields_with_any = true #
13-
conditional_to_if = true
13+
conditional_to_if = false
1414
separate_kwargs_with_semicolon = true
1515
format_docstrings = true

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
Manifest.toml
2+
3+
autoschemas/
4+
dev/

sandbox/AlternateAPICalls.jl

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
GQL_GET_VARIABLE2 = """
2+
$(GQL_FRAGMENT_VARIABLES)
3+
query get_variables(
4+
\$userLabel: String!
5+
\$robotLabel: String!
6+
\$sessionLabel: String!
7+
\$variableLabel: String!
8+
\$fields_summary: Boolean! = true
9+
\$fields_full: Boolean! = true
10+
) {
11+
variables(
12+
where: {
13+
userLabel: \$userLabel
14+
robotLabel: \$robotLabel
15+
sessionLabel: \$sessionLabel
16+
label: \$variableLabel
17+
}
18+
) {
19+
...variable_skeleton_fields
20+
...variable_summary_fields @include(if: \$fields_summary)
21+
...variable_full_fields @include(if: \$fields_full)
22+
}
23+
}
24+
"""
25+
26+
GQL_GET_VARIABLES2 = """
27+
$(GQL_FRAGMENT_VARIABLES)
28+
query get_variables(
29+
\$userLabel: String!
30+
\$robotLabel: String!
31+
\$sessionLabel: String!
32+
\$fields_summary: Boolean! = true
33+
\$fields_full: Boolean! = true
34+
) {
35+
variables(
36+
where: {
37+
userLabel: \$userLabel
38+
robotLabel: \$robotLabel
39+
sessionLabel: \$sessionLabel
40+
}
41+
) {
42+
...variable_skeleton_fields
43+
...variable_summary_fields @include(if: \$fields_summary)
44+
...variable_full_fields @include(if: \$fields_full)
45+
}
46+
}
47+
"""
48+
49+
function getVariable2(fgclient::DFGClient, label::Symbol)
50+
variables = Dict(
51+
"userLabel" => fgclient.user.label,
52+
"robotLabel" => fgclient.robot.label,
53+
"sessionLabel" => fgclient.session.label,
54+
"variableLabel" => string(label),
55+
"fields_summary" => true,
56+
"fields_full" => true,
57+
)
58+
59+
response = GQL.execute(
60+
fgclient.client,
61+
GQL_GET_VARIABLE2,
62+
Vector{Variable};
63+
variables,
64+
throw_on_execution_error = true,
65+
)
66+
return response.data["variables"][1]
67+
end
68+
69+
function getVariablesSkeleton2(fgclient::DFGClient)#, label::Symbol)
70+
variables = Dict(
71+
"userLabel" => fgclient.user.label,
72+
"robotLabel" => fgclient.robot.label,
73+
"sessionLabel" => fgclient.session.label,
74+
"fields_summary" => false,
75+
"fields_full" => false,
76+
)
77+
78+
response = GQL.execute(
79+
fgclient.client,
80+
GQL_GET_VARIABLES2,
81+
Vector{DFG.SkeletonDFGVariable};
82+
variables,
83+
throw_on_execution_error = true,
84+
)
85+
return response.data["variables"]
86+
end

src/NavAbilityClient.jl

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,26 @@ function DFGClient(client::GQL.Client, context::Context)
1818
)
1919
end
2020

21+
function DFGClient(
22+
userLabel::String,
23+
robotLabel::String,
24+
sessionLabel::String;
25+
apiUrl::String = "https://api.navability.io",
26+
auth_token::String = "",
27+
authorize::Bool = 0 !== length(auth_token),
28+
addRobotIfNotExists = false,
29+
addSessionIfNotExists = false,
30+
)
31+
return DFGClient(
32+
NavAbilityClient(apiUrl; auth_token, authorize),
33+
userLabel,
34+
robotLabel,
35+
sessionLabel;
36+
addRobotIfNotExists,
37+
addSessionIfNotExists,
38+
)
39+
end
40+
2141
function DFGClient(
2242
client::GQL.Client,
2343
userLabel::String,
@@ -58,7 +78,7 @@ function Base.show(io::IO, ::MIME"text/plain", c::DFGClient)
5878
end
5979

6080
function NavAbilityClient(
61-
apiUrl::String = "https://api.d1.navability.io";
81+
apiUrl::String = "https://api.navability.io";
6282
auth_token::String = "",
6383
authorize::Bool = 0 !== length(auth_token),
6484
kwargs...,

src/NavAbilitySDK.jl

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ using DistributedFactorGraphs.ProgressMeter
1717

1818
import GraphQLClient as GQL
1919

20-
# explicitly use any DFG function to make it easier if it needs to be removed
2120
import DistributedFactorGraphs as DFG
2221
using DistributedFactorGraphs:
23-
Variable, PackedVariableNodeData, MeanMaxPPE, BlobEntry, PackedFactor, hasBlob
22+
Variable, PackedVariableNodeData, MeanMaxPPE, BlobEntry, PackedFactor, hasBlob,
23+
getBlobStore
2424

2525
import DistributedFactorGraphs:
2626
getFactor,
@@ -55,9 +55,11 @@ import DistributedFactorGraphs:
5555
getBlob,
5656
addBlob!,
5757
deleteBlob!,
58+
hasBlob,
5859
exists,
5960
getNeighbors,
6061
findVariableNearTimestamp
62+
# To consider implementing
6163
# setSolverParams!,
6264
# getSolverParams,
6365
# getAddHistory,
@@ -76,11 +78,6 @@ import DistributedFactorGraphs:
7678
# copyGraph!,
7779
# getBiadjacencyMatrix,
7880

79-
# # LinearAlgebra pass through exports
80-
# export diagm, norm
81-
# # UUIDs pass through exports
82-
# export uuid4
83-
8481
# Graphql
8582
include("graphql/BlobEntry.jl")
8683
include("graphql/UserRobotSession.jl")
@@ -90,6 +87,7 @@ include("graphql/BlobStore.jl")
9087

9188
include("entities/Distributions.jl")
9289
include("entities/InferenceTypes.jl")
90+
include("entities/VariableTypes.jl")
9391
include("entities/UserRobotSession.jl")
9492
include("entities/Variable.jl")
9593
include("entities/Factor.jl")
@@ -111,12 +109,30 @@ include("services/AsyncCalls.jl")
111109

112110
include("Deprecated.jl")
113111

114-
export NavAbilityClient, DFGClient, NavAbilityBlobStore
112+
# LinearAlgebra pass through exports
113+
export I, diagm, norm
114+
115+
# UUIDs pass through exports
116+
export UUID, uuid4
117+
118+
# DFG poss through exports
119+
export getBlobStore
120+
121+
# Type exports
122+
export NavAbilityClient,
123+
DFGClient,
124+
NavAbilityBlobStore,
125+
Variable,
126+
Factor,
127+
MeanMaxPPE,
128+
BlobEntry,
129+
FactorData,
130+
PackedVariableNodeData,
131+
PackedFactor
115132

116-
export addVariables!
117-
#DFG exports
118-
export
119-
addRobot!,
133+
134+
# Function exports
135+
export addRobot!,
120136
addSession!,
121137
deleteSession!,
122138
deleteRobot!,
@@ -136,6 +152,7 @@ export
136152
getVariablesSummary,
137153
getVariablesSkeleton,
138154
addVariable!,
155+
addVariables!,
139156
updateVariable!,
140157
deleteVariable!,
141158
listVariables,
@@ -158,6 +175,7 @@ export
158175
updateBlobEntry!,
159176
deleteBlobEntry!,
160177
getSessionBlobEntry,
178+
getSessionBlobEntries,
161179
addSessionBlobEntries!,
162180
listSessionBlobEntries,
163181
getBlob,
@@ -170,30 +188,15 @@ export
170188
listFactorNeighbors,
171189
findVariableNearTimestamp
172190

173-
export Variable, Factor, MeanMaxPPE, BlobEntry
174-
175-
#exports
176-
# export NavAbilityClient, NavAbilityWebsocketClient, NavAbilityHttpsClient, QueryOptions, MutationOptions
177-
# export Client, Scope
178-
# export QueryDetail, LABEL, SKELETON, SUMMARY, FULL
191+
#old exports
179192
# export Distribution, Normal, Rayleigh, FullNormal, Uniform, Categorical
180193
# export ManifoldKernelDensity
181-
# export Variable
182-
# export FactorData, PriorData, PriorPose2Data, PriorPoint2Data, LinearRelativeData, Pose2Pose2Data, Pose2AprilTag4CornersData, Pose2Point2BearingRangeData, Point2Point2RangeData, MixtureData
183194
# export PriorPose3, Pose3Pose3
184-
# export ScatterAlignPose2Data
185-
# export FactorType, Factor
186195
# export SolveOptions
187196
# export SessionKey, SessionId, ExportSessionInput, ExportSessionOptions
188-
189-
# export getVariable, getVariables, listVariables, ls
190-
# export addVariable, updateVariable, addVariablePacked, updateVariablePacked, addPackedVariable, addPackedVariableOld
191-
# export getFactor, getFactors, listFactors, lsf
192-
# export addFactor, addPackedFactor, deleteFactor
197+
# export ls
198+
# export lsf
193199
# export initVariable
194-
# export listBlobEntries
195-
# export getBlobEntry, getBlob
196-
# export addBlobEntry, addBlob
197200
# export solveSession, solveFederated
198201
# export getStatusMessages, getStatusLatest, getStatusesLatest
199202
# export waitForCompletion

src/entities/InferenceTypes.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ end
3131

3232
@nvaZInferenceType PriorPoint3
3333
@nvaZInferenceType PriorPose3
34+
@nvaZInferenceType PriorPose3XYYaw
3435
@nvaZInferenceType Pose3Pose3
3536
@nvaZInferenceType Pose3Pose3Rotation
3637

src/entities/VariableTypes.jl

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
abstract type VariableType end
2+
3+
macro defSDKVariable(modulename, structname)
4+
return esc(quote
5+
Base.@__doc__ struct $structname <: VariableType end
6+
Base.string(::Type{$structname}) = $modulename*"."*string(nameof($structname))
7+
end)
8+
end
9+
10+
11+
"""
12+
$(TYPEDEF)
13+
General 1 dimensional variable.
14+
"""
15+
@defSDKVariable "IncrementalInference" ContinuousScalar
16+
17+
"""
18+
$(TYPEDEF)
19+
XY Euclidean manifold variable.
20+
"""
21+
@defSDKVariable "RoME" Point2
22+
23+
"""
24+
$(TYPEDEF)
25+
XYZ Euclidean manifold variable..
26+
"""
27+
@defSDKVariable "RoME" Point3
28+
29+
"""
30+
$(TYPEDEF)
31+
SpecialEuclidean(2) manifold, two Euclidean translations and one Circular rotation, used for general 2D SLAM.
32+
"""
33+
@defSDKVariable "RoME" Pose2
34+
35+
"""
36+
$(TYPEDEF)
37+
SpecialEuclidean(3) manifold used for 3D SLAM.
38+
"""
39+
@defSDKVariable "RoME" Pose3

src/graphql/BlobEntry.jl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,26 @@ query getSessionBlobEntry(
170170
}
171171
"""
172172

173+
GQL_GET_SESSION_BLOBENTRIES = """
174+
$(GQL_FRAGMENT_BLOBENTRY)
175+
query getSessionBlobEntries(
176+
\$userLabel: EmailAddress!
177+
\$robotLabel: String!
178+
\$sessionLabel: String!
179+
\$startwith: String
180+
) {
181+
users(where: { label: \$userLabel }) {
182+
robots(where: { label: \$robotLabel }) {
183+
sessions(where: { label: \$sessionLabel }) {
184+
blobEntries(where: { label_STARTS_WITH: \$startwith }) {
185+
...blobEntry_fields
186+
}
187+
}
188+
}
189+
}
190+
}
191+
"""
192+
173193
# GQL_UPDATE_BLOBENTRY = """
174194
# $(GQL_FRAGMENT_BLOBENTRY)
175195
# mutation updateBlobEntry(\$blobEntry: BlobEntryUpdateInput!, \$uniqueKey: String!) {

0 commit comments

Comments
 (0)