Java源码示例:org.ros.node.NodeMainExecutor
示例1
@Override
protected void init(NodeMainExecutor node) {
guestScienceDemoNode = GuestScienceRosMessages.getSingletonInstance();
guestScienceDemoNode.setListener(new GuestScienceRosMessages.OnMessageListener() {
@Override
public void onMessage(final String msg) {
mMainHandler.post(new Runnable() {
@Override
public void run() {
AndroidRosBridgeService.setMsgRobotToService(msg);
}
});
}
});
NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic("10.0.3.15");
nodeConfiguration.setMasterUri(getMasterUri());
node.execute(guestScienceDemoNode, nodeConfiguration);
}
示例2
@Override
protected void init(final NodeMainExecutor node) {
NodeConfiguration nodeConfiguration =
NodeConfiguration.newPublic(
ROS_HOSTNAME, ROS_MASTER_URI);
final PointCloudNode pcn = new PointCloudNode();
node.execute(pcn, nodeConfiguration);
mShutdownFuture = node.getScheduledExecutorService().schedule(new Runnable() {
@Override
public void run() {
node.shutdownNodeMain(pcn);
MainActivity.this.nodeMainExecutorService.forceShutdown();
}
}, 3, TimeUnit.SECONDS);
}
示例3
@Override
protected void init(NodeMainExecutor node) {
mSimpleNode = new SimpleNode();
mSimpleNode.setListener(new SimpleNode.OnMessageListener() {
@Override
public void onMessage(final String msg) {
mMainHandler.post(new Runnable() {
@Override
public void run() {
mRecvText.setText(msg);
}
});
}
});
NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(getRosHostname());
nodeConfiguration.setMasterUri(getMasterUri());
node.execute(mSimpleNode, nodeConfiguration);
}
示例4
@Override
protected void init(NodeMainExecutor node) {
mSimpleNode = new SimpleNode();
mSimpleNode.setListener(new SimpleNode.OnMessageListener() {
@Override
public void onMessage(final String msg) {
mMainHandler.post(new Runnable() {
@Override
public void run() {
mRecvText.setText(msg);
}
});
}
});
NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(getRosHostname());
nodeConfiguration.setMasterUri(getMasterUri());
node.execute(mSimpleNode, nodeConfiguration);
}
示例5
public RVizVisualization(boolean startROSCore, String mapFrameID) {
this.mapFrameID = mapFrameID;
this.robotStatusPublishers = new HashMap<Integer,Publisher<visualization_msgs.MarkerArray>>();
this.dependencyPublishers = new HashMap<Integer,Publisher<visualization_msgs.MarkerArray>>();
this.robotStatusMarkers = new HashMap<Integer,ArrayList<visualization_msgs.Marker>>();
this.dependencyMarkers = new HashMap<Integer,ArrayList<visualization_msgs.Marker>>();
this.boxMarkerPublishers = new HashMap<String,Publisher<visualization_msgs.MarkerArray>>();
this.boxMarkerMarkers = new HashMap<String,ArrayList<visualization_msgs.Marker>>();
if (startROSCore) {
NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic("localhost");
NodeMainExecutor executor = DefaultNodeMainExecutor.newDefault();
executor.execute(this, nodeConfiguration);
RosCore mRosCore = RosCore.newPublic("localhost", 11311);
mRosCore.start();
try {
mRosCore.awaitStart(5, TimeUnit.SECONDS);
}
catch (InterruptedException e) { e.printStackTrace(); }
System.out.println("ROS-core started");
}
}
示例6
@Override
protected void init(NodeMainExecutor nodeMainExecutor) {
mLog.info("MainActivity init");
// Store a reference to the NodeMainExecutor
mNodeMainExecutor = nodeMainExecutor;
getTangoPermission(EXTRA_VALUE_ADF, REQUEST_CODE_ADF_PERMISSION);
getTangoPermission(EXTRA_VALUE_DATASET, REQUEST_CODE_DATASET_PERMISSION);
}
示例7
@Override
protected void init(NodeMainExecutor nodeMainExecutor) {
batteryStatusNode = new BatteryStatusNode();
// Setting configurations for ROS-Android Node
NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic("10.0.3.15");
nodeConfiguration.setMasterUri(getMasterUri());
nodeMainExecutor.execute(batteryStatusNode, nodeConfiguration);
Log.i("LOG", "NODE EXECUTING!");
isNodeExecuting = true;
}
示例8
@Override
protected void init(NodeMainExecutor node) {
RGBLEDNode listener = new RGBLEDNode();
NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(getRosHostname());
nodeConfiguration.setMasterUri(getMasterUri());
node.execute(listener, nodeConfiguration);
}
示例9
@Override
protected void init(NodeMainExecutor node) {
RGBLEDNode listener = new RGBLEDNode();
NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(getRosHostname());
nodeConfiguration.setMasterUri(getMasterUri());
node.execute(listener, nodeConfiguration);
}
示例10
@Override
protected void init(NodeMainExecutor nodeMainExecutor) {
signalStateNode = new SignalStateNode();
// Setting configurations for ROS-Android Node
NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(ROS_HOSTNAME);
nodeConfiguration.setMasterUri(ROS_MASTER_URI);
nodeMainExecutor.execute(signalStateNode, nodeConfiguration);
Log.i("LOG", "NODE EXECUTING!");
isNodeExecuting = true;
}
示例11
@Override
protected void init(NodeMainExecutor nodeMainExecutor) {
this.getBaseContext();
final ManagerNode node = ManagerNode.INSTANCE();
final NodeConfiguration config = NodeConfiguration.newPublic(ROS_HOSTNAME, ROS_MASTER_URI);
node.setContext(this.getBaseContext());
node.setStartTimer(mStartTimer);
nodeMainExecutor.execute(node, config);
}
示例12
@Override
protected void init(NodeMainExecutor nodeMainExecutor) {
cpuStatusNode = new CpuStatusNode(this);
// Setting configurations for ROS-Android Node
NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(ROS_HOSTNAME);
nodeConfiguration.setMasterUri(ROS_MASTER_URI);
nodeMainExecutor.execute(cpuStatusNode, nodeConfiguration);
Log.i("LOG", "NODE EXECUTING!");
isNodeExecuting = true;
}
示例13
@Override
protected void init(NodeMainExecutor nodeMainExecutor) {
diskStateNode = new DiskStateNode();
// Setting configurations for ROS-Android Node
NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(ROS_HOSTNAME);
nodeConfiguration.setMasterUri(ROS_MASTER_URI);
nodeMainExecutor.execute(diskStateNode, nodeConfiguration);
Log.i("LOG", "NODE EXECUTING!");
isNodeExecuting = true;
}
示例14
@Override
protected void init(NodeMainExecutor nodeMainExecutor) {
batteryStatusNode = new BatteryStatusNode();
// Setting configurations for ROS-Android Node
NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic("hlp");
nodeConfiguration.setMasterUri(getMasterUri());
nodeMainExecutor.execute(batteryStatusNode, nodeConfiguration);
Log.i("LOG", "NODE EXECUTING!");
isNodeExecuting = true;
}
示例15
public static NodeMainExecutor getExecutor() {
if (s_local == null) {
s_local = Executors.newSingleThreadExecutor(new NamedThreadFactory("NodeMain Local", true));
}
if (s_executor == null)
s_executor = DefaultNodeMainExecutor.newDefault();
return s_executor;
}
示例16
@Override
protected void init(NodeMainExecutor nodeMainExecutor) {
NodeMain node = new SimplePublisherNode();
NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(InetAddressFactory.newNonLoopback().getHostAddress());
nodeConfiguration.setMasterUri(getMasterUri());
nodeMainExecutor.execute(node, nodeConfiguration);
}
示例17
public KobukiNodeLoader(NodeMainExecutor nme, URI rosMasterUri, String rosHostname) {
super(nme, rosMasterUri, rosHostname);
}
示例18
public AbstractBaseNodeLoader(NodeMainExecutor nme, URI rosMasterUri, String rosHostname) {
super(nme, rosMasterUri, rosHostname);
}
示例19
public UsbDeviceNodeLoader(NodeMainExecutor nme, URI rosMasterUri, String rosHostname) {
mNodeMainExecutor = nme;
mRosHostname = rosHostname;
mRosMasterUri = rosMasterUri;
}
示例20
@Override
protected void init(NodeMainExecutor nodeMainExecutor) {
try {
java.net.Socket socket = new java.net.Socket(getMasterUri().getHost(), getMasterUri().getPort());
java.net.InetAddress local_network_address = socket.getLocalAddress();
socket.close();
this.nodeMainExecutor = nodeMainExecutor;
this.nodeConfiguration =
NodeConfiguration.newPublic(local_network_address.getHostAddress(), getMasterUri());
runOnUiThread(new Runnable() {
@Override
public void run() {
joystickFragment.invalidate();
}
});
//controller.setTopicName(PreferenceManager.getDefaultSharedPreferences(this).getString("edittext_joystick_topic", getString(R.string.joy_topic)));
controller.initialize(nodeMainExecutor, nodeConfiguration);
// Add the HUDFragment to the RobotController's odometry listener
controller.addOdometryListener(hudFragment);
// Add the JoystickView to the RobotController's odometry listener
controller.addOdometryListener(joystickFragment.getJoystickView());
// Create and add a WarningSystem
controller.addLaserScanListener(warningSystem = new WarningSystem(this));
// // Add the LaserScanMap
// controller.addLaserScanListener(laserScanMap);
runOnUiThread(new Runnable() {
@Override
public void run() {
View temp = mDrawerList.getChildAt(drawerIndex);
mDrawerList.onTouchEvent(MotionEvent.obtain(SystemClock.uptimeMillis(),
SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN, temp.getX(), temp.getY(), 0));
selectItem(drawerIndex);
}
});
} catch (Exception e) {
// Socket problem
Log.e(TAG, "socket error trying to get networking information from the master uri", e);
}
}
示例21
/**
* Called when the Fragment is initialized.
* @param mainExecutor The NodeMainExecutor with which to register subscribers/publishers
* @param nodeConfiguration The NodeConfiguration
*/
public void initialize(NodeMainExecutor mainExecutor, NodeConfiguration nodeConfiguration) {
this.nodeMainExecutor = mainExecutor;
this.nodeConfiguration = nodeConfiguration;
setInitialized(true);
}
示例22
/**
* Initializes the RobotController.
* @param nodeMainExecutor The NodeMainExecutor on which to execute the NodeConfiguration.
* @param nodeConfiguration The NodeConfiguration to execute
*/
public void initialize(NodeMainExecutor nodeMainExecutor, NodeConfiguration nodeConfiguration) {
nodeMainExecutor.execute(this, nodeConfiguration.setNodeName("android/robot_controller"));
}
示例23
/**
* @param nodeMainExecutor
* the newly created {@link NodeMainExecutor}
*/
void onNewNodeMainExecutor(NodeMainExecutor nodeMainExecutor);
示例24
/**
* This method is called in a background thread once this {@link Activity} has
* been initialized with a master {@link URI} via the {@link MasterChooser}
* and a {@link NodeMainExecutorService} has started. Your {@link NodeMain}s
* should be started here using the provided {@link NodeMainExecutor}.
*
* @param nodeMainExecutor
* the {@link NodeMainExecutor} created for this {@link Activity}
*/
protected abstract void init(NodeMainExecutor nodeMainExecutor);
示例25
protected abstract void init(NodeMainExecutor nodeMainExecutor);
示例26
protected abstract void init(NodeMainExecutor nodeMainExecutor);
示例27
protected abstract void init(NodeMainExecutor nodeMainExecutor);
示例28
protected abstract void init(NodeMainExecutor nodeMainExecutor);
示例29
protected abstract void init(NodeMainExecutor nodeMainExecutor);