正在ns3中添加路点

Adding waypoints in ns3

本文关键字:添加路 ns3 正在      更新时间:2023-10-16

我是ns3的新手,这就是我一直在做的事情。我试图添加路点,但不知道怎么做,如果你们能帮助,那就太好了

这就是我尝试的:

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)));

但这似乎不起作用,而且还有一个错误:

msg="属性name=NextWaypoint tid=ns3::WaypointMobilityModel:不能使用属性设置初始值"

航路点移动模型类别参考

您尝试使用的属性无效。如果您阅读了类引用,NextWaypoint和WaypointsLeft仅用于"read"。您不能设置它们,这就是为什么您得到"初始值不能使用属性设置"。

/src/mobility/test/waypoint-mobility-model-test.cc 中有WaypointMobilityModel的参考场景(测试用例)