Setting Servo speeds and Initialization Script Tutorial
Step 2. Servo Speed Init, Part 2.
You may have several "Init" commands for different scripts and/or controls in you project that all need to start when you connect your EZ-B to EZ-Builder. Some of these "Init" scripts you may wish to call again while your project is already running, for example, the Off button I mentioned in the last step. So instead of having one large script in the "Connection Control" containing all of your "Init" scripts, add a "Script Manager" control to your project, and place each of your "Init" commands in individual script controls. So, using our servo speed example...
1.) On the EZ Builder menu ribbon, click on "Project", then "Add Controls", then click "Scripting", and then "Script Manager" to add the control to your project.
2.) This step is optional, but it is recommended. On the bottom of the "Script Manager" control, click on the gear icon and rename the control to something of your choosing, something like "Init Manager", then hit "Save".
3.) Again, on the bottom of the Script Manager control, click "Add Script". The script editor will automatically open.
4.) In the script editor, write in your servo speed "Init" script.
5.) This is quite an important part, and this is to name your script. On the top left of the script editor, click on the text input field (it may already say something like "Script 1") and rename your new script to something like "Servo Speed Init", and then press "Save" to close the script editor.
A final couple of steps are needed now to add the command in the "Connection control" to automatically start your servo speed "Init" script.
6.) Click on the gear icon next to your EZ-B's IP address on the "Connection Control" to open the script editor.
7.) In the script editor, right click your mouse/trackpad button to bring up the list of Cheat Sheet commands, find the name of your script manager (in our example, "Init Manager") and click to expand the command list. Click on "ControlCommand,Init Manager,Start", then Click "Save" to close the editor, and "Save" again to close the "Connection Control" menu.
8.) Now all that remains, is to save these changes to your EZ Builder project by hitting "File" and then "Save" in the menu ribbon.
What I have found is that when I set to ServoSpeed(D3,0) , and then add position Servo(D3, 90) and finally ServoSpeed(D3, 4), servo D3 runs as fast as it can to get into startup position. I also found that if I insert ServoSpeed(D3, 4) in the line before Servo(D3, 90) it moves slowly to startup position. The tutorial says not to set final speed until after setting position or you will have a problem. What am I missing?
Sorry for the last comment. It was sent by accident.
I tried to submit it in the tutorial but I got an error message and could't send it.
The tutorial I was reading is above "Setting servo speeds and Initialization Script Tutorial"
I am sending the information here so I don't need another thread.
I am having problems with my initiation script. I have found that when I set ServoSpeed(D3, 0) , and then add position Servo(D3, 90) and finally ServoSpeed(D3, 4), servo D3 runs as fast as it can to get to position given by Servo(D3, 90) startup position. I also found that if I insert ServoSpeed(D3, 4) in the line before Servo(D3, 90) it moves the correct slow speed to Servo(D3, 90) position.
The tutorial says not to set final speed until after setting position or you will have a problem. What am I missing?
I believe what the tutorial is trying to convey is initialization of a servo position. That means the very first time a servo is moved or set into position
a servo doesn’t have a position when power is applied. There’s no way to slowly transition to the initialization position because there is no previous position. so, you must set a position first, which initializes the servo and then set the speed. Once the speed is set, it’ll always have that speed for moving until speed is specified again.
The first initialization of servos will always move quick as they can to the specified position. It’s annoying, but it’s how servos work.
Now, if you’re hardcore and want to get around that issue. You can look up my hack on adding adc position monitoring. That way, you can know the position the servo is in and initialize at that position. Then, set the speed. There would not be any jumping if you did that
heres the plugin which has the video and details: https://synthiam.com/Products/Manual/PWM-Servo-Feedback-ADC-18047
Is there a problem with adding ServoSpeed(D3. 4) code in the line before Servo(D3. 90) line .
If I do this, it doesn’t jerk into D3 position. D3 controls up and down movement of the head of the robot. Without the control the heavy robot head slams int position D3. I am afraid over time I will damage the servo and robot body. This is a five foot Robot called max. He weighs about 70 lbs. t will soon post a picture.
I’m surprised that works, but if it does then yeah go for it. Really if anything does work, keep doing it as the phrase goes, don’t fix it if it ain’t broke
If it is working now, great, just be sure you are testing after first power up and not just running the script after you have already moved the servos before trusting it.
Alan