Hello, I am trying to manually set the positions of nodes with a scheduled function. The problem is this is not covered in the example Python scripts and I could not manage to obtain the mobility model from the node.
I understand that I need to implement this in Python:
node->GetObject<MobilityModel>()->SetPosition(vector);
I searched the Internet and found some answers that suggest this:
node.GetObject(ns3.MobilityModel.GetTypeId()).SetPosition(vector)
Applying this to my case, I try this:
node.GetObject(ns.ConstantPositionMobilityModel().GetTypeId()).SetPosition(vector)
I get the following error (I tried both inside and outside the scheduled event function):
Traceback (most recent call last):
File "/path/to/file/sim_test1.py", line 240, in <module>
ns.core.Simulator.Run()
TypeError: static void ns3::Simulator::Run() =>
TypeError: Template method resolution failed:
Failed to instantiate "GetObject(ns3::TypeId&)"
Failed to instantiate "GetObject(ns3::TypeId*)"
Failed to instantiate "GetObject(ns3::TypeId)"
Error: tcpip::Socket::recvAndCheck @ recv: peer shutdown
Quitting (on error).
The examples I could find were very old, so I assume they are out-of-date? Am I doing something wrong? Could you show me the correct way to access the mobility model? Thank you very much.