I started with the idea that the sensor and send waves pass an obstacle, the return value decline
Well, we have no clue what getValue() does. So, it is hard to help you.
The sensors you linked to measure distance. They tell you how far it is from the sensor to the object that the first returned wave echoed off of. They do not tell you where that object is, which object it was, or anything about the object. The object could be a desk that never moves. It could be an intruder. It could be anything.
Assuming that getValue() actually activates one of the sensors, and gets the distance from that sensor to some object, you then appear to be determining if the object is moving, because the distances are not the same, and because the difference is greater than less than some threshold. What do you intend to do in the while loop?