Asked — Edited

Servospeed Command Intermittent Question?

Hi everyone!

I am enjoying the V4, but I am getting an intermittent problem when I use the commands servospeed and servospeedrandom in the ez-scripts.

If I leave the speed at 0, max speed, the servos always respond, changes to the position that I program in the code, no problems, but if I use the servospeed command to have the servo move at a slower speed, even if it is only set to 1, the servos don't always respond.

In other words, when the program starts, I've tried different programs, even the simplest using these commands, the servo may go to the position the script tells it to go to, or it may not. It will just sit there, won't go to any position, and I can tell the program is still running, because I have also opened up a servo window and it shows the position numbers changing in green, but unfortunately the servo just doesn't move.

Yes I have checked and I am still connected, because while this is doing this, I can still drive the robot around. I've noticed that I have to disconnect the robot from the program, then reconnect and the servo will start moving like it should. I usually don't even have to stop the program. As soon as the V4 reconnects, it starts running the program. Sometimes I do have to stop the program and disconnect, then reconnect the robot for the servos to work with that command.

It randomly does this. I use Windows 8 and I have also tried on Windows 7. Any ideas or fixes are appreciated. Thanks :)


ARC Pro

Upgrade to ARC Pro

With ARC Pro, your robot is not just a machine; it's your creative partner in the journey of technological exploration.

#1  

Did you call a servo move first before setting the speed (you have to do this at least once)?

Servo(d0,90) Now you can set servo speed as you wish...

#2  

I get odd problems when my batteries start to run low (works one minute, not the next, reconnect and it works better for a while). Do your batteries have a good charge?

#3  

@Rich R, At first I was thinking that, but unfortunately it still does it.

@Justin Ratliff I do have good batteries and I switched them out last night just to be sure.

#4  

Johnathan, I have better results calling a "reset servos" script at the end of routines setting everything back to home positions and speeds. Steve S

United Kingdom
#5  

First, write an initialisation script for running on connection, something which will reset all servos to their default safe positions, release them and then set the servo speeds as required.

Click on project, add and choose EZ-Script from the scripting tab. Name the script init (or something similar, if you change it the following will also need changing when I get to the ControlCommand() part.

Write your init script...

Feel free to modify this example to suit your project.

# Initialisation Script

# Move all servos to default safe place
Servo(D0, 90)
Servo(D1, 90)
Servo(D2, 90)
Servo(D3, 90)
Servo(D4, 90)
Servo(D5, 90)
Servo(D6, 90)
Servo(D7, 90)
Servo(D8, 90)
Servo(D9, 90)
Servo(D10, 90)
Servo(D11, 90)
Servo(D12, 90)
Servo(D13, 90)
Servo(D14, 90)
Servo(D15, 90)
Servo(D16, 90)
Servo(D17, 90)
Servo(D18, 90)
Servo(D19, 90)
Servo(D20, 90)
Servo(D21, 90)
Servo(D22, 90)
Servo(D23, 90)

# Release all servo
ReleaseAll()

# Set servo Speeds
ServoSpeed(D0, 0)
ServoSpeed(D1, 0)
ServoSpeed(D2, 0)
ServoSpeed(D3, 0)
ServoSpeed(D4, 0)
ServoSpeed(D5, 0)
ServoSpeed(D6, 0)
ServoSpeed(D7, 0)
ServoSpeed(D8, 0)
ServoSpeed(D9, 0)
ServoSpeed(D10, 0)
ServoSpeed(D11, 0)
ServoSpeed(D12, 0)
ServoSpeed(D13, 0)
ServoSpeed(D14, 0)
ServoSpeed(D15, 0)
ServoSpeed(D16, 0)
ServoSpeed(D17, 0)
ServoSpeed(D18, 0)
ServoSpeed(D19, 0)
ServoSpeed(D20, 0)
ServoSpeed(D21, 0)
ServoSpeed(D22, 0)
ServoSpeed(D23, 0)

# Initialisation Complete

Then set ARC to run this script on connection. To do this simply click on the gear icon in the connection control... User-inserted image

Then either type the single line command or click on the pencil icon to open the script dialogue and enter the command User-inserted image

Add the script command

ControlCommand("Init", ScriptStart)

User-inserted image

And click save.

In theory you could write the whole init script in the connection script dialogue if you wanted to. I prefer the init script to be there on the project so, if necessary, you can manually trigger it if there is ever a need to.

On connection to board 0 the Init script should run.

This should stop any issues you are having, at least I don't have those issues and I have a similar script to this on all of my projects.

#6  

@Rich,

I have set the servo position before the servospeed command, though I haven't tried it with the releaseall() command in between as you have it in the example. I will try that and find out if that works. Thanks

#7  

Update:

I have tried everyone's suggestions, but unfortunately, no luck. I am going to try different servos, although the ones I am using are standard Hi-Tech servos. Maybe changing them out with different ones will work. It is just strange why they intermittently work, because when I was using the V3 board, these servos worked with the servospeed command every time with no problems.

I'll try a few more things as well and I'll keep you all posted of what I find out. Thank you everyone for your help.