Toggle navigation
Toggle navigation
This project
Loading...
Sign in
arcs
/
arcs.js
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
3
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jean-Yves Didier
2017-07-17 12:07:41 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
72ddb5de3384469b97c79ac34c6c6482c03bac82
72ddb5de
1 parent
75174019
corrected bug in component instanciation from url
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
49 additions
and
16 deletions
build/arcs.js
build/arcs.min.js
components/geojson.js
components/gpsinertialpose.js
src/context.js
src/statemachine.js
tests/pipe/arcsapp.json
tests/pipe/pipe.html
build/arcs.js
View file @
72ddb5d
...
...
@@ -295,10 +295,12 @@ ARCS.Context = function( ctx ) {
if
(
this
.
status
>=
200
&&
this
.
status
<
300
)
{
resolve
(
JSON
.
parse
(
this
.
responseText
));
}
else
{
console
.
error
(
this
.
statusText
);
reject
(
this
.
statusText
);
}
};
client
.
onerror
=
function
()
{
console
.
error
(
this
.
statusText
);
reject
(
this
.
statusText
);
};
});
...
...
@@ -350,6 +352,7 @@ ARCS.Context = function( ctx ) {
instanciateComponents
=
function
()
{
var
p
,
promises
=
[];
console
.
log
(
components
);
for
(
p
in
components
)
{
if
(
components
.
hasOwnProperty
(
p
))
{
...
...
@@ -359,18 +362,23 @@ ARCS.Context = function( ctx ) {
return
;
}
factory
=
factories
[
components
[
p
].
type
];
//console.log("instanciating ", p);
try
{
if
(
components
[
p
].
value
!==
undefined
||
components
[
p
].
url
!==
undefined
||
components
[
p
].
ref
!==
undefined
)
{
if
(
components
[
p
].
value
!==
undefined
)
{
console
.
log
(
"instanciating "
,
p
);
components
[
p
].
instance
=
new
factory
(
components
[
p
].
value
);
}
if
(
components
[
p
].
url
!==
undefined
)
{
promises
.
push
(
loadDataFile
(
components
[
p
].
url
).
then
(
function
(
obj
)
{
// we need currying here !
var
delayInstanciation
=
function
(
p
,
factory
)
{
return
function
(
obj
)
{
components
[
p
].
instance
=
new
factory
(
obj
);
})
return
Promise
.
resolve
();
}
};
promises
.
push
(
loadDataFile
(
components
[
p
].
url
).
then
(
delayInstanciation
(
p
,
factory
))
);
}
if
(
components
[
p
].
ref
!==
undefined
)
{
...
...
@@ -1854,6 +1862,7 @@ ARCS.Statemachine = new ARCS.Component.create(function (obj) {
* the initial state (by default, it is the departure of the first transition
*/
this
.
start
=
function
()
{
console
.
log
(
"statemachine"
,
this
,
initial
,
obj
);
setSheet
(
initial
);
};
...
...
build/arcs.min.js
View file @
72ddb5d
This diff is collapsed. Click to expand it.
components/geojson.js
View file @
72ddb5d
arcs_module
(
function
(
ARCS
,
three
)
{
var
PipeNetwork
=
ARCS
.
Component
.
create
(
function
(
jsonData
)
{
console
.
log
(
"instanciating pipe network"
);
var
pipeNetwork
=
new
THREE
.
Object3D
();
var
X_OFFSET
=
0
;
// 2.428592;
var
Y_OFFSET
=
0
;
// 48.613426;
...
...
components/gpsinertialpose.js
View file @
72ddb5d
arcs_module
(
function
(
ARCS
)
{
var
GPSInertialPose
=
new
ARCS
.
Component
(
var
GPSInertialPose
=
new
ARCS
.
Component
.
create
(
function
()
{
var
id
=
0
;
var
pose
=
{
...
...
src/context.js
View file @
72ddb5d
...
...
@@ -63,10 +63,12 @@ ARCS.Context = function( ctx ) {
if
(
this
.
status
>=
200
&&
this
.
status
<
300
)
{
resolve
(
JSON
.
parse
(
this
.
responseText
));
}
else
{
console
.
error
(
this
.
statusText
);
reject
(
this
.
statusText
);
}
};
client
.
onerror
=
function
()
{
console
.
error
(
this
.
statusText
);
reject
(
this
.
statusText
);
};
});
...
...
@@ -118,6 +120,7 @@ ARCS.Context = function( ctx ) {
instanciateComponents
=
function
()
{
var
p
,
promises
=
[];
console
.
log
(
components
);
for
(
p
in
components
)
{
if
(
components
.
hasOwnProperty
(
p
))
{
...
...
@@ -127,18 +130,23 @@ ARCS.Context = function( ctx ) {
return
;
}
factory
=
factories
[
components
[
p
].
type
];
//console.log("instanciating ", p);
try
{
if
(
components
[
p
].
value
!==
undefined
||
components
[
p
].
url
!==
undefined
||
components
[
p
].
ref
!==
undefined
)
{
if
(
components
[
p
].
value
!==
undefined
)
{
console
.
log
(
"instanciating "
,
p
);
components
[
p
].
instance
=
new
factory
(
components
[
p
].
value
);
}
if
(
components
[
p
].
url
!==
undefined
)
{
promises
.
push
(
loadDataFile
(
components
[
p
].
url
).
then
(
function
(
obj
)
{
// we need currying here !
var
delayInstanciation
=
function
(
p
,
factory
)
{
return
function
(
obj
)
{
components
[
p
].
instance
=
new
factory
(
obj
);
})
return
Promise
.
resolve
();
}
};
promises
.
push
(
loadDataFile
(
components
[
p
].
url
).
then
(
delayInstanciation
(
p
,
factory
))
);
}
if
(
components
[
p
].
ref
!==
undefined
)
{
...
...
src/statemachine.js
View file @
72ddb5d
...
...
@@ -146,6 +146,7 @@ ARCS.Statemachine = new ARCS.Component.create(function (obj) {
* the initial state (by default, it is the departure of the first transition
*/
this
.
start
=
function
()
{
console
.
log
(
"statemachine"
,
this
,
initial
,
obj
);
setSheet
(
initial
);
};
...
...
tests/pipe/arcsapp.json
View file @
72ddb5d
...
...
@@ -17,7 +17,7 @@
"gps"
:
{
"type"
:
"GeoLocator"
},
"inertial"
:
{
"type"
:
"Inertial"
},
"fuser"
:
{
"type"
:
"GPSInertialPose"
},
"pipeNetwork"
:
{
"type"
:
"PipeNetwork"
,
"
file"
:
"tests/pipe
/Conduites_UFRST.geojson"
},
"pipeNetwork"
:
{
"type"
:
"PipeNetwork"
,
"
url"
:
".
/Conduites_UFRST.geojson"
},
"video"
:
{
"type"
:
"VideoSource"
},
"statemachine"
:
{
"type"
:
"StateMachine"
,
...
...
@@ -41,13 +41,13 @@
{
"destination"
:
"fuser"
,
"slot"
:
"setId"
,
"value"
:
[
17
]
},
{
"destination"
:
"viewer"
,
"slot"
:
"setSceneId"
,
"value"
:
[
17
]
},
{
"destination"
:
"inertial"
,
"slot"
:
"start"
,
"value"
:
[]
},
{
"destination"
:
"gps"
,
"slot"
:
"watchPosition"
,
"value"
:
[]
}
,
{
"destination"
:
"gps"
,
"slot"
:
"watchPosition"
,
"value"
:
[]
}
],
"postconnections"
:
[
{
"destination"
:
"pipeNetwork"
,
"slot"
:
"init"
,
"value"
:
[]
}
],
"connections"
:
[
{
"destination"
:
"viewer"
,
"slot"
:
"addScene"
,
"source"
:
"pipeNetwork"
,
"signal"
:
"sendSceneGraph"
}
{
"destination"
:
"viewer"
,
"slot"
:
"addScene"
,
"source"
:
"pipeNetwork"
,
"signal"
:
"sendSceneGraph"
}
,
{
"destination"
:
"statemachine"
,
"slot"
:
"next"
,
"source"
:
"pipeNetwork"
,
"signal"
:
"sendSceneGraph"
}
],
"cleanups"
:
[
...
...
@@ -55,17 +55,19 @@
},
"start"
:
{
"preconnections"
:
[
],
"postconnections"
:
[
{
"destination"
:
"viewer"
,
"slot"
:
"viewAll"
,
"value"
:
[]},
{
"destination"
:
"animator"
,
"slot"
:
"start"
,
"value"
:[]}
],
"postconnections"
:
[],
"connections"
:
[
{
"source"
:
"windowresize"
,
"signal"
:
"onResize"
,
"destination"
:
"viewer"
,
"slot"
:
"setSize"
},
{
"source"
:
"animator"
,
"signal"
:
"onAnimationFrame"
,
"destination"
:
"video"
,
"slot"
:
"grabFrame"
},
{
"source"
:
"animator"
,
"signal"
:
"onAnimationFrame"
,
"destination"
:
"viewer"
,
"slot"
:
"render"
},
{
"source"
:
"video"
,
"signal"
:
"onReady"
,
"destination"
:
"viewer"
,
"slot"
:
"resetCamera"
},
{
"source"
:
"gps"
,
"signal"
:
"sendCoordinates"
,
"destination"
:
"fuser"
,
"slot"
:
"setPosition"
},
{
"source"
:
"inertial"
,
"signal"
:
"sendOrientation"
,
"destination"
:
"fuser"
,
"slot"
:
"se
ndPosi
tion"
},
{
"source"
:
"inertial"
,
"signal"
:
"sendOrientation"
,
"destination"
:
"fuser"
,
"slot"
:
"se
tOrienta
tion"
},
{
"source"
:
"fuser"
,
"signal"
:
"sendPose"
,
"destination"
:
"viewer"
,
"slot"
:
"setExtrinsics"
}
],
"cleanups"
:
[]
...
...
tests/pipe/pipe.html
View file @
72ddb5d
...
...
@@ -13,6 +13,17 @@
</head>
<body>
<video
id=
"video"
width=
320
height=
240
autoplay=
"true"
loop=
"true"
style=
"display: none;"
>
</video>
<canvas
id=
"canvas"
></canvas>
<div
id=
"container"
></div>
<div
id=
"contents"
>
<!-- div id="console">
<div style="float: right; font-size: 150%; padding:0; margin:0;" onclick="document.getElementById('output').classList.toggle('hide');">⚙</div>
<p id="output">Console log:<br/></p>
</div -->
<a
id=
"logo"
href=
"http://arcs.ibisc.univ-evry.fr"
><img
src=
"../../docs/arcs_logo.png"
alt=
"ARCS"
/></a>
</div>
</body>
...
...
Please
register
or
login
to post a comment