Again with the newbie question here…my kids have made a claw that they need to open only about 60 degrees for an auto program. We have tried to use set rotations in graphical c but can’t get the numbers right. They tried set degrees command instead and nothing happened at all. Any suggestions on how to do this? I’m stumped.
It depends on the claw design and mainly gearing, but for the sample ClawBot direct drive, I’d say the flexing in shaft and other parts don’t allow for precise opens and closes.
You use resetMotorEncoder() command to set your “home” position (zero) and then do all the moves relative to that. The trouble is, if your zero is a freely closed claw (i.e. not pushing), you might get a consistent force-free open angle, but move back to zero will have very little grip, since those 60 degrees of claw move (with direct drive -> 60 degrees of the motor) are not much over the amount of flexing on the parts (plastic shaft, fingers).
The other issue might be your combination of motor commands. For example, the moveMotor command tries to get the motor to given position, but gives up once the motor no longer moves - the motor keeps pushing, but your program will move over to the next line. If you then issue another moveMotor, the change will be relative to expected outcome of the previous command, not relative to the current motor/claw position.
To explain this better - the smart motor keeps an internal state, “target angle”, and it continuously tries to get it’s shaft to that angle and maintain that angle (that’s why you can’t move the motor manually while a program is running). moveMotor command changes this target and tries to wait for the motor to finish. But you can manipulate this target angle directly, using setMotorTarget()/moveMotorTarget command, which should allow you consistent results (unless you reset it).
You can aid their troubleshooting by suggesting the displayMotorValues() debugging function - when used in a loop during the motor operations. That would allow then to see what the brain thinks it is going on.
Ultimately, nothing beats a physical hard stop - if they never need the claw to open any more.