• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GraphName类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.ros.namespace.GraphName的典型用法代码示例。如果您正苦于以下问题:Java GraphName类的具体用法?Java GraphName怎么用?Java GraphName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GraphName类属于org.ros.namespace包,在下文中一共展示了GraphName类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onStart

import org.ros.namespace.GraphName; //导入依赖的package包/类
@Override
public void onStart(final VisualizationView view, ConnectedNode connectedNode) {
  super.onStart(view, connectedNode);
  shape = new GoalShape();
  getSubscriber().addMessageListener(new MessageListener<geometry_msgs.PoseStamped>() {
    @Override
    public void onNewMessage(geometry_msgs.PoseStamped pose) {
      GraphName source = GraphName.of(pose.getHeader().getFrameId());
      FrameTransform frameTransform = view.getFrameTransformTree().transform(source, targetFrame);
      if (frameTransform != null) {
        Transform poseTransform = Transform.fromPoseMessage(pose.getPose());
        shape.setTransform(frameTransform.getTransform().multiply(poseTransform));
        ready = true;
      }
    }
  });
}
 
开发者ID:frankjoshua,项目名称:AndroidRosJava,代码行数:18,代码来源:PoseSubscriberLayer.java


示例2: updateVertexBuffer

import org.ros.namespace.GraphName; //导入依赖的package包/类
private void updateVertexBuffer(nav_msgs.Path path) {
  ByteBuffer goalVertexByteBuffer =
      ByteBuffer.allocateDirect(path.getPoses().size() * 3 * Float.SIZE / 8);
  goalVertexByteBuffer.order(ByteOrder.nativeOrder());
  vertexBuffer = goalVertexByteBuffer.asFloatBuffer();
  if (path.getPoses().size() > 0) {
    frame = GraphName.of(path.getPoses().get(0).getHeader().getFrameId());
    // Path poses are densely packed and will make the path look like a solid
    // line even if it is drawn as points. Skipping poses provides the visual
    // point separation were looking for.
    int i = 0;
    for (PoseStamped pose : path.getPoses()) {
      // TODO(damonkohler): Choose the separation between points as a pixel
      // value. This will require inspecting the zoom level from the camera.
      if (i % 15 == 0) {
        vertexBuffer.put((float) pose.getPose().getPosition().getX());
        vertexBuffer.put((float) pose.getPose().getPosition().getY());
        vertexBuffer.put((float) pose.getPose().getPosition().getZ());
      }
      i++;
    }
  }
  vertexBuffer.position(0);
}
 
开发者ID:frankjoshua,项目名称:AndroidRosJava,代码行数:25,代码来源:PathLayer.java


示例3: update

import org.ros.namespace.GraphName; //导入依赖的package包/类
void update(nav_msgs.OccupancyGrid message) {
  ChannelBuffer buffer = message.getData();
  Bitmap bitmap =
      BitmapFactory.decodeByteArray(buffer.array(), buffer.arrayOffset(), buffer.readableBytes());
  int stride = bitmap.getWidth();
  int height = bitmap.getHeight();
  Preconditions.checkArgument(stride <= 1024);
  Preconditions.checkArgument(height <= 1024);
  int[] pixels = new int[stride * height];
  bitmap.getPixels(pixels, 0, stride, 0, 0, stride, height);
  for (int i = 0; i < pixels.length; i++) {
    // Pixels are ARGB packed ints.
    if (pixels[i] == 0xffffffff) {
      pixels[i] = COLOR_UNKNOWN;
    } else if (pixels[i] == 0xff000000) {
      pixels[i] = COLOR_FREE;
    } else {
      pixels[i] = COLOR_OCCUPIED;
    }
  }
  float resolution = message.getInfo().getResolution();
  Transform origin = Transform.fromPoseMessage(message.getInfo().getOrigin());
  textureBitmap.updateFromPixelArray(pixels, stride, resolution, origin, COLOR_UNKNOWN);
  frame = GraphName.of(message.getHeader().getFrameId());
  ready = true;
}
 
开发者ID:frankjoshua,项目名称:AndroidRosJava,代码行数:27,代码来源:CompressedOccupancyGridLayer.java


示例4: onStart

import org.ros.namespace.GraphName; //导入依赖的package包/类
@Override
public void onStart(final VisualizationView view, ConnectedNode connectedNode) {
  super.onStart(view, connectedNode);
  getSubscriber().addMessageListener(new MessageListener<nav_msgs.GridCells>() {
    @Override
    public void onNewMessage(nav_msgs.GridCells data) {
      frame = GraphName.of(data.getHeader().getFrameId());
      if (view.getFrameTransformTree().lookUp(frame) != null) {
        if (lock.tryLock()) {
          message = data;
          ready = true;
          lock.unlock();
        }
      }
    }
  });
}
 
开发者ID:frankjoshua,项目名称:AndroidRosJava,代码行数:18,代码来源:GridCellsLayer.java


示例5: parseRemappingArguments

import org.ros.namespace.GraphName; //导入依赖的package包/类
private void parseRemappingArguments() {
  Iterator iterator = this.remappingArguments.iterator();

  while (iterator.hasNext()) {
    String remapping = (String) iterator.next();
    Preconditions.checkState(remapping.contains(":="));
    String[] remap = remapping.split(":=");
    if (remap.length > 2) {
      throw new IllegalArgumentException("Invalid remapping argument: " + remapping);
    }

    if (remapping.startsWith("__")) {
      this.specialRemappings.put(remap[0], remap[1]);
    } else {
      this.remappings.put(GraphName.of(remap[0]), GraphName.of(remap[1]));
    }
  }

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


示例6: onStart

import org.ros.namespace.GraphName; //导入依赖的package包/类
@Override
public void onStart(ConnectedNode connectedNode) {
    final Publisher<std_msgs.String> publisher = connectedNode.newPublisher(GraphName.of("time"), std_msgs.String._TYPE);

    final CancellableLoop loop = new CancellableLoop() {
        @Override
        protected void loop() throws InterruptedException {
            // retrieve current system time
            String time = new SimpleDateFormat("HH:mm:ss").format(new Date());

            Log.i(TAG, "publishing the current time: " + time);

            // create and publish a simple string message
            std_msgs.String str = publisher.newMessage();
            str.setData("The current time is: " + time);
            publisher.publish(str);

            // go to sleep for one second
            Thread.sleep(1000);
        }
    };
    connectedNode.executeCancellableLoop(loop);
}
 
开发者ID:ollide,项目名称:rosjava_android_template,代码行数:24,代码来源:SimplePublisherNode.java


示例7: startNodes

import org.ros.namespace.GraphName; //导入依赖的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: buildParentResolver

import org.ros.namespace.GraphName; //导入依赖的package包/类
private NameResolver buildParentResolver() {
    GraphName namespace = GraphName.root();
    if (m_environment.containsKey(org.ros.EnvironmentVariables.ROS_NAMESPACE)) {
        namespace = GraphName.of(m_environment.get(org.ros.EnvironmentVariables.ROS_NAMESPACE)).toGlobal();
    }
    return new NameResolver(namespace, m_remappings);
}
 
开发者ID:nasa,项目名称:astrobee_android,代码行数:8,代码来源:RobotConfiguration.java


示例9: drawLayers

import org.ros.namespace.GraphName; //导入依赖的package包/类
private void drawLayers(GL10 gl) {
  for (Layer layer : view.getLayers()) {
    gl.glPushMatrix();
    if (layer instanceof TfLayer) {
      GraphName layerFrame = ((TfLayer) layer).getFrame();
      if (layerFrame != null && view.getCamera().applyFrameTransform(gl, layerFrame)) {
        layer.draw(view, gl);
      }
    } else {
      layer.draw(view, gl);
    }
    gl.glPopMatrix();
  }
}
 
开发者ID:frankjoshua,项目名称:AndroidRosJava,代码行数:15,代码来源:XYOrthographicRenderer.java


示例10: applyFrameTransform

import org.ros.namespace.GraphName; //导入依赖的package包/类
public boolean applyFrameTransform(GL10 gl, GraphName frame) {
  Preconditions.checkNotNull(frame);
  if (this.frame != null) {
    FrameTransform frameTransform = frameTransformTree.transform(frame, this.frame);
    if (frameTransform != null) {
      OpenGlTransform.apply(gl, frameTransform.getTransform());
      return true;
    }
  }
  return false;
}
 
开发者ID:frankjoshua,项目名称:AndroidRosJava,代码行数:12,代码来源:XYOrthographicCamera.java


示例11: toFrame

import org.ros.namespace.GraphName; //导入依赖的package包/类
/**
 * @param pixelX the x coordinate on the screen (origin top left) in pixels
 * @param pixelY the y coordinate on the screen (origin top left) in pixels
 * @param frame  the frame to transform the coordinates into (e.g. "map")
 * @return the pixel coordinate in the specified frame
 */
public Transform toFrame(final int pixelX, final int pixelY, final GraphName frame) {
  final Transform translation = Transform.translation(toCameraFrame(pixelX, pixelY));
  final FrameTransform cameraToFrame =
      frameTransformTree.transform(this.frame, frame);
  return cameraToFrame.getTransform().multiply(translation);
}
 
开发者ID:frankjoshua,项目名称:AndroidRosJava,代码行数:13,代码来源:XYOrthographicCamera.java


示例12: setFrame

import org.ros.namespace.GraphName; //导入依赖的package包/类
/**
 * Changes the camera frame to the specified frame.
 * <p/>
 * If possible, the camera will avoid jumping on the next frame.
 *
 * @param frame the new camera frame
 */
public void setFrame(GraphName frame) {
  Preconditions.checkNotNull(frame);
  synchronized (mutex) {
    if (this.frame != null && this.frame != frame) {
      FrameTransform frameTransform = frameTransformTree.transform(frame, this.frame);
      if (frameTransform != null) {
        // Best effort to prevent the camera from jumping. If we don't have
        // the transform yet, we can't help matters.
        cameraToRosTransform = cameraToRosTransform.multiply(frameTransform.getTransform());
      }
    }
    this.frame = frame;
  }
}
 
开发者ID:frankjoshua,项目名称:AndroidRosJava,代码行数:22,代码来源:XYOrthographicCamera.java


示例13: jumpToFrame

import org.ros.namespace.GraphName; //导入依赖的package包/类
/**
 * Changes the camera frame to the specified frame and aligns the camera with
 * the new frame.
 *
 * @param frame the new camera frame
 */
public void jumpToFrame(GraphName frame) {
  synchronized (mutex) {
    this.frame = frame;
    final double scale = cameraToRosTransform.getScale();
    resetTransform();
    cameraToRosTransform = cameraToRosTransform.scale(scale / cameraToRosTransform.getScale());
  }
}
 
开发者ID:frankjoshua,项目名称:AndroidRosJava,代码行数:15,代码来源:XYOrthographicCamera.java


示例14: onStart

import org.ros.namespace.GraphName; //导入依赖的package包/类
@Override
public void onStart(VisualizationView view, ConnectedNode connectedNode) {
  super.onStart(view, connectedNode);
  Subscriber<LaserScan> subscriber = getSubscriber();
  subscriber.addMessageListener(new MessageListener<LaserScan>() {
    @Override
    public void onNewMessage(LaserScan laserScan) {
      frame = GraphName.of(laserScan.getHeader().getFrameId());
      updateVertexBuffer(laserScan, LASER_SCAN_STRIDE);
    }
  });
}
 
开发者ID:frankjoshua,项目名称:AndroidRosJava,代码行数:13,代码来源:LaserScanLayer.java


示例15: onStart

import org.ros.namespace.GraphName; //导入依赖的package包/类
@Override
public void onStart(VisualizationView view, ConnectedNode connectedNode) {
  super.onStart(view, connectedNode);
  Subscriber<PointCloud2> subscriber = getSubscriber();
  subscriber.addMessageListener(new MessageListener<PointCloud2>() {
    @Override
    public void onNewMessage(PointCloud2 pointCloud) {
      frame = GraphName.of(pointCloud.getHeader().getFrameId());
      updateVertexBuffer(pointCloud);
    }
  });
}
 
开发者ID:frankjoshua,项目名称:AndroidRosJava,代码行数:13,代码来源:PointCloud2DLayer.java


示例16: GridCellsLayer

import org.ros.namespace.GraphName; //导入依赖的package包/类
public GridCellsLayer(GraphName topicName, Color color) {
  super(topicName, "nav_msgs/GridCells");
  this.color = color;
  frame = null;
  lock = new ReentrantLock();
  ready = false;
}
 
开发者ID:frankjoshua,项目名称:AndroidRosJava,代码行数:8,代码来源:GridCellsLayer.java


示例17: buildParentResolver

import org.ros.namespace.GraphName; //导入依赖的package包/类
private NameResolver buildParentResolver() {
  GraphName namespace = GraphName.root();
  if (this.specialRemappings.containsKey("__ns")) {
    namespace = GraphName.of(this.specialRemappings.get("__ns")).toGlobal();
  } else if (this.environment.containsKey("ROS_NAMESPACE")) {
    namespace = GraphName.of(this.environment.get("ROS_NAMESPACE")).toGlobal();
  }

  return new NameResolver(namespace, this.remappings);
}
 
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:11,代码来源:ROSLoader.java


示例18: getDefaultNodeName

import org.ros.namespace.GraphName; //导入依赖的package包/类
/**
* Required by rosjava's AbstractNodeMain class
*/
@Override
public GraphName getDefaultNodeName()
/*************************************************************************/
{
    return GraphName.of("ShieldTeleop/JoystickNode");
}
 
开发者ID:willowgarage,项目名称:shield_teleop,代码行数:10,代码来源:JoystickNode.java


示例19: getDefaultNodeName

import org.ros.namespace.GraphName; //导入依赖的package包/类
@Override
public GraphName getDefaultNodeName() {
    return GraphName.of("dl4j_rosjava/fetch_controller");
}
 
开发者ID:SkymindIO,项目名称:FetchKobuki,代码行数:5,代码来源:ControllerNode.java


示例20: getDefaultNodeName

import org.ros.namespace.GraphName; //导入依赖的package包/类
@Override
public GraphName getDefaultNodeName() {
    return GraphName.of("utmg_android");
}
 
开发者ID:radionavlab,项目名称:utmg-android-interface,代码行数:5,代码来源:ROSNode.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TextMap类代码示例发布时间:2022-05-21
下一篇:
Java RetryPolicies类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap