Each instance of this class can be used to represent a physical
Mobot. The member functions of this class can be used to get data, set
motor angles, scan for button events, and more.
The member functions of the Mobot class which are responsible for
moving the joints of the Mobot 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 Mobot class, all functions
are blocking unless the have the suffix "NB", such as
"Mobot.moveNB()".
When the above lines of code are executed, the Mobot will rotate
joint 1 360 degrees. Once the joint has rotated the full revolution,
the joint angles will be retrieved and stored in the variable
"angles". Now consider the following code:
For these lines of code, joint 1 also moves 360 degrees. The
difference is that with these lines of code, the joint angles will be
retrieved 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 getJointAngles() function to execute as the joint
begins moving.
|
|
|
|
|
connect(self)
Connect to a Linkbot through BaroboLink |
source code
|
|
|
|
|
|
|
|
|
disconnect(self)
Disconnect from the Linkbot. |
source code
|
|
|
driveJointTo(self,
joint,
angle)
Drive a single joint to a position as fast as possible, using the
on-board PID motor controller. |
source code
|
|
|
|
|
driveTo(self,
angle1,
angle2,
angle3,
angle4)
Drive the joints to angles as fast as possible using on-board PID
controller. |
source code
|
|
|
|
|
|
Robot Form
|
|
number
|
|
[float, float, float]
|
|
float
|
|
(float, float, float, float)
|
|
|
|
[numbers]
|
|
|
|
|
|
|
moveJoint(self,
joint,
angle)
Move a joint from it's current position by 'angle' degrees. |
source code
|
|
|
|
|
|
|
|
|
move(self,
angle1,
angle2,
angle3,
angle4)
Move all of the joints on a robot by a number of degrees. |
source code
|
|
|
moveNB(self,
angle1,
angle2,
angle3,
angle4)
Non-blocking version of move(). |
source code
|
|
|
|
|
moveTo(self,
angle1,
angle2,
angle3,
angle4) |
source code
|
|
|
|
|
moveWait(self)
Wait until the current robotic motion is finished. |
source code
|
|
|
|
|
recordAnglesEnd(self)
End recording angles and return a list consisting of [time_values,
joint1angles, joint2angles, joint3angles] |
source code
|
|
|
|
|
reset(self)
Reset the multi-revolution counter on the joints. |
source code
|
|
|
resetToZero(self)
Reset the multi-revolution counter and move all the joints to zero
positions. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setMotorPowers(self,
power1,
power2,
power3,
power4) |
source code
|
|
|
|
|
|
|
_transactMessage(self,
buf,
maxTries=3,
timeout=10.0) |
source code
|
|
|
|
|
|