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

Rotating A Servo

I recently got my EZ-B and have started working on some of my planned projects. One thing that I noticed is that when rotating a servo (a standard servo) from EZ_B.Servo.SERVO_MIN to EZ_B.Servo.SERVO_MAX, it is not exactly 180 degrees that it rotates (I noticed this with ARC also). I have several questions about using the servos:

1. How many degrees is an increment of 1 when using the SetServoPosition method?
2. When I attach the servo attachment (before connecting the EZ-B to the servo and computer), how do I know what position it is in? I need to know this so that I know what position to attact the attachment in.

I am asking these questions because my software needs to know the start and current positions of each servo are, as well as what angles to attach the servo attachments at. Thanks.

#1  
1) Depends on the amount of rotation your servo allows and your min max settings. ARC allows for a Max of 100 steps and a Min of 1 step thus 100 steps per rotation. If you had a servo that went 100 degs with in its rotation then you would have a 1deg per step however if you have a 180 deg rotation servo the deg per step is different so ((number of deg per step)/(max servo rotation)) = (min)/(max)

2)You can set the beginning position as a defined home state if you wish so when you start the program it moves to that state. I am not sure if the method still exists but I do believe there was one in the SDK for the servo position read.
#2  
What do you mean by min/max settings? In the SDK, EZ_B.Servo.SERVO_MIN and EZ_B.Servo.SERVO_MAX are constants, not settings. And how am I supposed to know the amount of rotation my servos allow? I think what I am basically saying and asking how to do is that my robot needs to know the position it's servos are starting at and where they are moving to in order to successfully accomplish a task. (NOTE: Don't forget that this forum is the SDK: Visual Basic forum, so what ARC allows is not important, and if there are any extra values need to be (and can be) calculated, that is not a problem because everything is being done using VB.NET, not ARC)
#4  
Does that mean I need to manually measure how many degrees each of my servos rotates when I rotate it from EZ_B.Servo.SERVO_MIN to EZ_B.Servo.SERVO_MAX and then do the math to determine the number of degrees supported by each servo and calculate how much each step is? The math is pretty simple, and I suppose I could do the measuring, I was just hoping there was a better way, but I guess if manual measurement is the only way, then maybe I should just see it as another step in the project. Thanks.
PRO
Synthiam
#5  
How come you need to know how many degrees the servo moves?

you don't need to measure for each servo, only between servo models.
#6  
So if I measure the number of degrees allowed by one of the standard servos that came with my EZ-Robot Complete Kit, it will be the same for all the EZ-Robot standard servos, and I just need to do the math?

I need to this because many of the projects I have planned involve calculating certain things. For example, one of my projects is stacking blocks. Depending on how many blocks have already been stacked, it needs to calculate how high to move the gripper before letting go. I would think that you would need to know this information for almost every servo (at least the standard servos) in almost every project, otherwise, how do you know what value to specify when using methods like SetServoPosition? For projects that are more of a "follow the ball around" type thing that use modified servos (the wheels) or a "turn until you see this" type thing (the head or looking around) that does something until they are told to stop (the camera sees something) by an input device or other source, I agree, you don't really need to know how many degrees the servo turns, but for other things, I would think you would normally need to know.

I'm sorry to ask so many questions, I just never really had any education in hardware, only in software, so I'm still learning a lot of the stuff I need to know for my robot projects. Thanks.
PRO
Synthiam
#7  
Don't ever apologize for asking questions:)

Stacking blocks will be a fun project:)

If you know the height of each block, you can use the Auto Position Control. Create an action for the final position of each row and column of the blocks. That way, it doesn't matter what position the block is picked up in, it will be able to Auto Position the servos into the specific Column and Row:)
#8  
I'm sure the AutoPosition control would work great for the block project, but I think what I was trying to get at was that I want to have complete control. Being a developer, I like to be able to have the option of manually calculating things, because I expect that some of my future projects will require doing things less straightforward than determining the position of a block. But back to my original idea, if I measure the degrees allowed and do the math it will work? Thanks.
United Kingdom
#9  
Yes, basic maths. Do it for each make & model of servo.

So, for instance, if the EZ-Robot Standard servo rotated 185' (I haven't measured, that probably isn't right, if it is it's a coincidence) from 0 to 100 it is as simple as dividing 185' by 100 steps so each step would be 1.85' and to work out how many steps to move 90' it's just 90' divided by 1.85' = 48.6 so 49 steps.
#10  
Min and Max are constants, to which you can change accordingly, however they can be used to limit the amount of steps available through the rotation of the servo. So you have a 180 deg servo so the num of deg per step = x. x/180 = min/max. you choose to have min of 1 and max of 100. x/180 = 1/100; so x = 180/100; x=1.8 thus each step will produce a rotation of 1.8deg. If you change the min or max you will change the amount of deg per step that is produced by your 180deg servo.
United Kingdom
#11  
You can change the min and max from a min of 1 and max of 100 but doing so will not increase the steps between the new min and max.

I.E.

Min = 1
Max = 100
Rotation = 180
Steps = 100
Degrees per step = 1.8

NewMin = 11
NewMax = 90
NewRotation = 180 - (20x1.8) = 144
NewSteps = 80
Degrees per step = 1.8

The degrees per step will always remain the same.

At least that's how I've always thought it is... please, correct me if I am wrong though.
#12  
by changing the min and max you would effectively increase the amount of rotation per step as the defualt of min =1 and max=100 is the highest resolution you can obtain. Perhaps it may not work this way but by setting 11 as your min 0deg and max to 90 being 180deg the amount of deg per step would increase. If this is how DJ has the PID setup for the servo signal generation otherwise the min and max would effectivly only shorten the sweep range of your servo if it works the way you are describing it.
United Kingdom
#13  
I was lead to believe that the min and max were positions, i.e. if min is set to 11 the software will not attempt to move the servo in to positions 1 to 10. Therefore the degrees per step will always remain the same. I may be wrong but I'm pretty confident that I'm not.
#14  
DJ does state it in his standard servo description as being position so you maybe correct. If this is the way it works then you do only have a set 1.8deg per step, for a 180deg servo, and by changing the min max you would be shorting the sweep range of your servo. I could see its use but I know the resolution for the steps is usually what I am more concerned about when programming my own servo signals using other microprocessors.
#15  
I think I have solved my problem. I found out what value makes it turn 180 (which ended up being 86) by trying several estimated values. I then came up with the following equations to convert between value and angle:

angle=(36/17)*(value-1)
value=((17/36)*angle)+1

As for attaching the servo attachment at the right angle, I guess you just need to do something like rotate your servo to a known value (such as the minimum) and then attach the attachment at the angle you want it to be at for that value. Using these equations and techniques I have been able to rotate my servos to the desired angle with no trouble. Problem solved! Thank you all for your help!
United Kingdom
#16  
I always use the ARC software, add the servo to one of the digital ports, add the servo control, set it to 50 (mid way) and fit the servo horn if it needs to be exactly in position.

I also always calibrate the servos and centre them when I get any new ones by running the attached script in ARC.

ServoFullRangeWarmup-634899825363427735.ezb