The three main goals of this activity are to:
(1) Resistor - 220 Ω (red-red-brown-gold)
(1) 3-pin header
(1) Jumper wire - red
(1) Jumper wire - black
(1) cyber:bot robot with micro:bit v2, and with the Gripper kit installed following the instructions in these chapters:
The script will turn the Gripper control servo to its 30° position to make the gripper close and lift, and to its 150° position to make the Gripper paddles lower and open. If your Gripper does not properly complete both motions, the troubleshooting section (just below this section) has a script you can run while making mechanical adjustments.
test_gripper_angles_buttons_with_fb360.hex [4]
Note: The script was created by entering the python script below and adding the cyberbot.py and feedback360.py modules to the Project Files as shown in Add modules to your micro:bit [5]. The Script Name was set to test_gripper_angles_buttons_with_fb360 before saving it as a .hex file as shown in How to Save and Reopen a Script in Python Editor v2 [6].
# test_gripper_angles_buttons_with_fb360 from cyberbot import * display.show(Image.ARROW_E) while True: if button_b.was_pressed(): bot(15).servo_angle(30) # Close gripper & lift display.show(Image.ARROW_W) elif button_a.was_pressed(): bot(15).servo_angle(150) # Lower gripper & open display.show(Image.ARROW_E)
The main purpose of these tests is to verify that the script makes the Gripper paddles complete both the close/lift and lower/open motions. If it doesn’t do both correctly, try the Troubleshooting section below.
If your Gripper passed the Tests section and does not need troubleshooting, continue to the next section. Otherwise, continue below.
In the Gripper 3.0 Assembly Instructions [3], there’s a Tuning and Programming [8] activity with a Physically Position the Servo and Gripper section. It has instructions to “Move the servo through its range of motion and make sure it is centered when the Gripper is the closed, lowered position.” Here are some steps you can follow to make sure this was done correctly:
center_grippper_with_fb360.hex [9]
# center_gripper_with_fb360 from cyberbot import * display.show('C') bot(15).servo_angle(90) # Lower only, leave closed
If you answered “No.” to either of the two questions, here’s how to fix it:
After importing the cyberbot module, the script uses display.show(Image.ARROW_E) to point at the micro:bit module’s B button.
# test_gripper_angles_buttons_with_fb360 from cyberbot import * display.show(Image.ARROW_E)
The main loop repeatedly checks if either the A or B buttons have been pressed. If the B button was pressed since the last time it checked, the bot(15).servo_angle(30) call closes and lifts the Gripper. If the A button was pressed since the last time it checked, the bot(15).servo_angle(150) call lowers and opens the Fripper. Both servo_angle calls can be considered “set it and forget it” so the servo will hold the position it was most recently set set to. Whenever a particular button is pressed, the arrow is updated to point at the other button.
while True: if button_b.was_pressed(): bot(15).servo_angle(30) # Close gripper & lift display.show(Image.ARROW_W) elif button_a.was_pressed(): bot(15).servo_angle(150) # Lower gripper & open display.show(Image.ARROW_E)
Some objects need to be lifted and set down more carefully, like objects with narrower bases. As an example of how you might accomplish this with the Gripper, try modifying the test script to make the Gripper paddles open and close more gradually. Since there's no servo_speed for the standard servos, we have to use a loop to slow the servo's rotation.
A standard servo turns to and holds a certain angle in response to a rapid series of timed on/off signals from the cyber:bot board. This is the kind of servo that controls the Gripper. The Parallax Standard Servo can turn to and hold positions in the 0° to 180° range.
A continuous rotation servo turns at certain approximate speeds in response to a rapid series of timed on/off signals from the cyber:bot board. This was the kind of servo that controlled the cyber:bot robot’s wheels before you upgraded them to Feedback 360° servos.
A feedback servo is a continuous rotation servo that can measure and report its angular position as “feedback.” The cyber:bot board uses the Feedback 360° servos’ angular position reports to adjust the speed control signals to make them maintain certain speeds and travel certain distances.
Instead of you having to hold down the A/B buttons, the script can make the gripper gradually open and close on its own automatically after a button press-release. Simply put the statements updating the degrees variable and servo degree angle in a while loop that continues while the angle is greater than 30. A similar loop could also be written for button A that continues while degrees is less than 150.
Links
[1] https://learn.parallax.com/tutorials/robot/cyberbot/build-your-cyberbot-rev-c-board
[2] https://learn.parallax.com/tutorials/robot/cyberbot/upgrade-your-cyberbot-feedback-360-servos
[3] https://learn.parallax.com/gripper
[4] https://learn.parallax.com/sites/default/files/content/cyberbot/GripperF360/Hex/test_gripper_angles_buttons_with_fb360.hex
[5] https://learn.parallax.com/tutorials/robot/cyberbot/add-modules-your-microbit
[6] https://learn.parallax.com/tutorials/robot/cyberbot/how-save-and-reopen-script-python-editor-v2
[7] https://python.microbit.org/v/2
[8] https://learn.parallax.com/tutorials/gripper-30-assembly-instructions/tuning-and-programming
[9] https://learn.parallax.com/sites/default/files/content/cyberbot/GripperF360/Hex/center_gripper_with_fb360.hex