Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 package org.ros.android.android_tutorial_map_viewer;
00018
00019 import org.ros.namespace.GraphName;
00020 import org.ros.node.AbstractNodeMain;
00021 import org.ros.node.ConnectedNode;
00022 import org.ros.node.Node;
00023 import org.ros.node.topic.Publisher;
00024
00028 public class SystemCommands extends AbstractNodeMain {
00029
00030 private Publisher<std_msgs.String> publisher;
00031
00032 @Override
00033 public GraphName getDefaultNodeName() {
00034 return GraphName.of("system_commands");
00035 }
00036
00037 @Override
00038 public void onStart(ConnectedNode connectedNode) {
00039 publisher = connectedNode.newPublisher("syscommand", std_msgs.String._TYPE);
00040 }
00041
00042 public void reset() {
00043 publish("reset");
00044 }
00045
00046 public void saveGeotiff() {
00047 publish("savegeotiff");
00048 }
00049
00050 private void publish(String command) {
00051 if (publisher != null) {
00052 std_msgs.String message = publisher.newMessage();
00053 message.setData(command);
00054 publisher.publish(message);
00055 }
00056 }
00057
00058 @Override
00059 public void onShutdown(Node arg0) {
00060 publisher = null;
00061 }
00062 }