Re: Help with map driver

"Rich Mattes" <[email protected]>
Newsgroups gmane.science.robotics.playerstage
Message-ID <000001cb483e$b370afb0$1a520f10$@com>
Have you tried using gdb on your driver?  make sure that your plugin is
compiled with the -g option, then run

$ gdb robot-player
(gdb) run configfile.cfg

Once the program segfaults, use the 'bt' and 'list' commands to determine
where your program was when it crashed.  The below code snippet isn't enough
to tell the whole story, but are you allocating map_data.data before you
attempt to write to it?  You should allocate it with the "new" keyword or
with "malloc".

Rich

-----Original Message-----
From: aneves [mailto:[email protected]] 
Sent: Monday, August 30, 2010 6:20 AM
To: [email protected]
Subject: [Playerstage-developers] Help with map driver


Hi!

I'm developing a gridslam driver for player and i'm stuck with the map
interface messages. when i try to use the MapProxy on my client I get a
segmentation fault i'm following gridmap driver as an example. I'm using
robot-player 2.0.4 and stage 2.0.3 from ubuntu repositories.
What i'm i doing wrong?  Please help, my deadline is aproching...

Thanks in advance

here is my ProcessMessage() (just the map part)

	 // Is it a request for the map info?
  if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ,
                            PLAYER_MAP_REQ_GET_INFO,
                            this->prov_map_ID) )
  {
    
     map_info.scale=0.3;//map.GetResolution();
    map_info.width=40;//map.Getxmax()-map.Getxmin();
    map_info.height=40;//map.Getymax()-map.Getymin();
    map_info.origin=init_pose;
    
    this->Publish(this->prov_map_ID,
                 resp_queue,
                 PLAYER_MSGTYPE_RESP_ACK,
                 PLAYER_MAP_DATA_INFO,
                 (void*)&map_info,
                 sizeof(player_map_info_t),
		  NULL);
    return(0);
  } 
 // Is it a request for the map data?
  if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_REQ,
                            PLAYER_MAP_REQ_GET_DATA,
                            this->prov_map_ID) )
  {
    
    map_data.col=0;
    map_data.row=0;
    map_data.width=map.GetSizeX();
    map_data.height=map.GetSizeY();
    
    int si=map_data.width;
    int sj=map_data.height;
    
    for(int j = 0; j < sj; j++)
    {
      for(int i = 0; i < si; i++)
      {
	float p=0;//map.GetProbValue(i,j);
	if (p<=0.001)
	  p=-1;
	else{
	  if (p<0.99)
	   p=0; 
	  else
	   p=1;
	}
	map_data.data[i+j*si]=p;
      }
    }
    
    
    
    
    this->Publish(this->prov_map_ID,
                 resp_queue,
                 PLAYER_MSGTYPE_RESP_ACK,
                 PLAYER_MAP_REQ_GET_DATA,
                 (void*)&map_data,
                 sizeof(player_map_data_t));
             
    puts("Map data sent!");
    return(0); 
  }




-- 
View this message in context:
http://old.nabble.com/Help-with-map-driver-tp29571142p29571142.html
Sent from the playerstage-developers mailing list archive at Nabble.com.


----------------------------------------------------------------------------
--
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Playerstage-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-developers


------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.