Hi Toby

I do not understand what do by meant catching a const reference to the exception. Could you please explain further?

Thanks and Best Regards

Wu Hengxin
Institute for Infocomm Research
A*star


On Wed, Apr 15, 2009 at 3:16 PM, Toby Collett <tcollett+player@plan9.net.nz> wrote:
You should catch a const reference to the exception and see if that works. Also add a catch all exception handler and see if that is picking up the exception. If it does then it may be a linking issue, I have been have some issues with exceptions being thrown between dynamic libraries myself, so if the above doesnt solve it I can possible give some more suggestions.
Toby

2009/4/15 Wu Hengxin <wu.hengxin@gmail.com>
Hi Toby
 
I tried to have a try catch expection using catch ( PlayerCc::PlayerError e)
 
 
try
{
        robot.StopThread();
        delete(sonarP);
        offSonar = false;
        robot.StartThread();  
}
catch( PlayerCc::PlayerError e)
{
      cout << "CATCHED" << endl;
      sleep(1);
      robot.StartThread();
}
 
However, it seems that the error is not caught by the statement. and the same error message is displayed
 
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

Could you kindly advice me on which part i did wrongly
 
Best Regards

Wu Hengxin
Institute for Infocomm Research
A*star


On Sun, Mar 29, 2009 at 8:10 AM, Toby Collett <tcollett+player@plan9.net.nz> wrote:
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

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


_______________________________________________
Playerstage-users mailing list
Playerstage-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-users



------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-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

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Playerstage-users mailing list
Playerstage-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-users