Difference between revisions of "Robotics-2010"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
− | + | = NXT-Python Documentation = | |
− | Largely a work in-progress, please add/edit as you learn the details. | + | Largely a work in-progress, please add/edit as you learn the details. Note that this page is documenting the NXT-Python release (URL here), not the NXT_Python release (hyphen vs underscore). |
=== nxt.locator === | === nxt.locator === | ||
The function of this module is to locate NXT brick(s). Returns an <code>nxt.bluesock.BlueSock</code> object for robots connected by Bluetooth and a <code>nxt.usbsock.USBSock</code> object for robot connected by USB, and throws <code>nxt.locator.BrickNotFoundError</code> if none can be found. | The function of this module is to locate NXT brick(s). Returns an <code>nxt.bluesock.BlueSock</code> object for robots connected by Bluetooth and a <code>nxt.usbsock.USBSock</code> object for robot connected by USB, and throws <code>nxt.locator.BrickNotFoundError</code> if none can be found. | ||
+ | |||
+ | * Status: incomplete as of 2010-02-14 | ||
* Objects | * Objects | ||
Line 12: | Line 14: | ||
** <code>close()</code> - Close connection to brick. | ** <code>close()</code> - Close connection to brick. | ||
** <code>host</code> - Returns the address of the brick. | ** <code>host</code> - Returns the address of the brick. | ||
+ | ** generator object <code>find_bricks()</code>, the object returned by <code>find_bricks()</code>. | ||
+ | *** <code>next()</code> - Find the next brick in the sequence, returns the same thing as <code>find_one_brick()</code>. | ||
+ | ** <code>find_one_brick(host=None, name=None)</code> | ||
+ | ** <code>find_bricks(host=None, name=None)</code> - Find all the bricks in the area, returns a generator object <code>find_bricks</code>. | ||
− | + | * Example | |
− | + | import nxt.locator | |
− | + | sock = nxt.locator.find_one_brick() | |
− | + | brick = sock.connect() | |
− | + | print brick.host | |
− | + | brick.close() | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | === nxt.motor === | |
− | + | * Status: incomplete as of 2010-02-14 | |
− | == nxt. | + | === nxt.sensor === |
− | + | * Status: incomplete as of 2010-02-14 |
Revision as of 22:20, 14 February 2010
NXT-Python Documentation
Largely a work in-progress, please add/edit as you learn the details. Note that this page is documenting the NXT-Python release (URL here), not the NXT_Python release (hyphen vs underscore).
nxt.locator
The function of this module is to locate NXT brick(s). Returns an nxt.bluesock.BlueSock
object for robots connected by Bluetooth and a nxt.usbsock.USBSock
object for robot connected by USB, and throws nxt.locator.BrickNotFoundError
if none can be found.
- Status: incomplete as of 2010-02-14
- Objects
nxt.bluesock.BlueSock
- The object returned byfind_one_brick()
when a brick is found on a Bluetooth connection.
- Methods
connect()
- Try to connect to the brick.close()
- Close connection to brick.host
- Returns the address of the brick.- generator object
find_bricks()
, the object returned byfind_bricks()
.next()
- Find the next brick in the sequence, returns the same thing asfind_one_brick()
.
find_one_brick(host=None, name=None)
find_bricks(host=None, name=None)
- Find all the bricks in the area, returns a generator objectfind_bricks
.
- Example
import nxt.locator sock = nxt.locator.find_one_brick() brick = sock.connect() print brick.host brick.close()
nxt.motor
- Status: incomplete as of 2010-02-14
nxt.sensor
- Status: incomplete as of 2010-02-14