VehicleMobility

Package: inet.mobility.single

simple module VehicleMobility

Mobility model for ground vehicles that follow waypoints with realistic turning behavior. Reads waypoints from a file and moves the vehicle along them at a specified speed, calculating appropriate angular velocity for turns. Supports terrain following by projecting positions onto the ground and orienting the vehicle according to the ground normal.

Waypoints are defined in a text file as x,y,z with one waypoint per line. When all waypoints have been reached, it loops back to the first one.

inet.mobility.single.VehicleMobilityVehicleMobilitysimple

Inheritance diagram

Extends

Name

Type

Description

MovingMobilityBase

simple module

Abstract base module for mobility models.

Parameters

Name

Type

Default value

Description

displayStringTextFormat

string

“p: {position}\nv: {velocity}”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

subjectModule

string

“^”

The module path that determines the subject module, the motion of which this mobility model describes. The default value is the parent module

coordinateSystemModule

string

“”

The module path of the geographic coordinate system module; optional, empty disables geographic conversion (and the {geo_position} directive)

updateDisplayString

bool

true

Enables continuous update of the subject module’s position by modifying its display string

constraintAreaMinX

double

-inf m

The minimum x position of the constraint area. It is unconstrained by default (negative infinity)

constraintAreaMinY

double

-inf m

The minimum y position of the constraint area. It is unconstrained by default (negative infinity)

constraintAreaMinZ

double

-inf m

The minimum z position of the constraint area. It is unconstrained by default (negative infinity)

constraintAreaMaxX

double

inf m

The maximum x position of the constraint area. It is unconstrained by default (positive infinity)

constraintAreaMaxY

double

inf m

The maximum y position of the constraint area. It is unconstrained by default (positive infinity)

constraintAreaMaxZ

double

inf m

The maximum z position of the constraint area. It is unconstrained by default (positive infinity)

updateInterval

double

0.1s

The simulation time interval used to regularly signal mobility state changes and update the display

faceForward

bool

true

waypointFile

string

Contains the waypoints as one waypoint x,y,z per line

waypointProximity

double

A waypoint is reached when it is less than waypointProximity meters away

speed

double

groundModule

string

“environment.ground”

Module path of the ground module

initialX

double

uniform(constraintAreaMinX, constraintAreaMaxX)

initialY

double

uniform(constraintAreaMinY, constraintAreaMaxY)

initialZ

double

nanToZero(uniform(constraintAreaMinZ, constraintAreaMaxZ))

initFromDisplayString

bool

true

Enables one-time initialization from the subject module’s display string

Properties

Name

Value

Description

class

VehicleMobility

display

i=block/cogwheel

Signals

Name

Type

Unit

Description

mobilityStateChanged

inet::MobilityBase

It works in inet, but not in the extended module in another namespace

Source code

//
// Mobility model for ground vehicles that follow waypoints with realistic
// turning behavior. Reads waypoints from a file and moves the vehicle along
// them at a specified speed, calculating appropriate angular velocity for turns.
// Supports terrain following by projecting positions onto the ground and
// orienting the vehicle according to the ground normal.
//
// Waypoints are defined in a text file as x,y,z with one waypoint per line.
// When all waypoints have been reached, it loops back to the first one.
//
simple VehicleMobility extends MovingMobilityBase
{
    parameters:
        @class(VehicleMobility);
        string waypointFile; // Contains the waypoints as one waypoint x,y,z per line
        double waypointProximity @unit(m); // A waypoint is reached when it is less than waypointProximity meters away
        double speed @unit(mps);
        string groundModule = default("environment.ground"); // Module path of the ground module
        double initialX @unit(m) = default(uniform(constraintAreaMinX, constraintAreaMaxX));
        double initialY @unit(m) = default(uniform(constraintAreaMinY, constraintAreaMaxY));
        double initialZ @unit(m) = default(nanToZero(uniform(constraintAreaMinZ, constraintAreaMaxZ)));
        bool initFromDisplayString = default(true); // Enables one-time initialization from the subject module's display string
}

File: src/inet/mobility/single/VehicleMobility.ned