| Home | Trees | Index | Help |
|
|---|
| Package pyrobot :: Package robot :: Class Robot |
|
AiboRobot,
KheperaRobot,
PlayerRobot,
RobocupRobot,
TCPRobot
The object with which to interact with motors and sensors.
The base robot class. This class is the basis of all robots.
Primary attributes:
.x robot's computed global position
.y robot's computed global position
.thr theta, in radians
.stall true, if the robot is bumping into something
.brain a reference to the brain, if loaded
.timestamp time of last update
.builtinDevices list of built-in devices
.supportedFeatures features that this robot requires
.devices devices that are currently loaded
Units of measure for range sensors:
'ROBOTS' - in terms of the robot's diameter
'METERS' - meters
'CM' - centimeters
'MM' - millimeters
'SCALED' - scaled [-1,1]
'RAW' - right from the sensor
| Method Summary | |
|---|---|
Robot object holds the devices and moves the actual robot. | |
Connects the robot object to the server or simulator. | |
This method removes all of the devices. | |
Disconnects the robot object from the server or simulator. | |
Returns the first device of a type. | |
Returns the list of device types that have ben loaded. | |
Returns the list of builtin device types. | |
Returns 1 if robot has a device of type dtype, else 0. | |
Set the x,y,thr pose of where the robot thinks it is. | |
Move function that takes desired motor values and converts to trans and rotate. | |
Moves the robot by sending an amount of power. | |
A printable representation of the robot's attribute tree. | |
Removes a device (or all of them) of a particular type. | |
Takes a list/feature name and raises and exception if not supported. | |
Moves the robot to the left or right. | |
Change the default range sensor. | |
Is called from __init__ so users don't have to call parent constructor and all the gory details. | |
Loads and starts a device. | |
Calls back to a subclass to start a device from there. | |
Load devices can take a dict, list, builtin name, or filename... | |
Short for robot.move(0,0). | |
Stop a device from updating. | |
See if this robot interface supports a particular feature. | |
Moves the robot forward or backwards. | |
Updates the robot. | |
Updates all of the robot's devices. | |
| Method Details |
|---|
__init__(self,
**kwargs)
|
connect(self)Connects the robot object to the server or simulator. |
destroy(self)This method removes all of the devices. Called by the system. |
disconnect(self)Disconnects the robot object from the server or simulator. |
getDevice(self, item)Returns the first device of a type. |
getDevices(self)Returns the list of device types that have ben loaded. |
getSupportedDevices(self)Returns the list of builtin device types. |
hasA(self, dtype)Returns 1 if robot has a device of type dtype, else 0. |
localize(self, x=0, y=0, thr=0)Set the x,y,thr pose of where the robot thinks it is. |
motors(self, leftValue, rightValue)Move function that takes desired motor values and converts to trans and rotate. |
move(self, translate, rotate)Moves the robot by sending an amount of power. translate - value between -1 and 1; -1 is reverse rotate - value between -1 and 1; -1 is to the right |
printView(self, thing=None, toplevel='robot', indent=0)A printable representation of the robot's attribute tree. |
removeDevice(self, item, number=None)
Removes a device (or all of them) of a particular type.
>>> robot.removedDevice("sonar")
Removes all of of the sonar devices.
>>> robot.removedDevice("sonar", 0)
Removes the first sonar device.
|
requires(self, feature)Takes a list/feature name and raises and exception if not supported. >>> robot.requires(["continuous-movement", "odometry", "range-sensor"]) 1 or raises ImportError exception |
rotate(self, val)Moves the robot to the left or right. val - value between -1 and 1; -1 is to the right. |
setRangeSensor(self, name, index=0)
Change the default range sensor. By default the range sensor
is set to be sonar, if a robot has it, or laser, if it has it,
or IR if a robot has it. Otherwise, it is not set.
Takes the name of a range sensor, and an optional index identifier.
An index of 0 is used if not given.
Examples:
>>> robot.setRangeSensor("sonar")
Ok
>>> robot.setRangeSensor("laser", 1)
Ok
returns "Ok" on success, otherwise raises an exception.
|
setup(self, **kwargs)Is called from __init__ so users don't have to call parent constructor and all the gory details. |
startDevice(self, item, **args)
Loads and starts a device.
item - can be a builtin or a filename. Filenames should start
with an uppercase letter.
Returns a pointer to the device object.
>>> robot.startDevice("camera")
<Object>
>>> robot.startDevice("FilenameDevice")
<Object>
|
startDeviceBuiltin(self, item)Calls back to a subclass to start a device from there. |
startDevices(self, item, override=0, **args)Load devices can take a dict, list, builtin name, or filename |
stop(self)Short for robot.move(0,0). Stop the robot's movement. |
stopDevice(self, item)Stop a device from updating. |
supports(self, feature)See if this robot interface supports a particular feature. Some robot interfaces/simulators don't support continuous-movement, for example. |
translate(self, val)Moves the robot forward or backwards. val - value between -1 and 1; -1 is reverse |
update(self)Updates the robot. |
updateDevices(self)Updates all of the robot's devices. |
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 2.1 on Mon Jul 25 01:39:26 2005 | http://epydoc.sf.net |