Problem using AODV

110 views
Skip to first unread message

Abhishek Chanda

unread,
Dec 15, 2011, 12:37:29 AM12/15/11
to ns-3-users
Hi,

I am trying to use RandomWaypointMobilityModel with the aodv script
that comes with NS3. Here is my CreateNodes function:

void
AodvExample::CreateNodes ()
{
std::cout << "Creating " << (unsigned)size << " nodes " << step << "
m apart.\n";
nodes.Create (size);
// Name nodes
for (uint32_t i = 0; i < size; ++i)
{
std::ostringstream os;
os << "node-" << i;
Names::Add (os.str (), nodes.Get (i));
}
// Create static grid
MobilityHelper mobility;
mobility.SetPositionAllocator ("ns3::GridPositionAllocator",
"MinX", DoubleValue (0.0),
"MinY", DoubleValue (0.0),
"DeltaX", DoubleValue (step),
"DeltaY", DoubleValue (0),
"GridWidth", UintegerValue (size),
"LayoutType", StringValue ("RowFirst"));
//mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.SetMobilityModel (
"ns3::RandomWaypointMobilityModel",
"Speed", RandomVariableValue (ConstantVariable (1200)),
"Pause", RandomVariableValue (ConstantVariable (0)));
mobility.Install (nodes);
}


When I run this, I get a seg fault. GDB shows this:

(gdb) run
Starting program: /Users/rony/ns-allinone-3.11/ns-3.11/build/debug/src/
mobilityfirst/examples/randomwaypoint
Reading symbols for shared libraries +++++++++++++++++++
+........................... done
Creating 10 nodes 100 m apart.
Starting simulation for 10 s ...

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x00000001003b425c in ns3::RandomWaypointMobilityModel::BeginWalk
(this=0x10200e0f0) at random-waypoint-mobility-model.cc:62
62 Vector destination = m_position->GetNext ();
(gdb)

What is wrong here?

Tom Henderson

unread,
Dec 15, 2011, 1:17:34 AM12/15/11
to ns-3-...@googlegroups.com

The problem is that you need to provide a pointer to the position
allocator to the mobility model. See
examples/routing/manet-routing-compare.cc for an example. It does not
suffice to set this position allocator in the helper as you did.

What you tried to do seems to be the intuitive thing to change this
script so, I think this is a fault of how this helper API works, so I
will open a bug on this issue to try to find a better solution.

- Tom

Abhishek Chanda

unread,
Dec 15, 2011, 2:01:21 AM12/15/11
to ns-3-...@googlegroups.com
Hi Tom,

Thanks for the reply. This works fine now

Thanks



- Tom

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.




--
Abhishek Chanda

Abhishek Chanda

unread,
Dec 15, 2011, 5:34:50 PM12/15/11
to ns-3-...@googlegroups.com
Hi,

I have a followup question on this.
How do I specify a world size for the RandomWaypointMobilityModel? All other models seem to have a bound parameter, but this does not have one.

Thanks
--
Abhishek Chanda
Reply all
Reply to author
Forward
0 new messages