本文整理了Java中std_msgs.Header.setStamp()
方法的一些代码示例,展示了Header.setStamp()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Header.setStamp()
方法的具体详情如下:
包路径:std_msgs.Header
类名称:Header
方法名:setStamp
暂无
代码示例来源:origin: us.ihmc/ihmc-ros-tools
private Header createHeaderMsg(long timestamp)
{
Header header = newMessageFromType(Header._TYPE);
header.setStamp(Time.fromNano(timestamp));
header.setSeq(counter);
counter++;
return header;
}
代码示例来源:origin: us.ihmc/IHMCROSTools
private Header createHeaderMsg(long timestamp)
{
Header header = newMessageFromType(Header._TYPE);
header.setStamp(Time.fromNano(timestamp));
header.setSeq(counter);
counter++;
return header;
}
代码示例来源: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
private void updateTransform(geometry_msgs.TransformStamped transformStamped,
ConnectedNode connectedNode, FrameTransformTree frameTransformTree) {
transformStamped.getHeader().setStamp(connectedNode.getCurrentTime());
transformStamped.getTransform().getRotation().setW(Math.random());
transformStamped.getTransform().getRotation().setX(Math.random());
transformStamped.getTransform().getRotation().setY(Math.random());
transformStamped.getTransform().getRotation().setZ(Math.random());
transformStamped.getTransform().getTranslation().setX(Math.random());
transformStamped.getTransform().getTranslation().setY(Math.random());
transformStamped.getTransform().getTranslation().setZ(Math.random());
frameTransformTree.update(transformStamped);
}
}
代码示例来源:origin: rosjava/rosjava_core
private void publish(byte level, Object message) {
rosgraph_msgs.Log logMessage = publisher.newMessage();
logMessage.getHeader().setStamp(defaultNode.getCurrentTime());
logMessage.setLevel(level);
logMessage.setName(defaultNode.getName().toString());
logMessage.setMsg(message.toString());
// TODO(damonkohler): Should update the topics field with a list of all
// published and subscribed topics for the node that created this logger.
// This helps filter the rosoutconsole.
publisher.publish(logMessage);
}
代码示例来源: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/IHMCROSTools
public void publish(byte level, String message)
{
rosgraph_msgs.Log logMessage = getMessage();
std_msgs.Header header = logMessage.getHeader();
header.setStamp(rosMainNode.getCurrentTime());
header.setSeq(sequenceID++);
logMessage.setHeader(header);
logMessage.setLevel(level);
logMessage.setMsg(message);
publish(logMessage);
}
}
代码示例来源: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(byte level, String message)
{
rosgraph_msgs.Log logMessage = getMessage();
std_msgs.Header header = logMessage.getHeader();
header.setStamp(rosMainNode.getCurrentTime());
header.setSeq(sequenceID++);
logMessage.setHeader(header);
logMessage.setLevel(level);
logMessage.setMsg(message);
publish(logMessage);
}
}
代码示例来源: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
Header header = message.getHeader();
header.setStamp(t);
header.setFrameId(frameID);
header.setSeq(seq++);
代码示例来源: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/IHMCROSTools
header.setStamp(Time.fromNano(timestamp));
header.setSeq(counter);
counter++;
代码示例来源:origin: us.ihmc/ihmc-ros-tools
header.setStamp(Time.fromNano(timestamp));
header.setSeq(counter);
counter++;
内容来源于网络,如有侵权,请联系作者删除!