Similar to programming the arm, claw movement is best done through a series of commands to account for Range of Motion. Anything beyond the range of motions will render the claw "stuck". Screen Shot 2022-01-13 at 1.17.02 PM.png67.9 KB
[setStopping(hold)] is a brake type mode that sets the claw motor to maintain its position after the movement. This is important if you want the robot to continue to draw power to hold an object.
[setMaxTorque] limits the amount of torque or strength the claw motor can apply. The value in this command may be adjusted to allow the robot to hold an object without crushing it.
[setTimeout] sets the motor to stop spinning if it gets stuck.
[spinToPosition] sets the target amount that the motor should spin to.
Try It: Changing Claw Direction
Change the direction that the claw moves by adjusting the position value as demonstrated below. Make sure to start with the claw in the open position this time. Download and run the program.
Use your program again, but with an object in the claw. Start with the claw in the open position and hold a squeezable object in the claw. You may want to consider adjusting your program to closing the claw even more, as demonstrated below. Download and run the program!
Change the strength of the claw by adjusting the torque. Start with the claw open, and place a squeezable object in the claw. Download and run the program.