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


Java GraphName类代码示例

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


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


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