std_msgs.Header.setFrameId()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(11.7k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中std_msgs.Header.setFrameId()方法的一些代码示例,展示了Header.setFrameId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Header.setFrameId()方法的具体详情如下:
包路径:std_msgs.Header
类名称:Header
方法名:setFrameId

Header.setFrameId介绍

暂无

代码示例

代码示例来源:origin: rosjava/rosjava_core

public geometry_msgs.TransformStamped toTransformStampedMessage(
  geometry_msgs.TransformStamped result) {
 Preconditions.checkNotNull(time);
 result.getHeader().setFrameId(target.toString());
 result.getHeader().setStamp(time);
 result.setChildFrameId(source.toString());
 transform.toTransformMessage(result.getTransform());
 return result;
}

代码示例来源:origin: rosjava/rosjava_core

public geometry_msgs.PoseStamped toPoseStampedMessage(GraphName frame, Time stamp,
  geometry_msgs.PoseStamped result) {
 result.getHeader().setFrameId(frame.toString());
 result.getHeader().setStamp(stamp);
 result.setPose(toPoseMessage(result.getPose()));
 return result;
}

代码示例来源:origin: rosjava/rosjava_core

@Override
 protected void loop() throws InterruptedException {
  geometry_msgs.TransformStamped message =
    connectedNode.getTopicMessageFactory()
      .newFromType(geometry_msgs.TransformStamped._TYPE);
  message.getHeader().setFrameId("world");
  message.setChildFrameId("turtle");
  message.getHeader().setStamp(connectedNode.getCurrentTime());
  message.getTransform().getRotation().setW(Math.random());
  message.getTransform().getRotation().setX(Math.random());
  message.getTransform().getRotation().setY(Math.random());
  message.getTransform().getRotation().setZ(Math.random());
  message.getTransform().getTranslation().setX(Math.random());
  message.getTransform().getTranslation().setY(Math.random());
  message.getTransform().getTranslation().setZ(Math.random());
  counter.incrementAndGet();
 }
});

代码示例来源:origin: us.ihmc/IHMCROSTools

public void publish(RigidBodyTransform transform3d, long timeStamp, String parentFrame, String childFrame)
  {
   TransformStamped transformStamped = topicMessageFactory.newFromType(TransformStamped._TYPE);
   Transform transform = getRosTransform(transform3d);
   transformStamped.setTransform(transform);
   transformStamped.setChildFrameId(childFrame);
   Header header = transformStamped.getHeader();
   header.setStamp(Time.fromNano(timeStamp));
   header.setFrameId(parentFrame);
   header.setSeq(seq++);
   transformStamped.setHeader(header);
   
   
   TFMessage message = getMessage();
   
   List<TransformStamped> tfs = new ArrayList<TransformStamped>();
   tfs.add(transformStamped);
   message.setTransforms(tfs);
   publish(message);
  }
}

代码示例来源:origin: us.ihmc/ihmc-ros-tools

public void publish(RigidBodyTransform transform3d, long timeStamp, String parentFrame, String childFrame)
  {
   TransformStamped transformStamped = topicMessageFactory.newFromType(TransformStamped._TYPE);
   Transform transform = getRosTransform(transform3d);
   transformStamped.setTransform(transform);
   transformStamped.setChildFrameId(childFrame);
   Header header = transformStamped.getHeader();
   header.setStamp(Time.fromNano(timeStamp));
   header.setFrameId(parentFrame);
   header.setSeq(seq++);
   transformStamped.setHeader(header);
   
   
   TFMessage message = getMessage();
   
   List<TransformStamped> tfs = new ArrayList<TransformStamped>();
   tfs.add(transformStamped);
   message.setTransforms(tfs);
   publish(message);
  }
}

代码示例来源:origin: us.ihmc/ihmc-ros-tools

public void publish(RigidBodyTransform transform3d, long timeStamp, String parentFrame, String childFrame)
  {
   TransformStamped transformStamped = topicMessageFactory.newFromType(TransformStamped._TYPE);
   Transform transform = getRosTransform(transform3d);
   transformStamped.setTransform(transform);
   transformStamped.setChildFrameId(childFrame);
   Header header = transformStamped.getHeader();
   header.setStamp(Time.fromNano(timeStamp));
   header.setFrameId(parentFrame);
   header.setSeq(seq++);
   transformStamped.setHeader(header);
   
   
   tfMessage message = getMessage();
   
   List<TransformStamped> tfs = new ArrayList<TransformStamped>();
   tfs.add(transformStamped);
   message.setTransforms(tfs);
   publish(message);
  }
}

代码示例来源:origin: us.ihmc/IHMCROSTools

public void publish(RigidBodyTransform transform3d, long timeStamp, String parentFrame, String childFrame)
  {
   TransformStamped transformStamped = topicMessageFactory.newFromType(TransformStamped._TYPE);
   Transform transform = getRosTransform(transform3d);
   transformStamped.setTransform(transform);
   transformStamped.setChildFrameId(childFrame);
   Header header = transformStamped.getHeader();
   header.setStamp(Time.fromNano(timeStamp));
   header.setFrameId(parentFrame);
   header.setSeq(seq++);
   transformStamped.setHeader(header);
   
   
   tfMessage message = getMessage();
   
   List<TransformStamped> tfs = new ArrayList<TransformStamped>();
   tfs.add(transformStamped);
   message.setTransforms(tfs);
   publish(message);
  }
}

代码示例来源:origin: us.ihmc/ihmc-ros-tools

header.setFrameId(frameID);
header.setSeq(seq++);
message.setHeader(header);

代码示例来源:origin: us.ihmc/ihmc-ros-tools

public void publish(long timestamp, RigidBodyTransform transform, Vector3DReadOnly linearVelocity, Vector3DReadOnly angularVelocity, String childFrame, String frameId)
{
 Odometry message = getMessage();
 Header header = createHeaderMsg(timestamp);
 header.setFrameId(frameId);
 message.setHeader(header);
 
 PoseWithCovariance poseWithCovariance = createPoseWithCovarianceMsg(transform);
 message.setPose(poseWithCovariance);
 
 TwistWithCovariance twistWithCovariance = createTwistWithCovariance(linearVelocity, angularVelocity);
 message.setTwist(twistWithCovariance);
 
 message.setChildFrameId(childFrame);
 
 publish(message);
}

代码示例来源:origin: us.ihmc/IHMCROSTools

public void publish(long timestamp, RigidBodyTransform transform, Vector3f linearVelocity, Vector3f angularVelocity, String childFrame, String frameId)
{
 Odometry message = getMessage();
 Header header = createHeaderMsg(timestamp);
 header.setFrameId(frameId);
 message.setHeader(header);
 
 PoseWithCovariance poseWithCovariance = createPoseWithCovarianceMsg(transform);
 message.setPose(poseWithCovariance);
 
 TwistWithCovariance twistWithCovariance = createTwistWithCovariance(linearVelocity, angularVelocity);
 message.setTwist(twistWithCovariance);
 
 message.setChildFrameId(childFrame);
 
 publish(message);
}

代码示例来源:origin: us.ihmc/IHMCROSTools

public void publish(List<String> name, double[] position, double[] velocity, double[] effort, Time t)
{
 JointState message = getMessage();
 Header header = message.getHeader();
 header.setStamp(t);
 header.setFrameId("/world");
 header.setSeq(seq++);
 message.setHeader(header);
 if (name != null) {
   message.setName(name);
 }
 if (position != null) {
   message.setPosition(position);
 }
 if(velocity != null) {
  message.setVelocity(velocity);
 }
 if(effort != null) {
  message.setEffort(effort);
 }
 publish(message);
}

代码示例来源:origin: us.ihmc/ihmc-ros-tools

public void publish(List<String> name, double[] position, double[] velocity, double[] effort, Time t)
{
 JointState message = getMessage();
 Header header = message.getHeader();
 header.setStamp(t);
 header.setFrameId("/world");
 header.setSeq(seq++);
 message.setHeader(header);
 if (name != null) {
   message.setName(name);
 }
 if (position != null) {
   message.setPosition(position);
 }
 if(velocity != null) {
  message.setVelocity(velocity);
 }
 if(effort != null) {
  message.setEffort(effort);
 }
 publish(message);
}

代码示例来源:origin: us.ihmc/ihmc-ros-tools

public void publish(Point3D[] points, float[] intensities, String frameId)
{
 PointCloud2 message = getMessage();
 message.getHeader().setFrameId(frameId);
 message.getHeader().setStamp(Time.fromMillis(System.currentTimeMillis()));
 message.setHeight(1);
 message.setWidth(points.length);
 message.setPointStep(pointType.getPointStep());
 int dataLength = pointType.getPointStep() * points.length;
 message.setRowStep(dataLength);
 message.setIsBigendian(false);
 message.setIsDense(true);
 message.setFields(pointType.getPointField());
 
 ChannelBuffer buffer = new LittleEndianHeapChannelBuffer(dataLength);
 for(int i=0;i<points.length;i++)
 {
   buffer.writeFloat((float)points[i].getX());
   buffer.writeFloat((float)points[i].getY());
   buffer.writeFloat((float)points[i].getZ());
   buffer.writeFloat(intensities[i]);
 }
 message.setData(buffer);
 
 publish(message);
}

代码示例来源:origin: us.ihmc/IHMCROSTools

public void publish(Point3d[] points, float[] intensities, String frameId)
{
 PointCloud2 message = getMessage();
 message.getHeader().setFrameId(frameId);
 message.getHeader().setStamp(Time.fromMillis(System.currentTimeMillis()));
 message.setHeight(1);
 message.setWidth(points.length);
 message.setPointStep(pointType.getPointStep());
 int dataLength = pointType.getPointStep() * points.length;
 message.setRowStep(dataLength);
 message.setIsBigendian(false);
 message.setIsDense(true);
 message.setFields(pointType.getPointField());
 
 ChannelBuffer buffer = new LittleEndianHeapChannelBuffer(dataLength);
 for(int i=0;i<points.length;i++)
 {
   buffer.writeFloat((float)points[i].getX());
   buffer.writeFloat((float)points[i].getY());
   buffer.writeFloat((float)points[i].getZ());
   buffer.writeFloat(intensities[i]);
 }
 message.setData(buffer);
 
 publish(message);
}

代码示例来源:origin: us.ihmc/ihmc-ros-tools

public void publish(Point3D[] points, MutableColor color, String frameId)
{
 PointCloud2 message = getMessage();
 message.getHeader().setFrameId(frameId);
 message.getHeader().setStamp(Time.fromMillis(System.currentTimeMillis()));
 message.setHeight(1);
 message.setWidth(points.length);
 message.setPointStep(pointType.getPointStep());
 int dataLength = pointType.getPointStep() * points.length;
 message.setRowStep(dataLength);
 message.setIsBigendian(false);
 message.setIsDense(true);
 message.setFields(pointType.getPointField());
 ChannelBuffer buffer = new LittleEndianHeapChannelBuffer(dataLength);
 for(int i=0;i<points.length;i++)
 {
   buffer.writeFloat((float)points[i].getX());
   buffer.writeFloat((float)points[i].getY());
   buffer.writeFloat((float)points[i].getZ());
   buffer.writeByte((int)color.getZ());
   buffer.writeByte((int)color.getY());
   buffer.writeByte((int)color.getX());
   buffer.writeByte(0); //dummy;
 }
 message.setData(buffer);
 publish(message);
}

代码示例来源:origin: us.ihmc/IHMCROSTools

public void publish(Point3d[] points, Color3f color, String frameId)
{
 PointCloud2 message = getMessage();
 message.getHeader().setFrameId(frameId);
 message.getHeader().setStamp(Time.fromMillis(System.currentTimeMillis()));
 message.setHeight(1);
 message.setWidth(points.length);
 message.setPointStep(pointType.getPointStep());
 int dataLength = pointType.getPointStep() * points.length;
 message.setRowStep(dataLength);
 message.setIsBigendian(false);
 message.setIsDense(true);
 message.setFields(pointType.getPointField());
 ChannelBuffer buffer = new LittleEndianHeapChannelBuffer(dataLength);
 for(int i=0;i<points.length;i++)
 {
   buffer.writeFloat((float)points[i].getX());
   buffer.writeFloat((float)points[i].getY());
   buffer.writeFloat((float)points[i].getZ());
   buffer.writeByte((int)color.getZ());
   buffer.writeByte((int)color.getY());
   buffer.writeByte((int)color.getX());
   buffer.writeByte(0); //dummy;
 }
 message.setData(buffer);
 publish(message);
}

代码示例来源:origin: us.ihmc/ihmc-ros-tools

public void publish(Point3D[] points, MutableColor[] colors, String frameId)
{
 PointCloud2 message = getMessage();
 message.getHeader().setFrameId(frameId);
 message.getHeader().setStamp(Time.fromMillis(System.currentTimeMillis()));
 message.setHeight(1);
 message.setWidth(points.length);
 message.setPointStep(pointType.getPointStep());
 int dataLength = pointType.getPointStep() * points.length;
 message.setRowStep(dataLength);
 message.setIsBigendian(false);
 message.setIsDense(true);
 message.setFields(pointType.getPointField());
 
 ChannelBuffer buffer = new LittleEndianHeapChannelBuffer(dataLength);
 for(int i=0;i<points.length;i++)
 {
   buffer.writeFloat((float)points[i].getX());
   buffer.writeFloat((float)points[i].getY());
   buffer.writeFloat((float)points[i].getZ());
   buffer.writeByte((int)colors[i].getZ());
   buffer.writeByte((int)colors[i].getY());
   buffer.writeByte((int)colors[i].getX());
   buffer.writeByte(0); //dummy;
 }
 message.setData(buffer);
 
 publish(message);
 
}

代码示例来源:origin: us.ihmc/IHMCROSTools

header.setFrameId(frameId);
header.setSeq(seq++);
message.setHeader(header);

代码示例来源:origin: us.ihmc/ihmc-ros-tools

header.setFrameId(frameId);
header.setStamp(Time.fromNano(timestamp));
header.setSeq(counter);

代码示例来源:origin: us.ihmc/IHMCROSTools

header.setFrameId(frameId);
header.setStamp(Time.fromNano(timestamp));
header.setSeq(counter);

相关文章