Closed agrignard closed 2 years ago
Ok so now i can run it, I remember seeing a layer where we could display or not the GAMA layers.
Here is what I have, not sure how to see the gama layer (even if it's a static one).
any error in browser dev console? you can also logging in bootstrap.js as usual js script
Ok so here is what I am doing after updating my local path in bootstrap.js
Form the terminal run GAMA like this
arno@wu-pers-03740 headless % bash gama-headless.sh -socket 8000
******************************************************************
* GAMA version 1.8.2 *
* http://gama-platform.org *
* (c) 2007-2022 UMI 209 UMMISCO IRD/SU & Partners *
******************************************************************
> GAMA: version 1.8.2 loading on____ macosx 12.2.1, x86_64, JDK 17.0.3
> JAI : ImageIO extensions loaded for____ jpg||tiff|bmp|gif|arx|tf8|TF8|png|ppm|jp2|tif|TIF|asc|TIFF|btf|BTF|pgm|wbmp|jpeg|pbm
> GAMA: msi.gama.core loaded in_____ 1029ms
> GAMA: simtools.gaml.extensions.physics loaded in_____ 13ms
> GAMA: msi.gama.lang.gaml loaded in_____ 2ms
> GAMA: ummisco.gama.opengl loaded in_____ 2ms
> GAMA: msi.gaml.extensions.fipa loaded in_____ 10ms
> GAMA: ummisco.gama.network loaded in_____ 6ms
> GAMA: ummisco.gama.java2d loaded in_____ 0ms
> GAMA: msi.gama.headless loaded in_____ 3ms
> GAMA: irit.gaml.extensions.database loaded in_____ 10ms
> GAMA: miat.gaml.extension.pedestrian loaded in_____ 13ms
> GAMA: ummisco.gaml.extensions.stats loaded in_____ 28ms
> GAMA: msi.gaml.architecture.simplebdi loaded in_____ 50ms
> GAMA: ummisco.gaml.extensions.maths loaded in_____ 73ms
> GAMA: espacedev.gaml.extensions.genstar loaded in_____ 5ms
> GAMA: simtools.gaml.extensions.traffic loaded in_____ 34ms
> GAMA: ummisco.gama.serialize loaded in_____ 5ms
> GAMA: all plugins loaded in_____ 1379ms
GAMA configuring and loading...
> GAMA: GAML artefacts built in______ 40ms
TEMP Directory is created
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#noProviders for further details.
Gama Listener started on port: 8000
Then launching VCity from /Users/arno/Projects/GitHub/UD_ReAgent_ABM/UD-Viz-GCCV
I get this
arno@wu-pers-03740 UD-Viz-GCCV % npm run debug
> app_name@1.0.0 debug
> cross-env NODE_ENV=development webpack serve
ℹ 「wds」: Project is running at http://localhost:8000/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /Users/arno/Projects/GitHub/UD_ReAgent_ABM/UD-Viz-GCCV
ℹ 「wdm」: Hash: cef02ba2a41dd6302313
Version: webpack 4.46.0
Time: 3988ms
Built at: 05/19/2022 12:45:00 PM
Asset Size Chunks Chunk Names
app_name.js 8.26 MiB main [emitted] main
app_name.js.map 8.74 MiB main [emitted] [dev] main
index.html 228 bytes [emitted]
Entrypoint main = app_name.js app_name.js.map
[0] multi (webpack)-dev-server/client?http://localhost:8000 (webpack)/hot/dev-server.js ./src/bootstrap.js 52 bytes {main} [built]
[./node_modules/debug/src/browser.js] 5.87 KiB {main} [built]
[./node_modules/itowns/lib/Main.js] 19.5 KiB {main} [built]
[./node_modules/strip-ansi/index.js] 161 bytes {main} [built]
[./node_modules/ud-viz/src/index.js] 1.3 KiB {main} [built]
[./node_modules/webpack-dev-server/client/index.js?http://localhost:8000] (webpack)-dev-server/client?http://localhost:8000 4.29 KiB {main} [built]
[./node_modules/webpack-dev-server/client/overlay.js] (webpack)-dev-server/client/overlay.js 3.52 KiB {main} [built]
[./node_modules/webpack-dev-server/client/socket.js] (webpack)-dev-server/client/socket.js 1.53 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/createSocketUrl.js] (webpack)-dev-server/client/utils/createSocketUrl.js 2.91 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/log.js] (webpack)-dev-server/client/utils/log.js 964 bytes {main} [built]
[./node_modules/webpack-dev-server/client/utils/reloadApp.js] (webpack)-dev-server/client/utils/reloadApp.js 1.59 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/sendMessage.js] (webpack)-dev-server/client/utils/sendMessage.js 402 bytes {main} [built]
[./node_modules/webpack/hot sync ^\.\/log$] (webpack)/hot sync nonrecursive ^\.\/log$ 170 bytes {main} [built]
[./node_modules/webpack/hot/dev-server.js] (webpack)/hot/dev-server.js 1.59 KiB {main} [built]
[./src/bootstrap.js] 7.47 KiB {main} [built]
+ 1118 hidden modules
Child HtmlWebpackCompiler:
Asset Size Chunks Chunk Names
__child-HtmlWebpackPlugin_0 4.6 KiB HtmlWebpackPlugin_0 HtmlWebpackPlugin_0
Entrypoint HtmlWebpackPlugin_0 = __child-HtmlWebpackPlugin_0
[./node_modules/html-webpack-plugin/lib/loader.js!./node_modules/html-webpack-plugin/default_index.ejs] 455 bytes {HtmlWebpackPlugin_0} [built]
ℹ 「wdm」: Compiled successfully.
But then when trying to open a local browser (http://localhost:8000/)
I get this error
404 WebSocket Upgrade Failure
it missing a last thing commited in gama core: crs specification in output command. i push the code. Otherwise, why do you use the same port 8000 for all things? it must distingue npm web with websocket port, or you will blow your mind.
I can make it work now (indeed was not a good idea to put everything on 8000)
However I get this issue from the console
And the error from GAMA
/Users/arno/Projects/GitHub/UD_ReAgent_ABM/ReAgent/models/Gratte_Ciel_Basic.gaml
GratteCielErasme
java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "msi.gama.util.IMap.get(Object)" is null
at msi.gama.headless.listener.GamaWebSocketServer.onMessage(GamaWebSocketServer.java:130)
at org.java_websocket.server.WebSocketServer.onWebsocketMessage(WebSocketServer.java:712)
at org.java_websocket.drafts.Draft_6455.processFrameText(Draft_6455.java:986)
at org.java_websocket.drafts.Draft_6455.processFrame(Draft_6455.java:910)
at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:401)
at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:233)
at org.java_websocket.server.WebSocketServer$WebSocketWorker.doDecode(WebSocketServer.java:1114)
at org.java_websocket.server.WebSocketServer$WebSocketWorker.run(WebSocketServer.java:1086)
org.java_websocket.WebSocketImpl@5bf72566 has left the room!
0:0:0:0:0:0:0:1 entered the room!
/Users/arno/Projects/GitHub/UD_ReAgent_ABM/ReAgent/models/Gratte_Ciel_Basic.gaml
GratteCielErasme
java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "msi.gama.util.IMap.get(Object)" is null
at msi.gama.headless.listener.GamaWebSocketServer.onMessage(GamaWebSocketServer.java:130)
at org.java_websocket.server.WebSocketServer.onWebsocketMessage(WebSocketServer.java:712)
at org.java_websocket.drafts.Draft_6455.processFrameText(Draft_6455.java:986)
at org.java_websocket.drafts.Draft_6455.processFrame(Draft_6455.java:910)
at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:401)
at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:233)
at org.java_websocket.server.WebSocketServer$WebSocketWorker.doDecode(WebSocketServer.java:1114)
at org.java_websocket.server.WebSocketServer$WebSocketWorker.run(WebSocketServer.java:1086)
the getting of output (people) is too soon, when there was no people , i guess
mmm I see , but it used to work isn't it?
in fact , line 130
did you have all things in launch cmd?
The exception is relate with launch command, not output. You're sure everything is clean and well-formed json?
THis is what I have in eclipse but I am running the RC headless
try {
launchGamlSimulation(socket,
Arrays.asList("-gaml", ".", map.get("experiment").toString(), map.get("model").toString()),
(GamaJsonList) map.get("parameters"),
map.get("until") != null ? map.get("until").toString() : "");
} catch (IOException | GamaHeadlessException e) {
shoudl I run it from Eclipse? I thin it's the same version as the RC isn't it?
I did'nt change the cmd except my path. Is it working on yours? I am just trying to make it rework as it was in Hanoi last Friday
Dont know which rc, it is obviously that it require eclipse for this quick development. i have also some to be committed soon
The only one so far https://github.com/gama-platform/gama/releases/tag/1.8.2-RC1
I can try form eclispe however when I am running the msi.gama.headless.id4.launch product I got this error now
Cannot locate JRE definition: "jdk-17.0.1". Launch aborted.
open run configuration then run once
Ok... I can finally run it. I thought it could run from the Release.
So we are back to where we stopped in Hanoi where we can see the agent in a static mode below the building
Cam On Em!
Ok so now it seems to work not too bad for few iteration (the point are actually moving as they should) however after few iteration here is the error produced
java.lang.IllegalArgumentException: Points of LinearRing do not form a closed linestring
at org.locationtech.jts.geom.LinearRing.validateConstruction(LinearRing.java:93)
at org.locationtech.jts.geom.LinearRing.<init>(LinearRing.java:88)
at org.locationtech.jts.geom.GeometryFactory.createLinearRing(GeometryFactory.java:382)
at org.locationtech.jts.geom.util.GeometryEditor$CoordinateSequenceOperation.edit(GeometryEditor.java:327)
at org.locationtech.jts.geom.util.GeometryEditor.editInternal(GeometryEditor.java:160)
at org.locationtech.jts.geom.util.GeometryEditor.edit(GeometryEditor.java:133)
at org.locationtech.jts.geom.util.GeometryEditor.editPolygon(GeometryEditor.java:178)
at org.locationtech.jts.geom.util.GeometryEditor.editInternal(GeometryEditor.java:152)
at org.locationtech.jts.geom.util.GeometryEditor.edit(GeometryEditor.java:133)
at org.locationtech.jts.geom.GeometryFactory.createGeometry(GeometryFactory.java:664)
at msi.gama.metamodel.topology.projection.Projection.inverseTransform(Projection.java:144)
at msi.gama.headless.common.SaveHelper.buildFeature(SaveHelper.java:223)
at msi.gama.headless.common.SaveHelper.buildGeoJSon(SaveHelper.java:323)
at msi.gama.headless.listener.GamaWebSocketServer.onMessage(GamaWebSocketServer.java:205)
at org.java_websocket.server.WebSocketServer.onWebsocketMessage(WebSocketServer.java:712)
at org.java_websocket.drafts.Draft_6455.processFrameText(Draft_6455.java:986)
at org.java_websocket.drafts.Draft_6455.processFrame(Draft_6455.java:910)
at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:401)
at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:233)
at org.java_websocket.server.WebSocketServer$WebSocketWorker.doDecode(WebSocketServer.java:1114)
at org.java_websocket.server.WebSocketServer$WebSocketWorker.run(WebSocketServer.java:1086)
Java error: illegal argument
at msi.gama.runtime.exceptions.GamaRuntimeException.create(GamaRuntimeException.java:72)
at msi.gama.headless.common.SaveHelper.buildGeoJSon(SaveHelper.java:336)
at msi.gama.headless.listener.GamaWebSocketServer.onMessage(GamaWebSocketServer.java:205)
at org.java_websocket.server.WebSocketServer.onWebsocketMessage(WebSocketServer.java:712)
at org.java_websocket.drafts.Draft_6455.processFrameText(Draft_6455.java:986)
at org.java_websocket.drafts.Draft_6455.processFrame(Draft_6455.java:910)
at org.java_websocket.WebSocketImpl.decodeFrames(WebSocketImpl.java:401)
at org.java_websocket.WebSocketImpl.decode(WebSocketImpl.java:233)
at org.java_websocket.server.WebSocketServer$WebSocketWorker.doDecode(WebSocketServer.java:1114)
at org.java_websocket.server.WebSocketServer$WebSocketWorker.run(WebSocketServer.java:1086)
Caused by: java.lang.IllegalArgumentException: Points of LinearRing do not form a closed linestring
at org.locationtech.jts.geom.LinearRing.validateConstruction(LinearRing.java:93)
at org.locationtech.jts.geom.LinearRing.<init>(LinearRing.java:88)
at org.locationtech.jts.geom.GeometryFactory.createLinearRing(GeometryFactory.java:382)
at org.locationtech.jts.geom.util.GeometryEditor$CoordinateSequenceOperation.edit(GeometryEditor.java:327)
at org.locationtech.jts.geom.util.GeometryEditor.editInternal(GeometryEditor.java:160)
at org.locationtech.jts.geom.util.GeometryEditor.edit(GeometryEditor.java:133)
at org.locationtech.jts.geom.util.GeometryEditor.editPolygon(GeometryEditor.java:178)
at org.locationtech.jts.geom.util.GeometryEditor.editInternal(GeometryEditor.java:152)
at org.locationtech.jts.geom.util.GeometryEditor.edit(GeometryEditor.java:133)
at org.locationtech.jts.geom.GeometryFactory.createGeometry(GeometryFactory.java:664)
at msi.gama.metamodel.topology.projection.Projection.inverseTransform(Projection.java:144)
at msi.gama.headless.common.SaveHelper.buildFeature(SaveHelper.java:223)
at msi.gama.headless.common.SaveHelper.buildGeoJSon(SaveHelper.java:323)
... 8 more
i have this too, no idea , may be the conversion must take time but the request is too fast
The weird thing is that it doesn't happen when running the gama.client/JavaScript/index.html
with this same model
at msi.gama.headless.common.SaveHelper.buildGeoJSon(SaveHelper.java:336)
it means you are not IN ha noi anymore ;)
@hqnghi88 do you have any idea why this bug is happening in GAMA? Is the client sending bad cmd to the server?
is it a bug related to server or to the client? Should I post an issue on GAMA?
it is gama server, obviously, as it is experimental, but i have no time this week to review it, i will do it next week. You can post the issue on gama.
Ok so i created and issue on GAMA related to this here https://github.com/gama-platform/gama/issues/3433
Let me know how I can help here
@hqnghi88 do you now why there is so many coordinates for only one agent?
When I run a model with one agent and I print the messae received this is what OI have
{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[1846068.0670822521,5175624.567827932,0.0],[1846068.028652813,5175624.177647287,0.0],[1846067.9148413173,5175623.802461066,0.0],[1846067.7300214767,5175623.456687465,0.0],[1846067.4812958145,5175623.153614369,0.0],[1846067.1782227182,5175622.904888706,0.0],[1846066.8324491172,5175622.720068866,0.0],[1846066.4572628962,5175622.606257371,0.0],[1846066.067082252,5175622.567827932,0.0],[1846065.676901608,5175622.606257371,0.0],[1846065.3017153875,5175622.720068866,0.0],[1846064.9559417863,5175622.904888706,0.0],[1846064.6528686895,5175623.153614369,0.0],[1846064.4041430275,5175623.456687465,0.0],[1846064.2193231871,5175623.802461066,0.0],[1846064.1055116917,5175624.177647287,0.0],[1846064.0670822521,5175624.567827932,0.0],[1846064.1055116917,5175624.958008575,0.0],[1846064.2193231871,5175625.333194796,0.0],[1846064.4041430275,5175625.678968397,0.0],[1846064.6528686895,5175625.982041494,0.0],[1846064.9559417863,5175626.230767156,0.0],[1846065.3017153875,5175626.415586996,0.0],[1846065.676901608,5175626.529398492,0.0],[1846066.067082252,5175626.567827932,0.0],[1846066.4572628962,5175626.529398492,0.0],[1846066.8324491172,5175626.415586996,0.0],[1846067.1782227182,5175626.230767156,0.0],[1846067.4812958145,5175625.982041494,0.0],[1846067.7300214767,5175625.678968397,0.0],[1846067.9148413173,5175625.333194796,0.0],[1846068.028652813,5175624.958008575,0.0],[1846068.0670822521,5175624.567827932,0.0]]]},"properties":{},"id":"0"}]}
It seems that we have many value of the 'almost' same coordinate?
A workaround has been proposed by @hqnghi88 in https://github.com/gama-platform/gama/commit/6f431c0929b7813385ddb9d097f774a81b750ae8
To be tested
Even though this issue is still open on the gama side (but with a working workaround) https://github.com/gama-platform/gama/issues/3433 we can considered this one closed as the proof of concept is now operational
We are starting the development of GAMA2.0 that will give the possibility to make the communication though WebSocket between GAMA and any web client (including UD_VIZ).
The task has been starting during the Coding Camp 2022 mainly with the help of @hqnghi88 (see for instance https://github.com/gama-platform/gama/commits?author=hqnghi88)(see https://github.com/gama-platform/gama/issues/3372) and we now start to have some promising preliminary results to display in realtime a simulation in a Web Client.
Here is a first proof of concept plugin Gama and a generic MapBox.
Next step are: