How to retrieve data from lora ra01

The library you are using will probably have examples on how to send data from one LoRa module to another.

Since each of the 20 (or is it 40) LoRa modules can talk to each other or a central gateway there ought to be no problem getting data back to the central gateway, but its difficult to be sure, you have still not provided much in the way of details on what you are trying to do.

If you want someone to write the code for you, go and ask over in the 'Gigs and Collaborations' forum, but you will need to provide a lot more details on what you are doing.

Personally, and in particular because of the way the LoRa modules fudge the calculation of RSSI (they are below noise devices after all), I dont think your idea will work.