Hi, I'm trying to do a simple test to use a parameter tree in my code.
I have the following:
package org.ros.rosjava_tutorial_pubsub;
import org.ros.concurrent.CancellableLoop;
import org.ros.namespace.GraphName;
import org.ros.node.AbstractNodeMain;
import org.ros.node.ConnectedNode;
import org.ros.node.NodeMain;
import org.ros.node.topic.Publisher;
import org.ros.node.parameter.ParameterTree;
public class test extends AbstractNodeMain {
@Override
public GraphName getDefaultNodeName() {
return GraphName.of("rosjava_tutorial_pubsub/test");
}
@Override
public void onStart(final ConnectedNode connectedNode) {
final Publisher publisher = connectedNode
.newPublisher("/cmd_vel", geometry_msgs.Twist._TYPE);
connectedNode.executeCancellableLoop(new CancellableLoop() {
ParameterTree params = connectedNode.newParameterTree();
params.set("rosjava_tutorial_pubsub/test/time", 50);
int max=params.getInteger("rosjava_tutorial_pubsub/test/time");
int contador=0;
@Override
protected void loop() throws InterruptedException {
geometry_msgs.Twist cmd_msg = publisher.newMessage();
if (contador expected
params.set("rosjava_tutorial_pubsub/test/time", 50);
^
/home/user-linux/ros_ws/src/rosjava_foo/dude/src/main/java/org/ros/rosjava_tutorial_pubsub/test.java:26: illegal start of type
params.set("rosjava_tutorial_pubsub/test/time", 50);
^
/home/user-linux/ros_ws/src/rosjava_foo/dude/src/main/java/org/ros/rosjava_tutorial_pubsub/test.java:26: illegal start of type
params.set("rosjava_tutorial_pubsub/test/time", 50);
I don't know what else to do. Any suggestions?
Thank you very much for your time.
↧