Welcome to Synthiam!

Program robots using technologies created from industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation and artificial intelligence easy.

Get Started
Asked — Edited

Servo Speed

Some of my servos work with the servospeed command and some don't.
When I run this script

Code:

 
servospeed(d15,5)
servo(d15,1)
sleep(2000)
servospeed(d17,5)
servo(d17,100)
sleep(2000)
servospeed(d16,5)
servo(d16,1)

Only servo d17 runs slow. Both of the other two run at full speed. The servos are the same brand. I thought it was part of the bug but it is still doing it.

PRO
Synthiam
#1  
lol because you're moving the servo into position 1 and it's already there when it starts, silly:P

Quote:


servospeed(d15,5)
servo(d15,100)
sleep(2000)
servospeed(d17,5)
servo(d17,100)
sleep(2000)
servospeed(d16,5)
servo(d16,100)
#2  
No, that one is inverted. Sorry, I didn't mention that. I also tried moving servos and digital inputs. Everything is random. Just some work and some don't.
PRO
Synthiam
#3  
you can't invert a servo in script. everything works
#4  
No silly, The servo is inverted ! So going to 100 is the same as going to 1 for that servo.
PRO
Synthiam
#5  
No, you can't invert servos in script. You can only invert servos in controls. Each control has it's own settings for servos. For example, if you add a Vertical servo Control and select INVERT, that doesn't apply to a Camera Control that uses the same servo.

Each control is responsible for moving a servo. It's like time sharing. So when you're using Scripting, the position is always the same. Position 1 is always position 1.:)
#6  
I didn't invert it in script. The servo is inverted in the servo control. Look, I will change the servo controls so they are all the same and change the script so they are all the same but the result will be the same because I have been there and done that. Trust me. Okay, I did that.

Code:


servospeed(d15,5)
servo(d15,1)
sleep(2000)
servospeed(d17,5)
servo(d17,1)
sleep(2000)
servospeed(d16,5)
servo(d16,1)

Same result. Only one ran slow. Other two ran at max speed.
PRO
Synthiam
#7  
No, you can't invert servos in script. You can only invert servos in controls. Each control has it's own settings for servos. For example, if you add a Vertical servo Control and select INVERT, that doesn't apply to a Camera Control that uses the same servo.

Each control is responsible for moving a servo. It's like time sharing. So when you're using Scripting, the position is always the same. Position 1 is always position 1.
#8  
I don't know where to go with this. Your last responce is identical to the last one where I changed what i did to match your responce to no avail. I can't win!! My servos are not slowing down. I even set up a speedservo control to watch what the speed was and it read what I scripted but it ran at full speed. Total frustration.
PRO
Synthiam
#9  
Sorry dude, but i can't continue repeating myself. Please re read my reply.

You cannot invert a servo in script. I can't say it any differently.

Your code keeps putting the position to 1, and that's the starting position. So if you change your code to move the servos to position 100, you will see the speed.
PRO
Synthiam
#10  
This will demonstrate. Keep in mind that you may not wish to push a servo past its limits. Some servos will burn out their motor if you push it too far. Some servos start at position 10, and end at position 90.

Code:


# Set servo Speeds
servospeed(d15,5)
servospeed(d16,5)
servospeed(d17,5)

:LOOPSTART

# Move servos to position 90

servo(d15,90)
sleep(2000)
servo(d17,90)
sleep(2000)
servo(d16,90)
sleep(2000)

# Move servos to position 10

servo(d15,10)
sleep(2000)
servo(d17,10)
sleep(2000)
servo(d16,10)
sleep(2000)

goto(LOOPSTART)
#11  
Hello again,
Just got home from work. I copied your script and tried it and I got the same results. So I copied it and put it into a new control and deleted the onld one and now everything is fine. Thank you for all your help and patients.
PRO
Synthiam
#12  
:) I knew you'd get it. Never let me down yet!:D
#13  
I've been bookmarking and saving any pages that people have posted here hoping it will help me. Yesterday I was thinking that DJ wanted you to go through the motions your self to get it working because you would learn a lot more by your own discovery then if he would have just told you. JW:)
#14  
@ DJ:
Methinks you snuck one in on us! I don't find :LOOPSTART in the ARC manual; but I entirely get it! Kinda sneaky.....................you're going to teach some of to write code whether we know it or not. I'm back to lurking.................... Really enjoying "High Five". So much more we can do now. I'm at the point where I'm ready to start mounting componets on Gizmo. Next is the batteries and motor driver. BTW On the L289N driver is the ENA and ENB the pins to put the PWM on??????? Will be posting progress photos as I go. I got my Camcorder out yesterday. Believe it or not I'm going to attemp to do a video.
Lloyd
PRO
Synthiam
#16  
@Robotz012248 hey lloyd, great to hear! The scripting manual does mention the LABEL feature..

Quote:


:Label
Defines a label for a GOTO() command
Example: :My_Label

Goto( label )
Goto a specific :Label location
Example: Goto(My_Label)


As for your PWM on the motor controller, connect a Digital I/O Port from the EZ-B to both Enable connections on the LN298. There will be 2 jumpers, 4 pins for the Enable on the LN298. Two of those pins are Enable, and the other 2 are +5. You can verify by using a volt meter of which is which.