Hi All

Im currently using TOSSIM. I am interested in getting the mote positions 
assigned by TOSSIM so that motes are aware where in virtual space they are 
located. For this purpose I started looking in Nido.nc which includes nido.h In 
nido.h there is structure called as TOS_state_t which has defined different 
values, such as if we want simulation time we can call from our .nc file 
tos_state.tos_time. Under this structure there is spatial_model   variable too 
which i belive is used to assign positions to nodes in simulator (please 
correct me)

so i did some changes in nido.h, spatial_model.h and spatial_model.c to get 
mote positions

in spatial_model.c i created two methods to access the values as follows

.....  

double simple_spatial_get_positionX(short moteID) {
  return points[moteID].xCoordinate;
}
double simple_spatial_get_positionY(short moteID) {
  return points[moteID].yCoordinate;
}

and under this pointer to function i put reference to above methods
spatial_model* create_simple_spatial_model() {
  .....    
  model->get_positionX = simple_spatial_get_positionX;
  model->get_positionY = simple_spatial_get_positionY;
  .....
}

furthermore in spatial_model.h I changed spatial_model structure accordingly, 
as follows

typedef struct {
.....
double (*get_positionX)(short);
double (*get_positionY)(short);
} spatial_model;


Accordingly, in nido.h I defined following metohds to access the values 
provided from spatial_model.c
point3D *pt3D;

double getXCoord()
{
    return tos_state.space->get_positionX(tos_state.current_node);
  }
double getYCoord()
{
    return tos_state.space->get_positionY(tos_state.current_node);
  }


Finaly from my .nc file I call these methods 

        dbg(DBG_USR1,"Xcoord:%d\n",getXCoord());
        dbg(DBG_USR1,"Ycoord:%d\n",getYCoord());


So far so good every things work fine complied and running but always im 
getting 0 for these values. Any suggestions why?

1) Am i looking to correct files for getting node positions in TOSSIM
2) My way of working around in fine or im doing something wierd :) somewhere

PS: for simulations i m using lossy model


Looking Forward 


Regards 
Faisal Karim 

      
 







       
____________________________________________________________________________________
Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, 
photos & more. 
http://mobile.yahoo.com/go?refer=1GNXIC
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to