Main Content

turtlebot

Connect to TurtleBot

Add-On Required: This feature requires the ROS Toolbox Support Package for TurtleBot-Based Robots add-on.

Description

The turtlebot object connects to TurtleBot® robots via a ROS network at a specific address. It contains properties for activating subscribers and accessing topic names relevant to the TurtleBot. Use the turtlebot object functions to get different sensor data off the ROS network and to send commands to control the robot.

Creation

Description

tbot = turtlebot creates a TurtleBot interface object. MATLAB® connects to the TurtleBot ROS master running on the same machine, unless you specify a different location in the ROS_MASTER_URI environment variable.

tbot = turtlebot(hostname) connects to the TurtleBot ROS master at IP or host name, hostname. This syntax assumes the ROS default port number of 11311.

example

tbot = turtlebot(hostname,port) connects to the TurtleBot ROS master at the specified port number, port.

tbot = turtlebot(URI) connects to the TurtleBot at the given uniform resource identifier, URI.

tbot = turtlebot(___,'NodeHost',hostname) specifies the IP or host name under which the node advertises itself to the ROS network.

Properties

expand all

Velocity publisher information, returned as a structure containing two elements:

  • TopicName — ROS topic name that the publisher uses to send messages over the ROS network.

  • Active — Logical value indicating whether the publisher is available to send messages.

Color image subscriber information, returned as a structure containing two elements:

  • TopicName — ROS topic name that the subscriber uses to receive messages over the ROS network.

  • Active — Logical value indicating whether the subscriber is available to receive data messages.

Grayscale image subscriber information, returned as a structure containing two elements:

  • TopicName — ROS topic name that the subscriber uses to receive messages over the ROS network.

  • Active — Logical value indicating whether the subscriber is available to receive data messages.

Depth image subscriber information, returned as a structure containing two elements:

  • TopicName — ROS topic name that the subscriber uses to receive messages over the ROS network.

  • Active — Logical value indicating whether the subscriber is available to receive data messages.

Point cloud subscriber information, returned as a structure containing two elements:

  • TopicName — ROS topic name that the subscriber uses to receive messages over the ROS network.

  • Active — Logical value indicating whether the subscriber is available to receive data messages.

Laser scan subscriber information, returned as a structure containing two elements:

  • TopicName — ROS topic name that the subscriber uses to receive messages over the ROS network.

  • Active — Logical value indicating whether the subscriber is available to receive data messages.

Odometry subscriber information, returned as a structure containing two elements:

  • TopicName — ROS topic name that the subscriber uses to receive messages over the ROS network.

  • Active — Logical value indicating whether the subscriber is available to receive data messages.

Odometry reset publisher information, returned as a structure containing two elements:

  • TopicName — ROS topic name that the publisher uses to send odometry reset commands over the ROS network.

  • Active — Logical value indicating whether the subscriber is available to send data messages.

IMU subscriber info, returned as a structure. The structure contains two elements:

  • TopicName — ROS topic name that the subscriber uses to receive messages over the ROS network.

  • Active — Logical value indicating whether the subscriber is available to receive data messages.

List of transform frames available, returned as a cell array. To get the transform between two available frames, use getTransform.

List of topic names available, returned as a cell array. The topics can be used to create subscribers that get data off the ROS network.

Object Functions

getColorImageGet color image from TurtleBot camera
getDepthImageGet depth image from TurtleBot camera
getGrayImageGet grayscale image from TurtleBot camera
getLaserScanGet laser scan sensor readings from TurtleBot
setVelocitySend linear and angular velocities to TurtleBot
getIMUGet IMU data from TurtleBot
getTransformGet transformation between two frames on the TurtleBot robot
getOdometryGet odometry reading from TurtleBot
resetOdometryReset odometry for TurtleBot
setVelocitySend linear and angular velocities to TurtleBot

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');

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

tb = turtlebot('192.168.1.1');

Get the latest laser scan from the TurtleBot.

scan = getLaserScan(tb);

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

tb = turtlebot('192.168.1.1');

Get the latest color image from the TurtleBot.

colorImg = getColorImage(tb);

Version History

Introduced in R2016a