getTransform

Get transformation between two frames on the TurtleBot robot

Description

example

tform = getTransform(tbot,targetframe,sourceframe) returns the latest known transformation between two coordinate frames on the TurtleBot® connected through interface object, tbot.

[tform,tformMsg] = getTransform(tbot,targetframe,sourceframe) also returns the associated ROS TransformStamped message.

Examples

collapse all

Connect to the TurtleBot robot. Change '192.168.1.1' to the IP address of the robot.

tbot = turtlebot('192.168.1.1');

View the active frames by using the TransformFrames property.

tbot.TransformFrames

Get transform between the 'base_link' and 'camera_link' frames on the TurtleBot.

tform = getTransform(tbot,'camera_link','base_link')
tform = 

    Translation: [0.1180 -1.8431e-18 -0.2710]
       Rotation: [0 0 0]

Input Arguments

collapse all

TurtleBot interface object, specified as a turtlebot object. The object contains properties for activating subscribers and accessing topic names relevant to the TurtleBot. The properties contain the topic name and active status of different subscribers for the TurtleBot. When you create the object with turtlebot, the properties available are:

tbot = turtlebot
tbot = 

  turtlebot with properties:

           Velocity: [1x1 struct]
         ColorImage: [1x1 struct]
          GrayImage: [1x1 struct]
         DepthImage: [1x1 struct]
         PointCloud: [1x1 struct]
          LaserScan: [1x1 struct]
           Odometry: [1x1 struct]
      OdometryReset: [1x1 struct]
                IMU: [1x1 struct]
    TransformFrames: {0x1 cell}
         TopicNames: {3x1 cell}

For properties with relevant ROS data messages , you can view the topic name and a subscriber’s active status. A specific subscriber is active for the given TopicName if Active equals 1.

tbot.Velocity
ans = 

    TopicName: '/mobile_base/commands/velocity'
       Active: 1

Target coordinate frame that you want to transform your source frame into, specified as a string. To see the available frames, use tbot.TransformFrames.

Source coordinate frame, specified as a string. To see the available frames, use tbot.TransformFrames.

Output Arguments

collapse all

Transformation between two coordinate frames, specified as a structure containing these fields:

  • Translation – A row vector containing the 3-D translation between the source and target frames in the form [x y z] in meters.

  • Rotation – A row vector containing the 3-D orientation between the source and target frames in the form [yaw pitch roll] in radians.

Transformation message, returned as a TransformStamped object handle.

Introduced in R2016a