ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

SingleThreadedSpinner error: json_prolog launch knowrob

asked 2014-12-03 11:13:44 -0600

olchandra gravatar image

updated 2014-12-03 11:14:12 -0600

Hello. I am starting two threads using a predicate as query in json_prolog: one for subscribing to topics and other pops the callback to make assertions. There are separate spin() for both of them. It is similar to the one given in knowrob_perception_tutorial. When I start the json_prolog node, and start the thread by querying a predicate, I get "SingleThreadedSpinner: use MultiThreadedSpinner" error. The same code works perfectly with rosprolog load method. This is after I solved this error. Thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-12-04 05:16:50 -0600

moritz gravatar image

You are using the catkinized KnowRob that uses rosjava, not rosjava_jni, right? There is no spinner in rosjava any more, see here. It may be that you have been confused by the old Java files in knowrob_perception_tutorial (that used the older rosjava_jni), which I had forgotten to remove. This is the current approach to use.

If you use the older, rosbuild-based KnowRob that is based on rosjava_jni: This rosjava version wraps around roscpp, which would explain your error message. Spin() may only be called by one thread, i.e. you can remove the calls to 'spin()' in the other threads. However, I'd recommend to avoid rosjava_jni altogether since it's not actively maintained any more.

edit flag offensive delete link more

Comments

Thank you Moritz. I have installed Knowrob in fuerte, so I am afraid I'll have to use rosjava_jni. Do you think I can have rosjava(catkinized) working in fuerte or, if there is another workaround? Currently it does not accept even a single spin() from my class and throws the above error.

olchandra gravatar image olchandra  ( 2014-12-04 06:18:57 -0600 )edit
1

Have you tried to simply remove the spin()? As long as it's called in one thread, the messages should still be processed, so I expect everything to be fine. If there was no other spin(), you would not get this error message.

moritz gravatar image moritz  ( 2014-12-04 12:56:32 -0600 )edit

Hi. Yes. removing all the spin() and sub-shutdown() did the job. Thanks

olchandra gravatar image olchandra  ( 2014-12-08 09:24:35 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2014-12-03 11:13:44 -0600

Seen: 175 times

Last updated: Dec 04 '14