Skip to content

Commit ca10d17

Browse files
authored
Merge pull request #14 from NavAbility/13_UpgradeDFG18
13 upgrade dfg18
2 parents 65143f1 + d43e6ab commit ca10d17

File tree

3 files changed

+26
-20
lines changed

3 files changed

+26
-20
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "navabilitysdk",
3-
"version": "0.2.0",
3+
"version": "0.3.0",
44
"description": "NavAbility SDK: Access NavAbility Cloud factor graph features from JavaScript. Note that this SDK and the related API are still in development. Please let us know if you have any issues at info@navability.io.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/navability/entities/Factor.ts

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const DFG_VERSION = '0.17.1';
1+
const DFG_VERSION = '0.18.0';
22
const PI = 3.14159;
33

44
export enum FactorType {
@@ -23,10 +23,10 @@ export type Factor = {
2323
label: string;
2424
nstime: string;
2525
fnctype: string;
26-
_variableOrderSymbols: string;
27-
data: string;
26+
_variableOrderSymbols: string[];
27+
data: FactorData;
2828
solvable: number;
29-
tags: string;
29+
tags: string[];
3030
timestamp: string;
3131
_version: string;
3232
};
@@ -47,7 +47,11 @@ function InitializeFactorData(): FactorData {
4747

4848
export function PriorPose2Data(xythetaPrior = [0.0, 0.0, 0.0], xythetaCovars = [0.01, 0.01, 0.01]): FactorData {
4949
const fnc = {
50-
str: `FullNormal(\ndim: 3\nμ: [${xythetaPrior[0]}, ${xythetaPrior[1]}, ${xythetaPrior[2]}]\nΣ: [${xythetaCovars[0]} 0.0 0.0; 0.0 ${xythetaCovars[1]} 0.0; 0.0 0.0 ${xythetaCovars[2]}])`,
50+
Z: {
51+
_type: 'IncrementalInference.PackedFullNormal',
52+
mu: xythetaPrior,
53+
cov: [xythetaCovars[0], 0.0, 0.0, 0.0, xythetaCovars[1], 0.0, 0.0, 0.0, xythetaCovars[2]],
54+
},
5155
};
5256
const data = InitializeFactorData();
5357
data.fnc = fnc;
@@ -57,9 +61,11 @@ export function PriorPose2Data(xythetaPrior = [0.0, 0.0, 0.0], xythetaCovars = [
5761

5862
export function Pose2Pose2Data(mus = [1, 0, 0.3333 * PI], sigmas = [0.01, 0.01, 0.01]): FactorData {
5963
const fnc = {
60-
datastr: `FullNormal(\ndim: 3\nμ: [${mus.join(', ')}]\nΣ: [${sigmas[0]} 0.0 0.0; 0.0 ${sigmas[1]} 0.0; 0.0 0.0 ${
61-
sigmas[2]
62-
}]\n)`,
64+
Z: {
65+
_type: 'IncrementalInference.PackedFullNormal',
66+
mu: mus,
67+
cov: [sigmas[0], 0.0, 0.0, 0.0, sigmas[1], 0.0, 0.0, 0.0, sigmas[2]],
68+
},
6369
};
6470
const data = InitializeFactorData();
6571
data.fnc = fnc;
@@ -68,14 +74,14 @@ export function Pose2Pose2Data(mus = [1, 0, 0.3333 * PI], sigmas = [0.01, 0.01,
6874
}
6975

7076
export function Pose2AprilTag4CornersData(
71-
id: string,
72-
corners: any,
73-
homography: any,
74-
K = [300.0, 0.0, 0.0, 0.0, 300.0, 0.0, 180.0, 120.0, 1.0],
75-
taglength = 0.25,
77+
id: number,
78+
corners: number[],
79+
homography: number[],
80+
K: number[] = [300.0, 0.0, 0.0, 0.0, 300.0, 0.0, 180.0, 120.0, 1.0],
81+
taglength: number = 0.25,
7682
): FactorData {
7783
const fnc = {
78-
mimeType: '/application/JuliaLang/PackedPose2AprilTag4Corners',
84+
_type: '/application/JuliaLang/PackedPose2AprilTag4Corners',
7985
corners,
8086
homography,
8187
K,
@@ -102,10 +108,10 @@ export function Factor(
102108
label,
103109
nstime: '0',
104110
fnctype: fncType,
105-
_variableOrderSymbols: JSON.stringify(variableOrderSymbols),
106-
data: JSON.stringify(data),
111+
_variableOrderSymbols: variableOrderSymbols,
112+
data,
107113
solvable: 1,
108-
tags: JSON.stringify(tags),
114+
tags,
109115
timestamp,
110116
_version: DFG_VERSION,
111117
};

0 commit comments

Comments
 (0)