Home | Trees | Indices | Help |
---|
|
mobot.Mobot --+ | Linkbot
Each instance of this class can be used to represent a physical Linkbot. The member functions of this class can be used to get data, set motor angles, beep the buzzer, scan for button events, and more.
The member functions of the Linkbot class which are responsible for moving the joints of the Linkbot can be categorized into two general types of functions; "blocking" functions and "non-blocking" functions. A blocking function is a function that "hangs" until the complete motion is done, whereas a "non-blocking" function returns as soon as the motion begins, but does not wait until it is done. In the Linkbot class, all functions are blocking unless the have the suffix "NB", such as "Linkbot.moveNB()".
For example, consider the following lines of code:
linkbot.move(360, 0, 0) linkbot.setBuzzerFrequency(440)
When the above lines of code are executed, the Linkbot will rotate joint 1 360 degrees. Once the joint has rotated the full revolution, the buzzer will sound. Now consider the following code:
linkbot.moveNB(360, 0, 0) linkbot.setBuzzerFrequency(440)
For these lines of code, joint 1 also moves 360 degrees. The difference is that with these lines of code, the buzzer will begin emitting a tone as soon as the joint begins turning, instead of waiting for the motion to finish. This is because the non-blocking version of move() was used, which returns immediately after the joint begins moving allowing the setBuzzerFrequency() function to execute as the joint begins moving.
The moveWait() function can be used to block until non-blocking motion functions are finished. For instance, the following two blocks of code will accomplish the same task:
linkbot.move(360, 0, 0) linkbot.setBuzzerFrequency(440) linkbot.moveNB(360, 0, 0) linkbot.moveWait() linkbot.setBuzzerFrequency(440)
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
[number, number, number] |
|
||
number |
|
||
number |
|
||
number |
|
||
integer |
|
||
[number, number, number] |
|
||
[major, minor, micro] |
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
bytearray |
|
||
|
|||
bytearray |
|
||
Inherited from Inherited from |
|
|
Connect to a bluetooth enabled Linkbot. Note that you must have a bluetooth enabled LinkPod connected to your Linkbot for this function to work. Most Linkbots do not come with BlueTooth, and instead use a ZigBee like protocol to communicate with each other.
|
Drive the joints to angles as fast as possible using on-board PID controller.
|
Non-blocking version of driveTo(). See driveTo() for more details
|
Enable the joint event callback. Whenever any joint on the robot moves, the callback function 'cb' will be called. The callback function should be of the form cb(millis_timestamp, j1, j2, j3, mask) where 'millis_timestamp' will contain a timestamp from the robot, and j1, j2, and j3 will contain the new angles of all of the joints in degrees, and mask will be a mask of all of the joints that triggered the event. |
Enable the acceleration event callback. Whenever a change in acceleration happens on the robot, the callback function will be called. |
Get the current accelerometer readings
|
Get the current battery voltage of the Linkbot.
|
Get the ADC (Analog-to-digital) reading from a breakout-board's ADC channel.
|
Get the voltage reading of an ADC pin. Note that the voltage is calibrated using the AVCC reference. If the reference is changed using the setBreakoutADCReference() function, the values reported by this function may no longer be accurate.
|
Read value from digital I/O pin.
|
Get the current RGB values of the rgbled
|
Get the hardware revision of the Linkbot
|
Use an instance of a Linkbot to get instances to other Linkbots. Note that this only works for Linkbots that are connected via Bluetooth or TTY, but does not work for Linkbots that are connected to BaroboLink. |
Get the serial ID from the Linkbot
|
|
Move all of the joints on a robot by a number of degrees.
|
Non-blocking version of move(). See move() for more details
|
Make the joints begin moving continuously.
|
|
Move all joints on the Linkbot. Linkbot-I modules will ignore the 'angle2' parameter and Linkbot-L modules will ignore the 'angle3' parameter. This function is the non-blocking version of moveTo(), meaning this function will return immediately after the robot has begun moving and will not wait until the motion is finished.
|
Reboot the connect robot. Note that communications with the robot will not succeed while the robot is booting back up. |
Begin recording joint angles.
|
End recording angles and return a list consisting of [time_values, joint1angles, joint2angles, joint3angles]
|
|
Set the acceleration of all joints. Each joint motion will begin with this acceleration after calling this function. Set the acceleration to 0 to disable this feature. |
Make a robot's joint start accelerating forwards (positive accel value) or backwards.
|
Set an analog output pin (PWM) to a value between 0-255. This can be used to set the power of a motor, dim a LED, or more.
|
Set the reference voltage of an analog input pin.
|
Set a digital I/O pin to either a high or low value. The pin will be set high if the parameter 'value' is non-zero, or set to ground otherwise. |
Set the mode of a digital I/O pin on the breakout board. Valid modes are barobo.PINMODE_INPUT, barobo.PINMODE_OUTPUT, and barobo.PINMODE_INPUTPULLUP. |
Set the buzzer to begin playing a tone.
|
Set the minimum change in g-force required for the robot to report an acceleration event. See also: enableAccelEventCallback()
|
Set the minimum amount the joint must move before a joint motion event is reported. Also see enableJointEventCallback()
|
Set all three motor speed simultaneously. Parameters in degrees/second.
|
Set the LED color
|
|
Set the movement state for all three motors.
|
Move a joint to a desired position with a specified amount of starting and stopping acceleration.
|
Receive data from a TWI device. See twiSend() for more details.
|
Send data onto the Two-Wire Interface (TWI) (aka I2c) of the Linkbot. Many Linkbot peripherals are located on the TWI bus, including the accelerometer, breakout boards, and some sensors. The black phone-jack on top of the Linkbot exposes TWI pins where custom or prebuild peripherals may be attached.
|
Send and receive data from a TWI device attached to the Linkbot. See twiSend() and twiRecv() for more details.
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Mon Aug 4 17:26:38 2014 | http://epydoc.sourceforge.net |