public void observation ( String info ) { // Parsing obs as JSON would be slower but less fragile than extracting the turn_key using string search. String pattern = "\"turn_key\":\"" ; int i = info . indexOf ( pattern ) ; String turnKey = "" ; if ( i != - 1 ) { turnKey = info . substring ( i + pattern . length ( ) , info . length ( ) - 1 ) ; turnKey = turnKey . substring ( 0 , turnKey . indexOf ( "\"" ) ) ; // TCPUtils.Log(Level.FINE, "Observation turn key: " + turnKey); } lock . lock ( ) ; try { if ( ! envState . turnKey . equals ( turnKey ) ) { // TCPUtils.Log(Level.FINE,"Update TK: [" + turnKey + "][" + turnKey + "]"); } if ( ! envState . lastTurnKey . equals ( turnKey ) ) { envState . turnKey = turnKey ; } envState . info = info ; cond . signalAll ( ) ; } finally { lock . unlock ( ) ; } }
Record a Malmo observation json - as the env info since an environment obs is a video frame .