publish message in main class instead of talker
Hi all,
I'm working on a project that receives data from a sensor and sends the data back to pc using rosjava.
I'm trying to realize this function on the base of rosjava_tutorial_pubsub. I realized almost all the tutorials tend to use NodeMainExecute to run a node, and the publish function is implemented in the Talker.java itself.
Since my data are retrieved and stored in the main class and updates constantly, i want to publish my message in main class, which means moving the following snippet from talker.java into main.java.
org.ros.message.std_msgs.String str = publisher.newMessage();
str.data = mdata;
publisher.publish(str);
how should I modify the main.java? Should I add a variable Publisher publisher in the beginning?
actually I want to run roscore on PC.
as far as I understand, I should create a main class which implements NodeMain. Then link my own application as source?