Difference between revisions of "Robotics-2010"

From Earlham CS Department
Jump to navigation Jump to search
(New page: == NXT-Python Documentation == Largely a work in-progress, please add/edit as you learn the details. === nxt.locator === The function of this module is to locate NXT brick(s). Returns a...)
 
Line 3: Line 3:
  
 
=== nxt.locator ===  
 
=== 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.  
+
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.  
  
 
* Objects
 
* Objects
** <code>nxt.bluesock.BlueSock - The object returned by find_one_brick() when a brick is found on a Bluetooth connection.  
+
** <code>nxt.bluesock.BlueSock</code> - The object returned by <code>find_one_brick()</code> when a brick is found on a Bluetooth connection.  
  
 
* Methods
 
* Methods
 
** <code>connect()</code> - Try to connect to the brick.  
 
** <code>connect()</code> - Try to connect to the brick.  
** <code>close() - Close connection to brick.
+
** <code>close()</code> - Close connection to brick.
** <code>host - Returns the address of the brick.  
+
** <code>host</code> - Returns the address of the brick.  
  
 
     generator object find_bricks
 
     generator object find_bricks

Revision as of 09:45, 9 February 2010

NXT-Python Documentation

Largely a work in-progress, please add/edit as you learn the details.

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.

  • Objects
    • nxt.bluesock.BlueSock - The object returned by find_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 by find_bricks(). Methods (incomplete):
           next()
               Find the next brick in the sequence. Returns the same thing as find_one_brick(). 

Methods: (incomplete)

   find_one_brick(host=None, name=None) (incomplete)


   find_bricks(host=None, name=None)
       Use to find all the bricks in the area. Returns a generator object find_bricks. 

Example: import nxt.locator sock = nxt.locator.find_one_brick() brick = sock.connect() print brick.host brick.close()

nxt.motor

nxt.sensor