Bugzilla – Full Text Bug Listing |
Summary: | WaypointMobilityModel incompatible with MobilityHelper::Install | ||
---|---|---|---|
Product: | ns-3 | Reporter: | Tom Henderson <tomh> |
Component: | mobility models | Assignee: | ns-bugs <ns-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | boyko, phillip.sitbon |
Priority: | P5 | ||
Version: | pre-release | ||
Hardware: | All | ||
OS: | All | ||
Bug Depends on: | |||
Bug Blocks: | 893 |
Description
Tom Henderson
2010-04-21 16:41:47 UTC
Tom, I agree with your suggestion and I came up with a solution that represents it; however, the order of events in the initialization of a WaypointMobilityModel becomes significant. I'm not so sure it's an issue. First, to summarize the solution since I haven't uploaded my patch yet: calling SetPosition when no mobility is yet defined (m_first == true) adds the first waypoint (which sets m_current). Otherwise, it does what the current version does. The issue here arises mostly because the first waypoint actually indicates the initial position and time for the node. Sure, we might install mobility at t = 0, but maybe the movement (or "trip") doesn't start until t = 10, when the first waypoint is scheduled. The position for 0 <= t < 10 is the same as for t = 10, but that's when the node starts moving. I'm not sure if a more elegant solution would be to have an explicit initial position for each node, thus making the first waypoint in the list a "true waypoint" in the sense of the word (the node makes progress towards it from its starting position/time). Here are the two order-dependent initialization cases. Note that due to how I implemented this, t = 0 can really be any time the model comes into existence. 1) SetPosition @ t = 0, then add first waypoint. * Assuming waypoint.time > 0, the node moves between the initial position and waypoint.position, interpolating at times in between. 2) Add first waypoint @ t = 0, then SetPosition * Position will be set and velocity zeroed, overriding the first waypoint and jumping to the subsequent waypoint. Note that (2) means the suggested case of "if user tries to create Waypoint at time 0 and also to SetPosition at time 0, program errors out" won't happed; instead, SetPosition will take precedent and behave as it currently does. So, can we say this is OK since MobilityHelper::Install will call SetPosition before we get a chance to add any waypoints (I think)? Sorry for all the text on such a simple issue, I just want to make it very clear what the solution does.
>
> Here are the two order-dependent initialization cases. Note that due to how I
> implemented this, t = 0 can really be any time the model comes into existence.
>
> 1) SetPosition @ t = 0, then add first waypoint.
> * Assuming waypoint.time > 0, the node moves between the
> initial position and waypoint.position, interpolating
> at times in between.
>
> 2) Add first waypoint @ t = 0, then SetPosition
> * Position will be set and velocity zeroed, overriding the
> first waypoint and jumping to the subsequent waypoint.
>
> Note that (2) means the suggested case of "if user tries to create Waypoint at
> time 0 and also to SetPosition at time 0, program errors out" won't happed;
> instead, SetPosition will take precedent and behave as it currently does.
>
> So, can we say this is OK since MobilityHelper::Install will call SetPosition
> before we get a chance to add any waypoints (I think)?
>
I would be fine with your proposal.
Added InitialPositionIsWaypoint to provide an option for this behavior now. Please refer to the comment at http://www.nsnam.org/bugzilla/0 Patch set 5: http://codereview.appspot.com/144064 changeset: c5a7581f1e9 |