代码之家  ›  专栏  ›  技术社区  ›  TrackerSB

bemang:VStates未排队

  •  1
  • TrackerSB  · 技术社区  · 6 年前

    我正在使用bemang.research,并使用Python3.6和客户端bemangpy与之通信。

    当前应用程序能够:

    • 开放式光束
    • 加载方案
    • 控制生成的车辆。

    但我在检索车辆的当前状态时遇到问题。当我发现vstate被正确请求时,bemangs queue收集这些请求结果的put方法被调用,但是队列保持为空,因此我无法获取当前的vstate。

    import time
    import beamngpy
    
    BEAMNG_BASEDIR = '<BeamNG_basedir>'
    BEAMNG_X64_BINARY = '<BeamNG_64bit_binary>'
    
    with beamngpy.beamng.BeamNGPy('localhost', 64256, userpath='<BeamNGUserpath>',
                                  binary=BEAMNG_X64_BINARY, console=True) as bpy:
        bpy.load_scenario('levels/west_coast_usa/scenarios/my_first_scenario.json')
        time.sleep(10)
        bpy.start_scenario()
        bpy.vcontrol({
            'throttle': 1.0,
            'steering': 0.5,
            'gear': 1
        })
    
        for _ in range(3):
            bpy.req_vstate(800, 600)
            time.sleep(1)
        for i, vstate in enumerate(bpy.poll_all()):
            vstate['img'].save(f'<outputPath>/{i:02}.png')
    

    编辑: 我意识到错误发生在bemang.research的一个lua文件中。 更准确地说 <beamNG_basedir>/lua/ge/extensions/util/researchAdapter.lua 180号线。 对…的呼唤 Engine.getColorBufferBase64(width, height) 失败,并显示以下消息。

    025.668|E|GameEngineLua:Exception|lua/ge/extensions//util/researchAdapter.lua:180: attempt to call field 'getColorBufferBase64' (a nil value)
    =============== Stack Traceback >> START >>
    (1) field C function 'getColorBufferBase64'
    (2) Lua upvalue 'getVehicleState' at file 'lua/ge/extensions//util/researchAdapter.lua:180'
      Local variables:
      width = number: 800
      height = number: 600
      state = table: 0x01e121142160  {clutch:0, rot:-111.05878753658, steering:-0, vel:table: 0x01e1143b6920 (more...)}
      vdata = table: 0x01e120efaaf8  {vel:vec3(-0.000107339,9.26956e-05,-8.04267e-05), active:true, dirVecUp:vec3(-0.00877159,0.00343826,0.999956) (more...)}
      (*temporary) = nil
      (*temporary) = number: 1.02085e-311
      (*temporary) = number: 800
      (*temporary) = number: 600
      (*temporary) = number: -0.933169
      (*temporary) = number: -0.359309
      (*temporary) = number: 1.02085e-311
      (*temporary) = number: -0.359309
      (*temporary) = number: 0
      (*temporary) = number: -1
      (*temporary) = string: "attempt to call field 'getColorBufferBase64' (a nil value)"
    (3) Lua local 'handler' at file 'lua/ge/extensions//util/researchAdapter.lua:220'
      Local variables:
      msg = table: 0x01e121049f10  {type:ReqVState, width:800, height:600}
      width = number: 800
      height = number: 600
    (4) Lua upvalue 'handleSocketInput' at file 'lua/ge/extensions//util/researchAdapter.lua:289'
      Local variables:
      message = table: 0x01e121049f10  {type:ReqVState, width:800, height:600}
      msgType = string: "handleReqVState"
      handler = Lua function 'handleReqVState' (defined at line 210 of chunk lua/ge/extensions//util/researchAdapter.lua)
    (5) Lua function 'onUpdate' at file 'lua/ge/extensions//util/researchAdapter.lua:310' (best guess)
      Local variables:
      dt = number: 0.0329248
    (6) Lua field 'hook' at file 'lua/common/extensions.lua:454'
      Local variables:
      func = string: "onUpdate"
      funcList = table: 0x01e1211f8780  {1:function: 0x01e11437dc98, 2:function: 0x01e11434a720, 3:function: 0x01e11426daf8 (more...)}
      (for index) = number: 5
      (for limit) = number: 12
      (for step) = number: 1
      i = number: 5
    (7) Lua function 'update' at file 'lua/ge/main.lua:362' (best guess)
      Local variables:
      dtReal = number: 0.0329248
      dtSim = number: 0.033
      dtRaw = number: 0.0329855
    --------------- << END <<
    
    0 回复  |  直到 5 年前