0

I am trying to get the mobility constraint area that they are in the .ini file .

**.constraintAreaMaxX = 1000m
**.constraintAreaMaxY = 1000m
**.constraintAreaMaxZ = 1000m

in my Mobiledrone.cc file :

void Mobiledrone::initialize()
{
    maxAreaX = constraintAreaMaxX;
    maxAreaY = constraintAreaMaxY;
    maxAreaZ = constraintAreaMaxZ;
}

the files that i have are :

1-the Network.ned

network Network

{
    parameters:
        int numHosts;
        
        @display("bgb=1000,1000");
    submodules:
        
        // host=drone
        host[numHosts]: Mobiledrone {
            @display("i=misc/drone");
        }

and Mobiledrone.ned and Mobiledrone.cc . So how can i get them in my Mobiledrone.cc file?

kim
  • 1

1 Answers1

0

You can call mobility module in your C++ code and get these values through appropriate getters. Here's an example for inet mobility modules:

IMobility* mobility = check_and_cast<IMobility*>(getContainingNode(this)->getSubmodule("mobility"));
auto caMax = mobility->getConstraintAreaMax();
auto caMin = mobility->getConstraintAreaMin();
gehirndienst
  • 424
  • 2
  • 13