0
$\begingroup$

Rosanswers logo

Hi

Im having a small problem with my roscore. What happens is while running my code, after a while i publish flags for another program and the flags are never subscribed. Basically this is what happens. I have 2 nodes A and B. A subscribes to a topic "example" and B publishes data into in at around 20Hz. If i start B and then start A its able to subscribe. But if i start A and then start B nothing happens. Bascally what ive found is that if you subscribe to something and then publish, the subscriber will not recieve the data. But if i were publishing and then subscribe, then ill get the data. I know that this is not the problem because ive verified it using rostopic echo and rostopic pub. I echo and publish data, nothing is recieved but if i publish and echo i see the data on the terminal. BTW restarting roscore resolves this issue. The worst part of this is that it also happens when i run the code. Can someone help me out. Im using ros electric on ubuntu 11.10

After the error starts there are 2 cases (only roscore running so far, closed the rest)

Case 1

a. Open a new terminal and type "rostopic pub /stat geometry_msgs/Point -r 20 -- 0 1 0

b. Open another terminal and type "rostopic echo /stat"

In this case i will get the desired output during echo

Case 2

a. Open another terminal and type "rostopic echo /stat"

b. Open a new terminal and type "rostopic pub /stat geometry_msgs/Point -r 20 -- 0 1 0

In this case i do not get any output on the echo

Please tell me if i have made my problem clear


Originally posted by vivek on ROS Answers with karma: 53 on 2012-07-24

Post score: 0


Original comments

Comment by joq on 2012-07-24:
Please edit your question, adding the exact sequence of rostopic commands that demonstrates this failure.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You are probably restarting roscore at some point without realizing it. Note that roslaunch will normally start a new roscore if there is not already one running.

Try starting roscore first in a separate window. That will probably eliminate these problems.

EDIT: Both of those test cases work for me on Oneiric with Fuerte.

EDIT2: If your system is failing randomly, you might try running memory diagnostics on your computer.


Originally posted by joq with karma: 25443 on 2012-07-24

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by vivek on 2012-07-24:
i am running roscore in a separate terminal. Plus if the roscore is restarted then the rostopic echo's shouldn't work any way. But it works only if i start the publisher 1st and then echo. It wont if i echo and then publish.

Comment by dornhege on 2012-07-24:
If you restart a roscore established connections aren't necessarily terminated!

Comment by vivek on 2012-07-24:
@jog theese conditions work for me too. but the problem happens suddenly and randomly. Sometimes after 2 hours of starting roscore , somethimes in 10 mins. Cant pinpoint when this happens as its very very random.

Comment by vivek on 2012-07-24:
@dornhege when i restart roscore i have to restart all the programs to get them working again. The problem comes when the error happens while running the program and some flags arent recieved by the subscriber and i have to restart the program

Comment by dornhege on 2012-07-24:
So, the programs stop working when you restart roscore or you restart roscore because the programs stopped working? Also: Do Case 1 and 2 work for you normally, but just after 2 hours sometimes fail?

Comment by vivek on 2012-07-30:
I restart roscore because the programs stop working. The 2 cases work normally when the error doesn't happen. As soon as it happens case 2 wont work

Comment by vivek on 2012-07-30:
@joq i dont think its a memory issue as nothing else stops. all other applications running in the background is fine. plus my system doesn't fail. only roscore is the problem.

Comment by joq on 2012-07-31:
Why do you think roscore is the problem? Maybe, your nodes are hanging for some reason. Nodes don't normally depend on roscore for continuous operation.

Comment by tfoote on 2012-08-08:
Were you previously publishing on /stat with a different type possibly?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.