Native meshing not working

Hi,

We have problems retrieving MLMeshingMeshInfo with MLMeshingGetMeshInfoResult().
The MLMeshingGetMeshInfoResult() method returns MLResult_Ok, but out_info.data_count is set to zero. We have ensured that subsequent calls are made in the same way as in the sample app.
We have made sure that each call returns MLResult_Ok.
Do you have an idea why data_count is zero even though MLResult_Ok is returned.
Especially as the documentation mentions MLResult_Ok is returned when the data was populated.
quote:

\retval MLResult_Ok Mesh Info was populated successfully.

ML2 OS version 1.3.0-dev1(secure)
MLSDK version v1.2.0-dev2

Thanks in advance,
Richard

Richard, did you try running meshing sample app? Does it work for you?

Hi @ejurinsky,

Yes, the sample is working.
We granted all permissions, using the code from the sample and also starting perception with MLPerceptionStartup().

We tried to test meshing using minimal code now. Our source looks like this:

At startup:
// initialize perception system
MLPerceptionSettings perceptionSettings = {};
MLResult result = MLPerceptionInitSettings(&perceptionSettings); // result = MLResult_Ok
result = MLPerceptionStartup(&perceptionSettings); // result = MLResult_Ok
result = MLMeshingCreateClient(&meshing_client_, &meshing_settings_); // result = MLResult_Ok
result = MLHeadTrackingCreate(&head_tracker_); // result = MLResult_Ok
result = MLHeadTrackingGetStaticData(head_tracker_, &head_static_data_); // result = MLResult_Ok

onUpdate() {
  if (!MLHandleIsValid(current_mesh_info_request_)) {
    MLResult result = MLMeshingRequestMeshInfo(meshing_client_, &request_extents_, &current_mesh_info_request_); // result = MLResult_Ok
  } else {
    MLMeshingMeshInfo mesh_info = {};
    MLResult result = MLMeshingGetMeshInfoResult(meshing_client_, current_mesh_info_request_, &mesh_info); // result = MLResult_Ok
    // result = MLResult_Ok, mesh_info.data_count=0, mesh_info.data->state=0 //
    switch (result) {
        case MLResult_Ok:
            LOGAR_DEBUG<<"##### mesh data count = " << mesh_info.data_count << " timestamp: " << mesh_info.timestamp << " state: " << mesh_info.data->state;
            break;
        case MLResult_Pending:
            LOGAR_DEBUG<<"##### meshinfo pending”; // never comes in here
            break;
        case MLResult_PerceptionSystemNotStarted:
            LOGAR_DEBUG << "##### MLResult_PerceptionSystemNotStarted”; // never comes in here
            break;
        case MLResult_InvalidParam:
            LOGAR_DEBUG << "##### MLMeshingGetMeshInfoResult MLResult_InvalidParam”; // never comes in here
            break;
        default:
            LOGAR_DEBUG << "##### MLMeshingGetMeshInfoResult default”; // never comes in here
  }
}
  • All the Magic Leap calls are returning MLResult_Ok.
  • It looks like MLMeshingGetMeshInfoResult() does not return/update mesh_info at all.
  • In contrast to the meshing sample, MLMeshingRequestMeshInfo() never returns MLResult_Pending for us.
  • Nor does it update the result.

I’m sure we are missing something.

Thanks,
Richard

Hi,

I found the issue:
We forgot to initialise request_extents_, which is used by
MLMeshingRequestMeshInfo(meshing_client_, &request_extents_, &current_mesh_info_request_);

When initialising it properly, it’s working!

Thanks,
Richard

Glad to hear @rp1. Best of luck with your project.