set position allocator

1,828 views
Skip to first unread message

Seasong

unread,
Feb 26, 2012, 9:16:33 AM2/26/12
to ns-3-users
Hey guys, when I compile my c file it says
no matching function for call to
‘ns3::MobilityHelper::SetPositionAllocator(const char [35], const char
[9], ns3::Vector3D)’

Below is my script for this part:

MobilityHelper mobility;

mobility.SetPositionAllocator ("ns3::ConstantPositionMobilityModel",
"Position", Vector3D (-5.5,3.0,0.0));

Where am I wrong?

Murtaza

unread,
Feb 27, 2012, 12:44:19 AM2/27/12
to ns-3-...@googlegroups.com
I can be wrong but I think this function only accepts std::string. Try to pass std::string instead of char array.


--
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+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.


Alessandro Russo

unread,
Mar 6, 2012, 4:34:10 AM3/6/12
to ns-3-...@googlegroups.com
HI,
I usually follow this:
Ptr<ListPositionAllocator> positionAllocS = CreateObject<ListPositionAllocator> ();
positionAllocS->Add(Vector(-10.0, -10.0, 0.0));// node
MobilityHelper mobilityS;
mobilityS.SetPositionAllocator(positionAllocS);
mobilityS.SetMobilityModel("ns3::ConstantPositionMobilityModel"); //whatever it is
mobilityS.Install(node);

 Alessandro  R.

Luca

unread,
Mar 20, 2012, 5:19:49 AM3/20/12
to ns-3-users
On 26 Feb, 15:16, Seasong <xiaohangchen.seas...@gmail.com> wrote:
>   mobility.SetPositionAllocator ("ns3::ConstantPositionMobilityModel", "Position", Vector3D (-5.5,3.0,0.0));

just for future references....

mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel",
"Position", VectorValue (Vector (-1.0, -1.0, 0.0)));

works

luca

ZM Lin

unread,
Jul 21, 2014, 1:10:45 PM7/21/14
to ns-3-...@googlegroups.com, luca.co...@gmail.com
Dear Luca,

If I want to fix the position of one node, the rest is randomly distributed. How can acheive this? if I use mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel",
"Position", VectorValue (Vector (0.0, 0.0, 0.0))); and install mobility into nodes, it will be installed into all node, right?

Thank you in advance.

Best Regards,
ZM 

Tommaso Pecorella

unread,
Jul 21, 2014, 2:52:30 PM7/21/14
to ns-3-...@googlegroups.com, luca.co...@gmail.com
I'm confident that Luca will reply to this post. It's "just" 2 years and 3 months old.
As a consequence, I'll not reply. I'll wait patiently for Luca's reply. He will for sure. 100% !

RT*M

Andreas Slovacek

unread,
Apr 9, 2020, 6:28:13 PM4/9/20
to ns-3-users
For viewers from the future like myself: this doesn't seem to be the case anymore.  You get the error msg="Attribute name=Position tid=ns3::MobilityModel: initial value cannot be set using attributes", file=../src/core/model/object-base.cc, line=112

Andreas Slovacek

unread,
Apr 9, 2020, 6:48:15 PM4/9/20
to ns-3-users
8 years later this works- ns3.30.1.  Thank you!


On Tuesday, March 6, 2012 at 2:34:10 AM UTC-7, Alessandro Russo wrote:
HI,
I usually follow this:
Ptr<ListPositionAllocator> positionAllocS = CreateObject<ListPositionAllocator> ();
positionAllocS->Add(Vector(-10.0, -10.0, 0.0));// node
MobilityHelper mobilityS;
mobilityS.SetPositionAllocator(positionAllocS);
mobilityS.SetMobilityModel("ns3::ConstantPositionMobilityModel"); //whatever it is
mobilityS.Install(node);

 Alessandro  R.


On Mon, Feb 27, 2012 at 6:44 AM, Murtaza <leotheli...@gmail.com> wrote:
I can be wrong but I think this function only accepts std::string. Try to pass std::string instead of char array.
On Mon, Feb 27, 2012 at 1:16 AM, Seasong <xiaohangc...@gmail.com> wrote:
Hey guys, when I compile my c file it says
no matching function for call to
‘ns3::MobilityHelper::SetPositionAllocator(const char [35], const char
[9], ns3::Vector3D)’

Below is my script for this  part:

MobilityHelper mobility;

 mobility.SetPositionAllocator ("ns3::ConstantPositionMobilityModel",
                                "Position", Vector3D (-5.5,3.0,0.0));

Where am I wrong?

--
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-...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.


--
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-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages