Python UWB REST API

Ranging UWB nodes has never been that easy with simple python function call that returns when the ranging is done with the measure value

console output :

mp> range-0 (0)->(1) = 0.436
mp> range-1 (0)->(1) = 0.389
mp> range-2 (0)->(1) = 0.394
mp> range-3 (0)->(1) = 0.371
mp> range-4 (0)->(1) = 0.399
mp> range-5 (0)->(1) = 0.347
mp> range-6 (0)->(1) = 0.375
mp> range-7 (0)->(1) = 0.356
mp> range-8 (0)->(1) = 0.371
mp> range-9 (0)->(1) = 0.403

and this is the output of the RF simplemesh sniffer

sm{"uwb_cmd": "twr", "at_ms": 100, "initiator": 0, "responder": 1}
sm/C24FD51212E905F0{"initiator":0,"range":"0.436","responder":1,"seq":0,"uwb_cmd":"twr"}
sm{"uwb_cmd": "twr", "at_ms": 100, "initiator": 0, "responder": 1}
sm/C24FD51212E905F0{"initiator":0,"range":"0.389","responder":1,"seq":0,"uwb_cmd":"twr"}
sm{"uwb_cmd": "twr", "at_ms": 100, "initiator": 0, "responder": 1}
sm/C24FD51212E905F0{"initiator":0,"range":"0.394","responder":1,"seq":0,"uwb_cmd":"twr"}
sm{"uwb_cmd": "twr", "at_ms": 100, "initiator": 0, "responder": 1}
sm/C24FD51212E905F0{"initiator":0,"range":"0.371","responder":1,"seq":0,"uwb_cmd":"twr"}
sm{"uwb_cmd": "twr", "at_ms": 100, "initiator": 0, "responder": 1}
sm/C24FD51212E905F0{"initiator":0,"range":"0.399","responder":1,"seq":0,"uwb_cmd":"twr"}
sm{"uwb_cmd": "twr", "at_ms": 100, "initiator": 0, "responder": 1}
sm/C24FD51212E905F0{"initiator":0,"range":"0.347","responder":1,"seq":0,"uwb_cmd":"twr"}
sm{"uwb_cmd": "twr", "at_ms": 100, "initiator": 0, "responder": 1}
sm/C24FD51212E905F0{"initiator":0,"range":"0.375","responder":1,"seq":0,"uwb_cmd":"twr"}
sm{"uwb_cmd": "twr", "at_ms": 100, "initiator": 0, "responder": 1}
sm/C24FD51212E905F0{"initiator":0,"range":"0.356","responder":1,"seq":0,"uwb_cmd":"twr"}
sm{"uwb_cmd": "twr", "at_ms": 100, "initiator": 0, "responder": 1}
sm/C24FD51212E905F0{"initiator":0,"range":"0.371","responder":1,"seq":0,"uwb_cmd":"twr"}
sm{"uwb_cmd": "twr", "at_ms": 100, "initiator": 0, "responder": 1}
sm/C24FD51212E905F0{"initiator":0,"range":"0.403","responder":1,"seq":0,"uwb_cmd":"twr"}

Two Way Ranging Python API now supporting lists and count repeating sequences

db_uwb_twr and db_uwb_ping_diag can build with one call a database of ranging and uwb diagnosis

Overview diagram

annoucement on Decawave forum

1 Like

Added new function to retrieve the accumulator of the Channel Impulse Response this high level python API is calling the underlying firmware function dwt_readaccdata() and sending it through simplemesh RF to the gateway.

Python usage Steps :

  • call a ping between two nodes uwb_ping_diag(n_init,n_resp)
  • call a request to retrieve the cir accumulator uwb_cir("Resp")
  • convert with numpy frombuffer with type i2 and plot

We can notice the first path index of 750.4375 matches a rising edge of the accumulator cir

Notebook : mesh_position/uwb_cir.ipynb at main · HomeSmartMesh/mesh_position · GitHub

Ranging median

twr_list = mp.uwb_twr(initiator="Wired", responders=["Simple","Green"], step_ms=10, count=50, count_ms=30)
atl.plot_twr_list([("Wired","Simple"),("Wired","Green")], twr_list)

Ranging Graph

lists_list = [
    ("Green",["Simple","RR"]),
    ("RL",["Simple","RR"])
]
atl.range_graph("test_square_1",lists_list)

1 Like