Questions about the distance measurement mesh model

Hello

My application is based on the Distance measurement sample which uses a BLE  scan response callback to trigger the measurement synchronization sequence in reflector mode and scan callback to trigger synchronization sequence in  initiator mode. With the Distance mesh model the measurement sequence is started with the bt_mesh_dm_cli_measurement_start API

It seems that simply calling this API every time a scan packet arrives is going to overwhelm the mesh network. On the other hand it would be great to receive more than one measurement so averaging can be applied. What's your recommendation on how frequently should  bt_mesh_dm_cli_measurement_start API be called?
Also

There is an API bt_mesh_dm_cli_results_get() which returns the measurement results.

However the results are available in the bt_mesh_dm_cli_measurement_start() callback. 
Can you clarify when this function should be called?

Do you plan to add a sample how the DM model should be used? That would very helpful

Thank you

Andy

Parents Reply Children
  • Update

    Got it to work, Can use mesh dm in the shell and measure distance between 2 nodes

    Here is what I had to do i

    1. proj.conf 

    CONFIG_BT_MESH_DM_CLI=y
    CONFIG_BT_MESH_DM_SRV=y
    2. Add dm server and client to model composition
    struct bt_mesh_model _vnd_models[] = {
       // your vendor models
        // Distance measurement models.
        BT_MESH_MODEL_DM_CLI(&_dm_client),
        BT_MESH_MODEL_DM_SRV(&_dm_srv)
    };
    // config client.used for provisioning via shell
    struct bt_mesh_cfg_cli       _config_client;

    static struct bt_mesh_model _root_models[] = {
        BT_MESH_MODEL_CFG_SRV,          
        BT_MESH_MODEL_CFG_CLI(&_config_client),
    };
    static struct bt_mesh_elem _elements[] = {
        BT_MESH_ELEM(0, _root_models, _vnd_models),
    };
    3. I use mesh shell to provision. Added the following commands 
    bind dm client model to node address
    mesh models cfg model app-bind <node addr> 0 0x000C 0x0059
    bind dm server model to node address
    mesh models cfg model app-bind <node addr> 0 0x000B 0x0059
    NOTE
    0x0059 is Nordic BLE ID. Must bind these models using Nordic ID not your company ID 
    Otherwise bind fails

    Provisioned 2 nodes
    Now can do the following in the mesh shell
    mesh init
    mesh target dst <node address>
    mesh models dm start 1 (MPCD mode) <other node addr>
    Get this back 

    Status: Success (err: 0)

    Entry number: 1
    Mode: MCPD
    Quality: 0
    Error Occurred: 0
    Address: 0X0001
    Best distance (cm): 60
    IFFT distance (cm): 60
    Phase slope distance (cm): 196
    RSSI open space distance (cm): 891
    NOTE
    The measurement takes about 2 seconds ( 1 minute 51-52 seconds) 
    This is for 2 devices within BLE range
    Seems  a bit long
     
Related