gok03 / rosjava

Automatically exported from code.google.com/p/rosjava
0 stars 0 forks source link

ClockTopicTimeProvider & use_sim_time #120

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Explicitly create an external TimeProvider

2. Prior to NodeMain submission/execution, use 
nodeConfiguration.setTimeProvider() with the provider created in (1)

3. Exceptions only occur for me after submission of a second NodeMain

Because I'm working with a non-public, proprietary simulator and a mixed 
rosjava/roscpp setup, it's difficult for me to provide exact steps in a 
commonly available setup that will reproduce the issue.

What is the expected output? What do you see instead?
No output is expected (proper operation). Instead, an endless sequence of 
exceptions with increasing thread numbers is generated, like so:

Exception in thread "pool-1-thread-40" java.lang.NullPointerException
    at org.ros.time.ClockTopicTimeProvider$1.onNewMessage(ClockTopicTimeProvider.java:45)
    at org.ros.time.ClockTopicTimeProvider$1.onNewMessage(ClockTopicTimeProvider.java:42)
    at org.ros.internal.transport.IncomingMessageQueue$Dispatcher$1.run(IncomingMessageQueue.java:86)
    at org.ros.internal.transport.IncomingMessageQueue$Dispatcher$1.run(IncomingMessageQueue.java:83)
    at org.ros.concurrent.ListenerCollection$1.run(ListenerCollection.java:117)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:679)

What version of the product are you using? On what operating system?
Updated rosjava_core today, June 11, 2012, Ubuntu 12.04.

Please provide any additional information below.
I believe this may be similar to (or the same as) the problem referenced in 
http://code.google.com/p/rosjava/issues/detail?id=119

A diff of a fix that works for me is attached; it consists of a two line change 
to the 'org.ros.internal.node.DefaultNode.java' file in the rosjava package:

1. Add the following import:

import org.ros.time.WallTimeProvider;

2. In the 'start()' method, change the line:

if (useSimTime) {

to:

if (useSimTime && nodeConfiguration.getTimeProvider() instanceof 
WallTimeProvider) {

Original issue reported on code.google.com by jkramert...@gmail.com on 11 Jun 2012 at 7:03

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by damonkoh...@google.com on 3 Jul 2012 at 8:24