Skip to main content

Yet Another Roomba Controller

Project description

YARC: Yet Another Roomba Controller

This is a Python library that allows you to control Roomba's and Create's from iRobot using the serial connection. This requires Python 3 and the pyserial library. This can run on many devices such as Raspberry Pis and regular PCs. Tested on the Create 2, some older devices may not support all operations or sensors.

This implements the Open Interface specification by iRobot: http://www.irobot.com/~/media/MainSite/PDFs/About/STEM/Create/create_2_Open_Interface_Spec.pdf

This library implements every single opcode in the specification and provides every sensor in an easy-to-use system. All single sensors are available as attributes on a yarc.Roomba object along with all_sensors which is a namedtuple of all of the sensors. Other groups can be obtained with the sensor() method and custom groups can be acquired with query_list() method. Single values are returned as ints or bools, bit fields are returned as IntFlag types, and collections of values are returned as namedtuple instances.

This can be installed from source from the Github source or through pip: pip install yarc.

Example

import yarc

# Make the Roomba object
bot = yarc.Roomba('/dev/ttyUSB0')

# Start the OI connection - must be the first call
bot.start()

# Switch to 'safe' mode
# In this mode we can completely control the robot unless it 'senses danger'
# in which case it will switch back to 'passive' mode. Danger could be
# detection of a cliff, detection of a wheel drop, or charger plugged in.
bot.safe()

# Commands
bot.drive_distance(100) # drives 100 mm forward
bot.turn_angle(45) # rotates 45 degrees in-place
... # more instructions
print(bot.battery_charge / bot.battery_capacity) # print battery charge percent
print(bot.all_sensors) # print out all sensor data

# Stop the OI connection - must be the last call
bot.stop()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yarc-0.9.3.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yarc-0.9.3-py3-none-any.whl (31.4 kB view details)

Uploaded Python 3

File details

Details for the file yarc-0.9.3.tar.gz.

File metadata

  • Download URL: yarc-0.9.3.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for yarc-0.9.3.tar.gz
Algorithm Hash digest
SHA256 e58571b846f88f8add308390c715fe42dcb300b6c705737cbe26a15904515c5a
MD5 2612fffe6742e276a33757d688720612
BLAKE2b-256 c1588cf32e47128ce688fbf2a572232992f0ce37b7ce2d85e80f9b22397cab81

See more details on using hashes here.

File details

Details for the file yarc-0.9.3-py3-none-any.whl.

File metadata

  • Download URL: yarc-0.9.3-py3-none-any.whl
  • Upload date:
  • Size: 31.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for yarc-0.9.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b99c3e2a989bef0f2f96d97a01ad8db9bfcb5cb53a689ac6661b289167760391
MD5 8a0f0156d74480c48a395fb0fc0d3793
BLAKE2b-256 f8f9bafac04043198e1d4537d5e209a6a23f361c46cfa0d17c4e167e03261782

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page