intrig-unicamp / mininet-wifi

Emulator for Software-Defined Wireless Networks
https://mn-wifi.readthedocs.io/
Other
431 stars 239 forks source link

fixed a bug by only acessing the z-axis of position if it exists #528

Closed lido22 closed 3 months ago

lido22 commented 3 months ago

in mobility class this function is accessing the z-axis without checking if it exists.

def get_position(pos):
        return float('%s' % pos[0]), float('%s' % pos[1]), float('%s' % pos[2])

I fixed this issue by checking if it exists before accessing it. Otherwise it's set to zero

def get_position(pos):
        x = float('%s' % pos[0])
        y = float('%s' % pos[1])
        z = float('%s' % pos[2]) if len(pos) == 3 else float('%s' % 0)
        return x, y, z

Also did the same for move_factor