Search code examples
unetstack

unetsim: Is there a functionality to move a node from one coordinate to another by specifying the coordinates only and not velocity or direction?


I'm trying to move a mobile AUV (node) on a particular path by specifying coordinates in the form of (x,y,z). As far as I have explored, UnetSim only offers nodes to move by specifying velocity and directions. Is there any way to make a node move to a particular set of locations in order after being deployed?


Solution

  • The MobilityModel in UnetSim Nodes has a mechanism to define piece-wise location information for various times in the Simulation.

    The node.motionModel property is a List of HashMaps which can contain any of the following keys:

    • time: Time at which the mobility action is valid.
    • location: Coordinates ([-50.m, -50.m, 0]).
    • speed : Speed in mps (1.mps).
    • heading : Heading in degrees (30.deg).
    • turnRate: Rate of turn (1.dps).
    • diveRate: Rate of diving (-0.1.mps).

    So using the time and location key we can achieve what you are trying to do.

    The UnetIDE comes bundled with an example for simulating mobility. In this example, there are 4 sub-examples of various ways mobility can be simulated.

    The 3rd example, Triangular motion (with diving), can be easily updated to indicate coordinates at various points of time during the simulation as follow.

    println 'Simulation AUV-3: Triangular motion (with dive)'
    simulate 15.minutes, {
      def n = node('AUV-3', location: [-50.m, -50.m, 0], mobility: true)
      n.startup = trackAuvLocation
      n.motionModel = [[time:  0.minutes, location: [-50.m, -50.m, 0] ],
                       [time:  3.minutes, location: [-100.m, -50.m, 0] ],
                       [time:  4.minutes, location: [-100.m, -100.m, 0] ],
                       [time:  7.minutes, location: [-50.m, -100.m, 0] ],
                       [time:  10.minutes, location: [-50.m, -50.m, 0] ]]
    
    }
    

    This will give the following plot if plotted using the plot-tracks.groovy tool.

    auv-tracks