Hi all
I'm using boost 1.40 with OROCOS 2.2.x and ROS integration. I try to get run the hello-5-services example.
I get following run-time error:
--------------------------------------------
0.014 [ Info ][main()] **** Creating the 'Hello' component ****
0.014 [ Info ][Thread] Creating Thread for scheduler: 0
0.014 [ Info ][Hello] Thread created with scheduler type '0', priority 0 and period 0.
0.014 [ Info ][Thread] Creating Thread for scheduler: 0
0.014 [ Info ][GlobalEngine] Thread created with scheduler type '0', priority 0 and period 0.
Caught std::exception.
what(): tr1::bad_weak_ptr
Orocos has detected an uncaught C++ exception
in the ORO_main() function.
You might have called a function which throws
without a try {} catch {} block.
To Debug this situation, issue the following command:
valgrind -v --num-callers=16 ./HelloWorld-gnulinux [options...] --nocatch
Which will show where the exception occured.
( Change num-callers for more/less detail.
Also, compiling orocos and your program with
-g adds more usefull information. )
0.015 [ Info ][Logger] Orocos Logging Deactivated.
--------------------------------------------
The error occurs once I try to provide the service "robot" with the operation "mymethod" done by the following lines:
RobotService(const std::string &name) : Service(name)
{
this->provides("robot")->addOperation("mymethod", &RobotService::mymethod, this, RTT::OwnThread).doc("Returns a friendly word.");
}
The function mymethod exists. Once I comment out the line it will start successfully. If I just uncomment "this->provides("robot");" it will fail too with the error above.
Can you help me providing this service?
Thanks
dani
hello-5-services runtime error : tr1::bad_weak_ptr
Hi Dani,
On Tuesday 05 April 2011 09:56:12 Eberli Dani wrote:
> Hi all
>
> I'm using boost 1.40 with OROCOS 2.2.x and ROS integration. I try to get
> run the hello-5-services example.
>
> I get following run-time error:
> --------------------------------------------
> 0.014 [ Info ][main()] **** Creating the 'Hello' component ****
> 0.014 [ Info ][Thread] Creating Thread for scheduler: 0
> 0.014 [ Info ][Hello] Thread created with scheduler type '0', priority 0
> and period 0. 0.014 [ Info ][Thread] Creating Thread for scheduler: 0
> 0.014 [ Info ][GlobalEngine] Thread created with scheduler type '0',
> priority 0 and period 0.
>
> Caught std::exception.
> what(): tr1::bad_weak_ptr
This has been fixed in Orocos 2.3 *and* you need boost 1.44.0 or later. There
is one possible way to work around this, in 2.2, see below:
>
> Orocos has detected an uncaught C++ exception
> in the ORO_main() function.
> You might have called a function which throws
> without a try {} catch {} block.
>
> To Debug this situation, issue the following command:
>
> valgrind -v --num-callers=16 ./HelloWorld-gnulinux [options...]
> --nocatch Which will show where the exception occured.
> ( Change num-callers for more/less detail.
> Also, compiling orocos and your program with
> -g adds more usefull information. )
>
> 0.015 [ Info ][Logger] Orocos Logging Deactivated.
> --------------------------------------------
>
>
> The error occurs once I try to provide the service "robot" with the
> operation "mymethod" done by the following lines:
>
> RobotService(const std::string &name) : Service(name)
> {
> this->provides("robot")->addOperation("mymethod",
> &RobotService::mymethod, this, RTT::OwnThread).doc("Returns a friendly
> word."); }
This is probably not what you want anyway. You should have written:
Since the name "robot" will be given in the constructor of your RobotService,
so no need to replicate that. If you write it like this, it will also work in
2.2.
>
> The function mymethod exists. Once I comment out the line it will start
> successfully. If I just uncomment "this->provides("robot");" it will fail
> too with the error above.
>
> Can you help me providing this service?
>
> Thanks
> dani
Peter
hello-5-services runtime error : tr1::bad_weak_ptr
A Dimarts, 5 d'abril de 2011, Peter Soetens va escriure:
>
> This has been fixed in Orocos 2.3 *and* you need boost 1.44.0 or later.
Orocos 2.3.x needs boost 1.44 or later????
hello-5-services runtime error : tr1::bad_weak_ptr
On Tuesday 05 April 2011 10:59:08 Leopold Palomo-Avellaneda wrote:
> A Dimarts, 5 d'abril de 2011, Peter Soetens va escriure:
> > This has been fixed in Orocos 2.3 *and* you need boost 1.44.0 or later.
>
> Orocos 2.3.x needs boost 1.44 or later????
No. But it is required if you want to do 'advanced' stuff with the Service
class. Advanced means: get a shared_ptr to the current Service object in the
constructor of that Service object. In practice, this means using the
provides() function in the constructor of a Service class or subclass.
Peter
hello-5-services runtime error : tr1::bad_weak_ptr
A Dimarts, 5 d'abril de 2011, Peter Soetens va escriure:
> On Tuesday 05 April 2011 10:59:08 Leopold Palomo-Avellaneda wrote:
> > A Dimarts, 5 d'abril de 2011, Peter Soetens va escriure:
> > > This has been fixed in Orocos 2.3 *and* you need boost 1.44.0 or later.
> >
> > Orocos 2.3.x needs boost 1.44 or later????
>
> No. But it is required if you want to do 'advanced' stuff with the Service
> class. Advanced means: get a shared_ptr to the current Service object in the
> constructor of that Service object. In practice, this means using the
> provides() function in the constructor of a Service class or subclass.
ok,
thanks for the clarification.
Leo
hello-5-services runtime error : tr1::bad_weak_ptr
Thanks, it starts now.
But when I type "ls" in the taskbrowser in the Hello component it won't
show me any service. Shouldn't there be now a service called "mymethod" ?
Best
Dani
hello-5-services runtime error : tr1::bad_weak_ptr
On Tuesday 05 April 2011 10:26:23 Daniel Eberli wrote:
> Thanks, it starts now.
>
> But when I type "ls" in the taskbrowser in the Hello component it won't
> show me any service. Shouldn't there be now a service called "mymethod" ?
No, the name of the service should have been 'Robot' and mymethod is an
operation. I know this is confusing, since in ROS, a service is a a single
'function', while in Orocos, a service is a collection of functions, called
operations.
Furthermore, the exercise advises to inherit from the RobotService class. This
is wrong, since we no longer allow to do that :-(
This exercise should be rewritten to reflect the common usage of services
today: a service is a separate library/plugin that can be loaded in a
component in order to extend it with a commonly recuring functionality.
Peter