Module turtlebot_driver :: Class Roomba
[frames] | no frames]

Class Roomba

source code

object --+
         |
        Roomba

Represents a Roomba robot.

Instance Methods
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
start(self, tty='/dev/ttyUSB0') source code
 
change_baud_rate(self, baud_rate)
Sets the baud rate in bits per second (bps) at which SCI commands and data are sent according to the baud code sent in the data byte.
source code
 
passive(self)
Put the robot in passive mode.
source code
 
control(self)
Start the robot's SCI interface and place it in safe mode.
source code
 
direct_drive(self, velocity_left, velocity_right) source code
 
drive(self, velocity, radius)
controls Roomba's drive wheels.
source code
 
stop(self)
Set velocity and radius to 0 to stop movement.
source code
 
slow_stop(self, velocity)
Slowly reduce the velocity to 0 to stop movement.
source code
 
drive_straight(self, velocity)
drive in a straight line.
source code
 
turn_in_place(self, velocity, direction)
Turn in place either clockwise or counter-clockwise.
source code
 
dock(self)
Start looking for the dock and then dock.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

change_baud_rate(self, baud_rate)

source code 

Sets the baud rate in bits per second (bps) at which SCI commands and data are sent according to the baud code sent in the data byte.

The default baud rate at power up is 57600 bps. (See Serial Port Settings, above.) Once the baud rate is changed, it will persist until Roomba is power cycled by removing the battery (or until the battery voltage falls below the minimum required for processor operation). You must wait 100ms after sending this command before sending additional commands at the new baud rate. The SCI must be in passive, safe, or full mode to accept this command. This command puts the SCI in passive mode.

drive(self, velocity, radius)

source code 

controls Roomba's drive wheels.

NOTE(damonkohler): The following specification applies to both the Roomba and the Turtlebot.

The Roomba takes four data bytes, interpreted as two 16-bit signed values using two's complement. The first two bytes specify the average velocity of the drive wheels in millimeters per second (mm/s), with the high byte being sent first. The next two bytes specify the radius in millimeters at which Roomba will turn. The longer radii make Roomba drive straighter, while the shorter radii make Roomba turn more. The radius is measured from the center of the turning circle to the center of Roomba.

A drive command with a positive velocity and a positive radius makes Roomba drive forward while turning toward the left. A negative radius makes Roomba turn toward the right. Special cases for the radius make Roomba turn in place or drive straight, as specified below. A negative velocity makes Roomba drive backward.

Also see drive_straight and turn_in_place convenience methods.