简体   繁体   English

在ns3中添加航点

[英]Adding waypoints in ns3

I am new to ns3 and this is what I am stuck at. 我是ns3的新手,这就是我所坚持的。 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" msg =“属性名称= NextWaypoint tid = ns3 :: WaypointMobilityModel:不能使用属性设置初始值”

Waypoint mobility model class reference 航点移动性模型类参考

The attributes you try to use are not valid. 您尝试使用的属性无效。 If you read the class reference, NextWaypoint and WaypointsLeft are only for "READ". 如果您阅读类参考,则NextWaypoint和WaypointsLeft仅适用于“ 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 /src/mobility/test/waypoint-mobility-model-test.cc中有WaypointMobilityModel的参考方案(测试用例)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM