Asked — Edited
Resolved Resolved by Steve G!

How To Get Init Script To Go Slower Servo'S?

am looking when i power jd on the pose he wil take goes slow. as in the video he does it slow but not when the init script runs.

User-inserted image


ARC Pro

Upgrade to ARC Pro

Stay on the cutting edge of robotics with ARC Pro, guaranteeing that your robot is always ahead of the game.

United Kingdom
#1  

I think this might be looking for. Here are slight changes to what you have, and you will want to add you Cheat Sheet commands in as well. Give it a try and let us know if this what you want...

# This will clear the selected servo 
# speeds for initialisation.

ServoSpeed(d2, 0)
ServoSpeed(d3, 0)
ServoSpeed(d7, 0)
ServoSpeed(d8, 0)
ServoSpeed(d4, 0)
ServoSpeed(d5, 0)


# Move the servos into initialisation 
# positions where you want the servos 
# to start from.

Servo(d2, 2)
Servo(d3, 180)
Servo(d7, 18)
Servo(d8, 77)
Servo(d4, 163)
Servo(d5, 105)


# This will set the servo speed for 
# these servos which will be used 
# from now on.

ServoSpeed(d2, 5)
ServoSpeed(d3, 5)
ServoSpeed(d7, 5)
ServoSpeed(d8, 5)
ServoSpeed(d4, 5)
ServoSpeed(d5, 5)

# Then add the rest of your control 
# command scripts here...
United Kingdom
#2  

Also one peace of advice. When you want to share scripts in a post, it's better if you use the UBB code. That way it's easier to look at and easier for someone helping you to copy the code and make changes.

User-inserted image

Write or copy your script where it says "text" inbetween the [ code ] and [ /code ] UBB codes .

Hope that helps.;)

PRO
Belgium
#3  

it works perfect.

code text code dont understand how that works?

United Kingdom
#4  

No problem. Glad it's working the way you want it to.

In regards to posting a script, if you don't mind, I will try to teach you how..

1) First, you need to use this [ symbol

2) Then write the word Code

3) Then use this ] symbol

4) Write your script, for example, Servo(D5,90)

5) At the end of the script use this [ symbol

6)Then use this / symbol

7)Then write the word Code again

8) Then finally use this ] symbol

It should look like the following picture...

User-inserted image

Or you can write it like this...

User-inserted image

And you will end up with this when you post your response...


Servo(D5,90)

I hope that helps:). It just makes it easier to make changes or to test someone's script without having to re-write the whole thing. If you want, post a reply back and give it a try.

PRO
Belgium
#5  
servo(D2,0)
servo(D3,0)
(servo(D7,0)
servo(D4,0)
servo(D8,0)

the code you teach me

PRO
Belgium
#6  

how do i get this on one black page?

United Kingdom
#7  

Yeah, you got it.

A you need to do is put the first [ code ] at the start of the first line of the script, and the [/ code ] at the very end of the last line the script...

User-inserted image

PRO
Belgium
#9  

servo(d2,  2)
servo(d3,180)
servo(d7, 18)
servo(d8,77)
servo(d5,105)

:D:)

United Kingdom
#10  

:D:D:D You got it buddy. A job well done.:):):)

United Kingdom
#13  

Your more than welcome.;)

#14  

Good tutorial there SteveG! I'm sure other's have been confused about how to insert code as well. :)

United Kingdom
#15  

@Justin.

Thanks buddy. I must admit when I first started here I didn't know what the UBB codes were or how to use them myself, lol.;)

#16  

Nomad, How did it "work perfect" adding the 0 speed for your servos, initialize help you? Did your robot move slower and not jump during the initialize startup process? Did your robot movements actually move slower with running the 0 speeds set points during initialize start up process prior to running the servo set-start positions, and servo speeds? I am just trying to understand. Steve s

United Kingdom
#17  

@Steve S.

I'll try to explain it. You know how when you have a servo set to move at a certain speed, say ServoSpeed(D5,2), it will move at that speed no problem. Now close that project and open it again.

Without the servo speed init script, when you connect to the EZ-B the servos will twitch. No problem. But now, when you move that servo for the first time since connecting to the EZ-B, even with the servo set to "2", it will move at full speed. Move it again a second time and it will move at speed "2".

Setting the servos to "0" in a init script basically initalises the servo speed (like it moved the first time, mentioned above), then later in the same script, it sets the new speed (like it moves the second time, mentioned above). Now when you move that servo normally with a script, it will move at speed "2".

That's basicly it. I Think I explained that okay.:P

I hope that helps Steve.

PRO
Synthiam
#18  

Exactly as steve said - the servo does not know it's position until it is moved into a position. When you power on a robot, the software has no idea what position the servo is in because there is no feedback information. The servo jumps to position - which is why the learn section explains to always start your JD robot from lying on it's back and not having any objects around that it will knock over.

You can find out more how servos work using the activity in the learn section here: https://synthiam.com/Tutorials/Lesson/48?courseId=6

#19  

Thank you Steve G and D.J. for responding, If I remember correcting we were told to set the actual servo positions first , then the speeds during initialize?


servo(d1,80)
servo(d2,90)
servo(d3,38)
servo(d4,141)
servo(d5,76)
servospeed(d1,3)
servospeed(d2,5)
servospeed(d3,2)
servospeed(d4,2)
servospeed(d5,5)

I appreciate your help, thank you. Steve S

United Kingdom
#20  

No problem Steve. Glad it helped. You are right in what you are saying though as that's how I have always understood it, and how I write my scripts. Position first, then speed.

But in this instance it's not necessary as in the first part or the script where everything is 0 (see post #2) we are not setting a servo position, only speed. But in the second part we are asking for a position so as you say, it's position first then speed. Something like that anyway.;)

PRO
Belgium
#21  

steve S

yes the init works great with steve G script.