当前位置: 首页>>代码示例>>Java>>正文


Java NodeConfiguration.setNodeName方法代码示例

本文整理汇总了Java中org.ros.node.NodeConfiguration.setNodeName方法的典型用法代码示例。如果您正苦于以下问题:Java NodeConfiguration.setNodeName方法的具体用法?Java NodeConfiguration.setNodeName怎么用?Java NodeConfiguration.setNodeName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.ros.node.NodeConfiguration的用法示例。


在下文中一共展示了NodeConfiguration.setNodeName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startMoveBaseNode

import org.ros.node.NodeConfiguration; //导入方法依赖的package包/类
private void startMoveBaseNode() {
    // Create ROS node for base move
    mLog.info("Starting move base native node");
    mRosNavigationStatusIndicator.updateStatus(ModuleStatusIndicator.Status.LOADING);
    NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(mHostName);
    nodeConfiguration.setMasterUri(mMasterUri);
    nodeConfiguration.setNodeName(MoveBaseNode.NODE_NAME);
    mMoveBaseNode = new MoveBaseNode();
    mNodeMainExecutor.execute(mMoveBaseNode, nodeConfiguration,
            new ArrayList<NodeListener>(){{
                add(new DefaultNodeListener() {
                    @Override
                    public void onStart(ConnectedNode connectedNode) {
                        mRosNavigationStatusIndicator.updateStatus(ModuleStatusIndicator.Status.OK);
                    }

                    @Override
                    public void onError(Node node, Throwable throwable) {
                        mRosNavigationStatusIndicator.updateStatus(ModuleStatusIndicator.Status.ERROR);
                    }
                });
            }});
}
 
开发者ID:ekumenlabs,项目名称:tangobot,代码行数:24,代码来源:MainActivity.java

示例2: build

import org.ros.node.NodeConfiguration; //导入方法依赖的package包/类
NodeConfiguration build() {
    final NodeConfiguration config = NodeConfiguration.newPublic(getHost());
    config.setMasterUri(getMasterUri());
    config.setParentResolver(buildParentResolver());
    config.setRosRoot(null);
    config.setRosPackagePath(getRosPackagePath());
    if (m_nodeName != null) {
        config.setNodeName(m_nodeName);
    }
    if (m_tcpPort > 0) {
        config.setTcpRosBindAddress(BindAddress.newPublic(m_tcpPort));
    }
    if (m_rpcPort > 0) {
        config.setXmlRpcBindAddress(BindAddress.newPublic(m_rpcPort));
    }
    return config;
}
 
开发者ID:nasa,项目名称:astrobee_android,代码行数:18,代码来源:RobotConfiguration.java

示例3: init

import org.ros.node.NodeConfiguration; //导入方法依赖的package包/类
/**
* A rosjava callback for RosActivity which gives one the opportunity to spawn
* nodes (subclasses of NodeMain).
*/
@Override
protected void init(NodeMainExecutor nodeMainExecutor)
/*************************************************************************/
{
    NodeConfiguration nodeConfiguration1 =
        NodeConfiguration.newPublic(InetAddressFactory.newNonLoopback().getHostAddress(),
            getMasterUri());
    nodeConfiguration1.setNodeName("ShieldTeleop/ImageView");

    NodeConfiguration nodeConfiguration2 =
            NodeConfiguration.newPublic(InetAddressFactory.newNonLoopback().getHostAddress(),
                    getMasterUri());
    nodeConfiguration2.setNodeName("ShieldTeleop/JoystickNode");

    //Here we start each node thread (subclass of NodeMain) which run inside an Android service
    //(i.e. basically a persistent background daemon).
    nodeMainExecutor.execute(videoStreamView_, nodeConfiguration1);
    nodeMainExecutor.execute(joystickHandler_, nodeConfiguration2);
}
 
开发者ID:willowgarage,项目名称:shield_teleop,代码行数:24,代码来源:MainActivity.java

示例4: startExtrinsicsPublisherNodes

import org.ros.node.NodeConfiguration; //导入方法依赖的package包/类
private void startExtrinsicsPublisherNodes() {
    // Create ROS node for extrinsics publisher node
    mLog.info("Starting extrinsics publishers");
    NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(mHostName);
    nodeConfiguration.setMasterUri(mMasterUri);
    nodeConfiguration.setNodeName(DefaultMapTfPublisherNode.NODE_NAME);
    mMapExtrinsicsTfPublisherNode = new DefaultMapTfPublisherNode();
    mNodeMainExecutor.execute(mMapExtrinsicsTfPublisherNode, nodeConfiguration);

    nodeConfiguration.setNodeName(DefaultRobotTfPublisherNode.NODE_NAME);
    mRobotExtrinsicsTfPublisherNode = new DefaultRobotTfPublisherNode(getDeviceTransform());
    mNodeMainExecutor.execute(mRobotExtrinsicsTfPublisherNode, nodeConfiguration);
}
 
开发者ID:ekumenlabs,项目名称:tangobot,代码行数:14,代码来源:MainActivity.java

示例5: startMapServerNode

import org.ros.node.NodeConfiguration; //导入方法依赖的package包/类
private void startMapServerNode() {
    // Create ROS node to publish the map
    mLog.info("Starting map server");
    NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(mHostName);
    nodeConfiguration.setMasterUri(mMasterUri);
    nodeConfiguration.setNodeName(OccupancyGridPublisherNode.NODE_NAME);
    mOccupancyGridPublisherNode = new OccupancyGridPublisherNode(new EmptyMapGenerator());
    mNodeMainExecutor.execute(mOccupancyGridPublisherNode, nodeConfiguration);
}
 
开发者ID:ekumenlabs,项目名称:tangobot,代码行数:10,代码来源:MainActivity.java

示例6: startDeviceBatteryPublisherNode

import org.ros.node.NodeConfiguration; //导入方法依赖的package包/类
private void startDeviceBatteryPublisherNode() {
    mLog.info("Starting device battery publisher");
    NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(mHostName);
    nodeConfiguration.setMasterUri(mMasterUri);
    nodeConfiguration.setNodeName(DeviceBatteryPublisherNode.NODE_NAME);
    mDeviceBatteryPublisherNode = new DeviceBatteryPublisherNode(getApplicationContext());
    mNodeMainExecutor.execute(mDeviceBatteryPublisherNode, nodeConfiguration);
}
 
开发者ID:ekumenlabs,项目名称:tangobot,代码行数:9,代码来源:MainActivity.java

示例7: startNodes

import org.ros.node.NodeConfiguration; //导入方法依赖的package包/类
@Override
public NodeMain[] startNodes(UsbDevice baseUsbDevice, UsbManager usbManager) throws Exception {
    if(baseUsbDevice == null) {
        throw new Exception("null USB device provided");
    }
    log.info("Starting base node");

    // Wrap the UsbDevice in the HoHo Driver
    UsbSerialDriver driver = serialDriverForDevice(baseUsbDevice, usbManager);
    UsbDeviceConnection connection = serialConnectionForDevice(usbManager, driver);

    if (connection == null) {
        throw new Exception("No USB connection available to initialize device");
    }

    UsbSerialPort port = serialPortForDevice(driver);

    // Choose the appropriate BaseDevice implementation for the particular
    // robot base, using the corresponding subclass
    BaseDevice baseDevice = getBaseDevice(port, connection);

    // Create the ROS nodes
    log.info("Create base controller node");
    mBaseControllerNode = new BaseControllerNode(baseDevice, "/cmd_vel");
    NodeConfiguration baseControllerNodeConf = NodeConfiguration.newPublic(mRosHostname);
    baseControllerNodeConf.setNodeName(GraphName.of("base_controller"));
    baseControllerNodeConf.setMasterUri(mRosMasterUri);
    mNodeMainExecutor.execute(mBaseControllerNode, baseControllerNodeConf);

    mBatteryPublisherNode = new RobotBatteryPublisherNode(baseDevice);
    NodeConfiguration batteryPublisherConf = NodeConfiguration.newPublic(mRosHostname);
    batteryPublisherConf.setNodeName(mBaseControllerNode.getDefaultNodeName());
    batteryPublisherConf.setMasterUri(mRosMasterUri);
    mNodeMainExecutor.execute(mBatteryPublisherNode, batteryPublisherConf);

    return new NodeMain[]{mBaseControllerNode, mBaseOdomPublisher};
}
 
开发者ID:ekumenlabs,项目名称:tangobot,代码行数:38,代码来源:AbstractBaseNodeLoader.java

示例8: build

import org.ros.node.NodeConfiguration; //导入方法依赖的package包/类
public NodeConfiguration build() {
  this.parseRemappingArguments();
  NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(this.getHost());
  nodeConfiguration.setParentResolver(this.buildParentResolver());
  nodeConfiguration.setRosRoot(this.getRosRoot());
  nodeConfiguration.setRosPackagePath(this.getRosPackagePath());
  nodeConfiguration.setMasterUri(this.getMasterUri());
  if (this.specialRemappings.containsKey("__name")) {
    nodeConfiguration.setNodeName(this.specialRemappings.get("__name"));
  }

  return nodeConfiguration;
}
 
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:14,代码来源:ROSLoader.java

示例9: startTangoRosNode

import org.ros.node.NodeConfiguration; //导入方法依赖的package包/类
public void startTangoRosNode() {
    mTangoStatusIndicator.updateStatus(ModuleStatusIndicator.Status.LOADING);

    if (TangoInitializationHelper.loadTangoSharedLibrary() != TangoInitializationHelper.ARCH_ERROR &&
            TangoInitializationHelper.loadTangoRosNodeSharedLibrary() != TangoInitializationHelper.ARCH_ERROR) {

        // Remap topic names from default Tango ROS Node to those used in the standard
        // Turtlebot demos and apps.
        String[] topicMap = {
                "/tango/laser_scan:=/scan",
                "/tango/camera/color_1/image_raw/compressed:=/compressed_image"
        };

        mTangoNodeletManager = new TangoNodeletManager(topicMap);
        TangoInitializationHelper.bindTangoService(this, mTangoServiceConnection);
        if (TangoInitializationHelper.isTangoVersionOk()) {
            mLog.info("Tango Core version is supposedly OK, starting Tango node.");

            // ServiceClient node which is responsible for calling ros services.
            mTangoServiceClient = new TangoServiceClientNode();
            mTangoServiceClient.setCallbackListener(this);
            NodeConfiguration nodeConfiguration = NodeConfiguration.newPublic(mHostName);
            nodeConfiguration.setMasterUri(mMasterUri);
            nodeConfiguration.setNodeName(mTangoServiceClient.getDefaultNodeName());
            mNodeMainExecutor.execute(mTangoServiceClient, nodeConfiguration);

            // Create and start Tango ROS Node
            nodeConfiguration.setNodeName(TangoNodeletManager.NODE_NAME);
            ArrayList<NodeListener> listeners = new ArrayList<>();
            listeners.add(new DefaultNodeListener() {
                @Override
                public void onStart(ConnectedNode connectedNode) {
                    boolean connected = false;
                    try {
                        for (int i = 0; i < MAX_TANGO_CONNECTION_TRIES; i++) {
                            if (mTangoServiceClient.callTangoConnectService(TangoConnectRequest.CONNECT)) {
                                mLog.info("Successfully connected to Tango");
                                connected = true;
                                break;
                            }
                            mLog.warn("Failed to connect to Tango, try " + i);
                            Thread.sleep(200);
                        }
                    } catch (InterruptedException e) {
                        mLog.warn("Tango connection loop interrupted.", e);
                    }
                    if (!connected) {
                        mLog.error("Failed to connect to Tango.");
                        mTangoStatusIndicator.updateStatus(ModuleStatusIndicator.Status.ERROR);
                    }
                }

                @Override
                public void onError(Node node, Throwable throwable) {
                    mLog.error("Error running TangoRosNode", throwable);
                    mTangoStatusIndicator.updateStatus(ModuleStatusIndicator.Status.ERROR);
                }
            });
            mNodeMainExecutor.execute(mTangoNodeletManager, nodeConfiguration, listeners);
        } else {
            mLog.error(getString(R.string.tango_version_error));
            mTangoStatusIndicator.updateStatus(ModuleStatusIndicator.Status.ERROR);
            displayToastMessage(R.string.tango_version_error);
        }
    } else {
        mLog.error(getString(R.string.tango_lib_error));
        mTangoStatusIndicator.updateStatus(ModuleStatusIndicator.Status.ERROR);
        displayToastMessage(R.string.tango_lib_error);
    }
}
 
开发者ID:ekumenlabs,项目名称:tangobot,代码行数:71,代码来源:MainActivity.java


注:本文中的org.ros.node.NodeConfiguration.setNodeName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。