コード例 #1
0
ファイル: test-1.py プロジェクト: h0bbyte/RoombaPi
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.

import pyrobot
import time

if __name__ == '__main__':
  """Do a little dance."""
  r = pyrobot.Roomba(tty = '/dev/ttyAMA0')
#  r.sci.Wake()
  r.safe=False
  r.Control()
  r.TurnInPlace(pyrobot.VELOCITY_SLOW, 'cw')
  time.sleep(0.5)
  r.TurnInPlace(pyrobot.VELOCITY_SLOW, 'ccw')
  time.sleep(0.5)
  r.DriveStraight(pyrobot.VELOCITY_SLOW)
  time.sleep(0.25)
  r.DriveStraight(-pyrobot.VELOCITY_SLOW)
  time.sleep(.25)
  r.Stop()


コード例 #2
0
ファイル: xmlrpc_server.py プロジェクト: neuroph12/cambridge
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
"""Connect to a Roomba/Create and offer up an XMLRPC server interface."""

import pyrobot
import sys

from SimpleXMLRPCServer import SimpleXMLRPCServer

if __name__ == '__main__':
    assert len(sys.argv) == 3
    server = SimpleXMLRPCServer(sys.argv[1:])
    server.register_introspection_functions()
    roomba = pyrobot.Roomba()
    server.register_instance(roomba)
    server.serve_forever()
コード例 #3
0
ファイル: simple.py プロジェクト: trriplejay/botler-api
def get_roomba():
    r = pyrobot.Roomba()  #declare a roomba
    r.Control()  #wake up the roomba (get control of it)
    time.sleep(.2)  #sleep a bit before using
    return r
コード例 #4
0
        map_obstacle_place(x, y)
    return

def map_roomba_place(x, y):
    """ Send points to map for Roomba's theoretical location """
    z = find_map_number()
    grid_roomba.add_data_point(x, y, z)
    pass

def map_obstacle_place(x, y):
    """ Sent points to map to represent Roomba's hits """
    z = find_map_number()
    grid.add_data_point(x, y, z)
    pass

def find_map_number():
    """ Return the map number """
    return 1 # TODO: Make this a real number

if __name__ == "__main__":
    # create Roomba
    r = pyrobot.Roomba()
    follow_walls(r)
    find_map_number()
    #grid = CreateOccupancyGrid.create_map()
    #location = CreateKalmanFilters.locate_roomba(grid)
    #path = CreateRoombaPath.plan_path(grid, location)