Bug 1918

Summary: RandomWalk2dMobilityModel is stuck in the corner
Product: ns-3 Reporter: Tommaso Pecorella <tommaso.pecorella>
Component: mobility modelsAssignee: ns-bugs <ns-bugs>
Status: NEW ---    
Severity: normal    
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   

Description Tommaso Pecorella 2014-05-21 15:10:56 EDT
If the node reaches the corner (or it starts from a corner) the mobility model gets stuck.

The reason is in RandomWalk2dMobilityModel::Rebound (Time delayLeft)
The function checks what's the "closest" side of the bounds and changes the speed accordingly.
If there are TWO equally close sides (as in a corner), only the horizontal speed is changed, and the vertical one is left as it is, leading to a loop.

I suspect that a similar things happens in all the mobility models with bounds, as the Rectangle::GetClosestSide() function only returns a side and not a corner.