Hi, To have current position of a node at agent level, you can do :
MobileNode* mnode_; double x = 0.0,y = 0.0,z = 0.0; mnode_->getLoc(&x, &y, &z); You should have mnode_ referencing to a node. For example, in my case I pass the node address to my agent in the tcl script and for this reason i defined a new "node" command in the Command( ) method of the agent like this : if(strcmp(argv[1], "node") == 0) { mnode_ = (MobileNode*) TclObject::lookup(argv[2]); if(mnode_ == 0) return TCL_ERROR; return TCL_OK; } then in my tcl script I create a node node_1 and my agent , then I do $my_agent node $node_1 Hope this helps. Bye. On 3/10/06, Shibdas Bandyopadhyay <[EMAIL PROTECTED]> wrote: > > > Hi, > I am using ns-2.29 and currently implementating a new protocol which > depends on the location information of the nodes. How can I get the > location > of the attached node from the agent code. Even if I keep the location > information in the agent information ( say by keeping it in routing > table), > how to set the corresponding entries. I have made the variables accessible > to the tcl script using bind function but how can I access the routing > agent > corresponding to a particular node? It would be better for me if I get the > x-cordinates and y-coordinates of the grid topology assigned to the node > from the routing agent. > > > Thanks > shibdas > > -- > =================== > Shibdas Bandyopadhyay > Second Year Post graduate student, > Department of Computer Science > Indian Statistical Institute, Kolkata > > http://snipurl.com/shibdas >