-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multi-thread service call in RTC's ROSBridge. #839
Comments
actionlib is designed for this kind of purpose. topic based i/o is good for asynchronous implementation. |
Another way is to use ros::Timer to run main loop. |
Thanks. |
fixing https://github.com/start-jsk/rtmros_common/blob/master/rtmbuild/scripts/idl2srv.py to provide both service call and actionlib may good solution. |
But, in |
Thanks you for your comment.
Yes, I think so.
|
OpenRTMのサービスサーバーは、サービスが呼ばれるたびにそのサービスを処理するスレッドを生成して割り当てるような挙動をします。それに対して、ROSはSingle-threaded spinningもMulti-threaded spinningもあらかじめスレッドの数が決められていて、サービスやトピックやタイマーが呼ばれるたびにスレッドに余りがあれば割り当てていくような挙動をします。 そのため、RTCではスレッド数の上限を意識せずに しっかり直すなら、ROSのActionServerを独自実装して、OpenRTMのようにgoalが呼ばれるたびにそのgoalを処理するスレッドを生成して割り当てるような挙動をするようなActionServerをServiceROSBridgeに入れて、各スレッドの中でRTCに対してOpenRTMのサービスを呼ぶようにする必要があります。 ただ、そこまでしっかり直さなくても、AutoBalancer等の一部のServiceROSBridgeのスレッド数を少し増やせばスレッド数が足りなくなることはほぼ無くなるので、自分の場合は#1128 で実用上は困ることはなくなりました。 |
Currently multi-thread service call is not supported in RTC's ROSBridge.
Example
terminal 1
terminal 2
terminal 3
Expected behaviour
Stop walking on
:emergency-walking-stop
Current behavior
:emergency-walking-stop
is not called soon.In
:go-pos
,goPos()
andwaitFootSteps()
service calls are called.In calling
waitFootSteps()
,AutoBalancerROSBridge
stops atros::spinOnce()
inonExetuce
until walking has finished.After finishing
waitFootSteps()
,AutoBalancerROSBridge
receivesemergencyStop()
service call.To resolve this, Multi-threaded spinning is necessary:
http://wiki.ros.org/roscpp/Overview/Callbacks%20and%20Spinning#Multi-threaded_Spinning
But, it seems only to support
spin()
instead ofspinOnce()
.The text was updated successfully, but these errors were encountered: