Servo motors sometimes move too aggressively typically when a motion moves to another and it sometimes makes the arduino crash because of the high current drained into the motors.
This change limits the speed of the servo motors by having the previous position and checking the differences.
For backward compatibility, this feature is disabled by default. This feature is enabled by adding the following code into the Otto Blockly / Arduino projects.
Otto.enableServoLimit();
Following is the example to apply the feature into a Otto blockly project.
You also can adjust the limit by putting a parameter when you call enableServoLimit() function. The parameter can be given as degree / sec for the maximum rotation speed. The default value is 240.
If you want to limit 120 degree / sec instead of 240 degree / sec, you can call the function as follow;
I propose this as an optional feature of this library this time but I feel this could be the feature turned on by default for make the Otto's move safer and stable side. Advanced developer can disable for their aggressive moves.
About this change
Servo motors sometimes move too aggressively typically when a motion moves to another and it sometimes makes the arduino crash because of the high current drained into the motors. This change limits the speed of the servo motors by having the previous position and checking the differences. For backward compatibility, this feature is disabled by default. This feature is enabled by adding the following code into the Otto Blockly / Arduino projects.
Following is the example to apply the feature into a Otto blockly project.
Following video demonstrate the effect (videos):
No limit https://drive.google.com/file/d/1ind8VeGXa1izIdFk42XV6do8Ohr1Dj4j/view?usp=sharing
Apply the limiter https://drive.google.com/file/d/1TL_hsLVUXM647yDn95L8NPz5rY-kRKCl/view?usp=sharing
You also can adjust the limit by putting a parameter when you call enableServoLimit() function. The parameter can be given as degree / sec for the maximum rotation speed. The default value is 240. If you want to limit 120 degree / sec instead of 240 degree / sec, you can call the function as follow;
Following is the motion (video) when the limit is set to 120. You can see the movement become more conservative https://drive.google.com/file/d/10tdl7VoxpnufJ3F-akJPz1v52Ke-LKhh/view?usp=sharing
Note
I propose this as an optional feature of this library this time but I feel this could be the feature turned on by default for make the Otto's move safer and stable side. Advanced developer can disable for their aggressive moves.