JSON data

 

I have project, where I get 19 frames of data. 0 to 19. Where the last frame reaches the value where I must import the 3D object within the Scenario. Json will be constantly updated. What is the best way for me to export this data to the project via Aximmetry?

I used an example in the tutorials, but I can't point export to the data and even creating an update, the data doesn't change, only in the first connection. The UE Project only sends Y. If you can help me, I'm a few days away. Some process I'm skipping and would like help.


   ricardoldavid

 
Profile Image
Eifert@Aximmetry
  -  

Hi,

This is an Integer data type:

You can see a pin's data type at the bottom left cornet in the Flow Editor when you hover your mouse over it:

You can directly connect scalar or vectors to integer pins and Aximmetry will automatically convert them. You can connect other data types too, but usually, you need some modules in between, for example:

Since I am not sure what kind of data you importing from the JSON and in what type of data format you need it in Unreal, I can not tell what modules you will need to use.
Note, you can peek at any pin in Aximmetry to get a better idea of what is going on inside your module and data: https://aximmetry.com/learn/virtual-production-workflow/preparation-of-the-production-environment-phase-i/starting-with-aximmetry/aximmetry-composer/basics-of-the-flow-editor/#peeking

Also, in most cases, you don't need a logic like this:

Aximmetry automatically detects if the file changes and updates the JSON File module's output.

Warmest regards,

 
Profile Image
Cleveland
  -  
I have the same problems to update the json data in real time. I made some app that read a heart rate frequency in real time, each second, and this data is in json format. My problem is that aximmetry update time is randon, I need that that aximmetry update each second. I can´t use time to open because if I did that my output blink. So I think to use a script Lua, but I don´t know how. 
 
Profile Image
Eifert@Aximmetry
  -  

Hi Cleveland,

You do not need to use LUA for your task. Instead, you can utilize the following modules in the Flow Editor:

Note that I connected the Timer's Elapsed pin, rather than the Time pin like in the original post.

By following the above screenshot you should be able to achieve a consistent 1-second update interval for your heart rate data in Aximmetry. Additionally, the Hold Collection module, along with the connected logic, will guarantee that only the usable heart rate data is displayed.

Should you have any more questions or require additional guidance, please feel free to reach out.

Warmest regards,

 
Profile Image
Cleveland
  -  

Hi Eifert thank you very much for your help.

I decide use script and it works fine. Below the code I developer for my goal. The nodes tha you show it good but yet dosen't up date in real time. My code works fine. Thank you very much for your help. 

--$ outClientID Text
--$ outBatimento Text
--$ outDebug Text

-- Importa a bilbioteca para leitura do json
local cjson = require ("dkjson")

-- Para colocar um diretório usar estas barras /
local dados = "M:/Batimento_Axi/ dados.json"

--Tenta abrir o arquivo em modo de leitura
local arquivo, erro = io.open(dados,"r")

-- Verifica se houve um erro na abertura do arquivo
if not arquivo then
    outDebug = "Erro ao abrir o arquivo"
    outDebug = erro
else
    -- Lê o conteúdo do arquivo
    local conteudo = arquivo:read("*all")
    
    -- Fecha o arquivo após a leitura
    arquivo:close()

    -- Converte a string JSON para uma tabela Lua
    local tabela_lua, pos, err = cjson.decode(conteudo, 1, null, nil)
    if err then
        --outDebug = err
        
    else 
        outClientID = tabela_lua.clientId
        outBatimento = tostring(tabela_lua.hr)
        
    end
end


 


 
Profile Image
Eifert@Aximmetry
  -  

Hello Cleveland,

Thank you for sharing the LUA script.

I forgot to mention that if you are retrieving this JSON data from the web, you can probably directly utilize the HTTP Request module in the Broadcast version of Aximmetry. This way you can skip saving the JSON into a file and reading the file in Aximmetry. Additionally, starting from version 2023.3.0 BETA, you have access to the WebSocket Client, TCP Client, TCP Server, UDP Sender, UDP Receiver, and Serial Client modules. These modules enable you to receive data from the internet, local network, and from various devices.

The JSON in my screenshot is updated every second. However, they do not update during the 1-second intervals. If you wish to achieve updates more frequently than every second, you could incorporate a Not module after the Timer module. This would keep the JSON file module Open between the 1-second intervals:
JSON data

Alternatively, consider leaving the JSON File module Open and removing the Timer module altogether. I believe that it should update in less than a second like that, but not in regular intervals.

Warmest regards,


;