Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 package ros.roscpp;
00039
00040 import java.util.Map;
00041 import java.util.concurrent.ExecutionException;
00042
00043 import ros.NodeHandle;
00044 import ros.Publisher;
00045 import ros.Ros;
00046 import ros.RosException;
00047 import ros.ServiceClient;
00048 import ros.ServiceServer;
00049 import ros.Subscriber;
00050 import ros.Topic;
00051 import ros.communication.Time;
00052
00053 public class RosCpp extends Ros {
00054 private static class SingletonHolder {
00055 private static final RosCpp instance = new RosCpp();
00056 }
00057
00058 private boolean isInitialized;
00059
00060 private RosCpp() {}
00061
00062 public static RosCpp getInstance() {return SingletonHolder.instance; }
00063
00064
00065 @Override
00066 public void init(String name, boolean noSigintHandler, boolean anonymousName, boolean noRosout, String [] args) {
00067 if (isInitialized) throw new IllegalArgumentException("ROS has already been initialized.");
00068 if (args == null) args = new String[0];
00069 JNI.init(name, noSigintHandler, anonymousName, noRosout, args);
00070 isInitialized = true;
00071 }
00072
00073 @Override
00074 public boolean isInitialized() {
00075 return isInitialized;
00076 }
00077
00078 @Override
00079 public boolean ok() { return JNI.rosOk(); }
00080
00081 @Override
00082 public NodeHandle createNodeHandle(String ns, Map<String, String> remappings) {
00083 if (!isInitialized) throw new IllegalArgumentException("ROS has not been initialized.");
00084 return new CppNodeHandle(this, ns, remappings);
00085 }
00086
00087 @Override
00088 public Time now() { return JNI.now(); }
00089
00090 @Override
00091 public void spin() { JNI.spin(); }
00092
00093 @Override
00094 public void spinOnce() { JNI.spinOnce(); }
00095
00096 @Override
00097 public String getPackageLocation(String pkgName) {return JNI.getPackageLocation(pkgName);}
00098
00099
00100 public void logDebug(String message) { JNI.logDebug(message); }
00101 public void logInfo(String message) { JNI.logInfo(message); }
00102 public void logWarn(String message) { JNI.logWarn(message); }
00103 public void logError(String message) { JNI.logError(message); }
00104 public void logFatal(String message) { JNI.logFatal(message); }
00105
00106 }
rosjava_jni
Author(s): Maintained by Gheorghe Lisca (lisca@cs.uni-bremen.de) and developed by Jason Wolfe (jawolfe@willowgarage.com), Nicholas Butko (nbutko@cogsci.ucsd.edu), Lorenz Moesenlechner (moesenle@in.tum.de)
autogenerated on Sun Oct 5 2014 22:54:14