Dave Austin
Dave Austin

Reputation: 11

Adding waypoints in ns3

I am new to ns3 and this is what I am stuck at. I was trying to add waypoints but don't know how to do it, would be great if you guys could help

This is what I tried:

mobility.SetMobilityModel ("ns3::WaypointMobilityModel",
                        "NextWaypoint", WaypointValue(),
                        "WaypointsLeft", UintegerValue (1),
                        "LazyNotify", BooleanValue (false),
                        "InitialPositionIsWaypoint", BooleanValue (false)
                        );

mobility.Install (wifiStaNodes);  //wifiStanodes is my nodeContainer

Ptr<WaypointMobilityModel> waypoints =wifiStaNodes.Get(0)->GetObject<WaypointMobilityModel> ();

waypoints->AddWaypoint (Waypoint (Seconds (0.0), Vector (0.0, 0.0, 0.0)));
waypoints->AddWaypoint (Waypoint (Seconds (2.0), Vector (50.0, 50.0, 0)));

But this doesn't seem to work, moreover theres an error:

msg="Attribute name=NextWaypoint tid=ns3::WaypointMobilityModel: initial value cannot be set using attributes"

Waypoint mobility model class reference

Upvotes: 0

Views: 593

Answers (1)

Konstantinos
Konstantinos

Reputation: 556

The attributes you try to use are not valid. If you read the class reference, NextWaypoint and WaypointsLeft are only for "READ". You can not set them, that's why you get "initial value cannot be set using attributes".

There is a reference scenario (test case) for WaypointMobilityModel in /src/mobility/test/waypoint-mobility-model-test.cc

Upvotes: 0

Related Questions