My guess as to what is happening here is that the server has already sent  a sonar message when you delete the sonar proxy and so it doesnt know what to do with the message. Simple option is just to catch the exception here and then continue.

Toby

2009/3/17 Wu Hengxin <wu.hengxin@gmail.com>
Hi

I am trying to get the pioneer sonar to switch on and off at certain requirements. I am using player 2.1.2 and playerc++ proxy.

My code is as follows
-----------------------------------------------------------------------------------

PlayerClient robot (gHostname, gPort);
SonarProxy *sonarP;


robot.StartThread();

for (;;)
{
    if (onSonar)
    {
        robot.StopThread();
        sonarP = new SonarProxy(&robot,0);
        onSonar = false;
        robot.StartThread();
    }
  
   if (offSonar)
    {
        robot.StopThread();
        delete(sonarP);
        offSonar = false;
        robot.StartThread();
    }

 //other stuff here....
}

-----------------------------------------------------------------------------------------------

The failure point comes after the delete sonar portion and when the robot thread starts to read. The error returned is

playerc warning   : warning : Failed to dispatch data message: subtype 1
address: 16777343:6665:sonar:0
terminate called after throwing an instance of 'PlayerCc::PlayerError'
size: 8Aborted



Any help will be well appreciated. Thanks


--
Wu Hengxin
Institute for Infocomm Research
A*star

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Playerstage-users mailing list
Playerstage-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-users




--
This email is intended for the addressee only and may contain privileged and/or confidential information