主要内容

转换邮票ed

Create transformation message

Description

The转换邮票edobject is an implementation of thegeometry_msgs/transformstampedmessage type in ROS. The object contains meta-information about the message itself and the transformation. The transformation has a translational and rotational component.

Creation

Description

example

tform= getTransform(tftree,targetframe,SourceFrame)returns the latest known transformation between two coordinate frames. Transformations are structured as a 3-D translation (3-element vector) and a 3-D rotation (quaternion).

Properties

expand all

此属性仅阅读。

Message type of ROS message, returned as a character vector.

Data Types:char

此属性仅阅读。

ROS Header message, returned as aHeader目的。This header message contains theMessageType, sequence (Seq), timestamp (邮票), andFrameId.

Second coordinate frame to transform point into, specified as a character vector.

此属性仅阅读。

转换ation message, specified as a转换目的。该对象包含MessageTypewith aTranslationvector andRotationquaternion.

Object Functions

apply 将消息实体转换为目标框架

Examples

collapse all

This example looks at the转换邮票edobject to show the underlying structure of a转换邮票edROS消息。设置网络和转换后,您可以创建一个转换树并获得特定坐标系之间的转换。使用showdetailslets you inspect the information in the transformation. It contains theChildFrameId,Header, 和转换.

Start ROS network and setup transformations.

石榴石
启动ROS Core ...在0.58068秒内完成。在http://172.29.207.151:57424初始化ROS Master。初始化带有Nodeuri的全局节点/Matlab_global_node_31012 http://dcc345885glnxa64:35939/and Masteruri http:// localhost:57424。
exampleHelperROSStartTfPublisher

创建转换树并等待树更新。在机器人基础及其相机中心之间进行转换。

tftree = rostf;waitfortransform(tftree,'camera_center','robot_base');tform= getTransform(tftree,'camera_center','robot_base');

Inspect the转换邮票ed目的。

showdetails(tform)
Header Stamp Sec : 1645902545 Nsec : 126186241 Seq : 0 FrameId : camera_center Transform Translation X : 0.5 Y : 0 Z : -1 Rotation X : 0 Y : -0.7071067811865476 Z : 0 W : 0.7071067811865476 ChildFrameId : robot_base

访问Translation矢量内部转换property.

trans = tform.Transform.Translation
trans = ROS Vector3 message with properties: MessageType: 'geometry_msgs/Vector3' X: 0.5000 Y: 0 Z: -1.0000 Use showdetails to show the contents of the message

Stop the example transformation publisher.

exampleHelperROSStopTfPublisher

关闭ROS网络。

rosshutdown
Shutting down global node /matlab_global_node_31012 with NodeURI http://dcc345885glnxa64:35939/ and MasterURI http://localhost:57424. Shutting down ROS master on http://172.29.207.151:57424.

应用一个转换转换邮票edobject to aPointStamped信息。

Start ROS network and setup transformations.

石榴石
启动ROS核心……在0.68519秒内完成。Initializing ROS master on http://172.29.207.162:56685. Initializing global node /matlab_global_node_35512 with NodeURI http://dcc434238glnxa64:44911/ and MasterURI http://localhost:56685.
exampleHelperROSStartTfPublisher

创建转换树并等待树更新。在机器人基础及其相机中心之间进行转换。Inspect the transformation.

tftree = rostf;waitfortransform(tftree,'camera_center','robot_base');tform= getTransform(tftree,'camera_center','robot_base');showdetails(tform)
标题邮票SEC:1645902364 NSEC:835052014 SEQ:0 FRAMEID:Camera_Center Transform转换X:0.5 Y:0 Z:-1旋转X:0 Y:-0.7071067811865476 Z:0

Create point to transform. You could also get this point message off the ROS network.

pt = rosmessage('geometry_msgs/PointStamped');pt.Header.FrameId ='camera_center';pt.point.x = 3;pt.point.y = 1.5;pt.point.z = 0.2;

Apply the transformation to the point.

tfpt = apply(tform,pt);

关闭ROS网络。

rosshutdown
Shutting down global node /matlab_global_node_35512 with NodeURI http://dcc434238glnxa64:44911/ and MasterURI http://localhost:56685. Shutting down ROS master on http://172.29.207.162:56685.

Version History

Introduced in R2019b