ARC Pro

Upgrade to ARC Pro

ARC Pro is more than a tool; it's a creative playground for robot enthusiasts, where you can turn your wildest ideas into reality.

#1   — Edited

Do you want the direction to remain inverted all the time?

Maybe there's a better way but try this; add a servo control, either horz or vert, and assign it to the digital port you have your servo attached to. While in the set up window just click the "Inverted" check box and your servo will always turn the other direction.

You should also set up the Min / Max points of your servo in your INT script. It should look something like this:

# Rt side_to_side Wrist
SetServoMin(2.D0, 120)
SetServoMax(2.D0, 165)

# Rt Up_Dn Wrist Servo
SetServoMin(2.D1, 20)
SetServoMax(2.D1, 170)

You may also want to set your servo speeds and positions the same way in your INT script. I send a Frame Jump command from my INT that I have set up in my AutoPosition control.

ControlCommand("Auto Both Arms", AutoPositionFrameJump, "Center_Both_Arms")

Along with the Invert check box clicked in the servo control your servo should be ready to run in the direction you want after the INT is done running.

#3  

So is that only way to do it ?   If that is the way it works I need to understand how it works as it relates the init script.  If I setup a servo control with the invert checked the Min = 60 and the Max = 160. With a home position of 105

But if I set those values in the init script they would be the wrong values as the init script does not know the servo is inverted.  So if I set the servo position to 105 in the init script the servo does not go there it goes to 76.

Should I set the min/max value based on none inverted servo values?

I hope this is clear.

#4  

t

Quote:

he inverted value is not global.
Woops. I was wrong. Thanks for keeping me honest DJ. Lol.

#5  

Some servos can be wired in reverse to change the direction. I've done it on a few analog servos. You need to reverse the outside two wires on the pot and the two motor wires.

#6  

So DJ I have to ask based on your comment what is the benefit of setting Max/Min values in an init script if you set them in every skill? I am sorry if that is a stupid question.

#7   — Edited

This is from the article DJ pointed to:

Quote:

Hard Set servo Limits

Quote:

You can set global servo positions across all robot skills with the appropriate Javascript, EZScript or Python commands. The robot skill settings for servos are for the individual robot skill only. Every robot skill has servo values (i.e., min and max).
I was trying to adjust the min/max the other day in one of my servo control skills. I couldn't get the servo to respond properly when I was trying to stretch out the values. Prior to this I had booted ARC and had let my INT script run with my min/max servo settings at start up. Once I restarted without letting the INT script run I was able to adjust the servo min/max settings in the servo control. From this instance I came to believe that once a script sets the min/max that these values are "Hard Set" and other controls using that servo can't go past these limits. It's a fail safe.

On a side note, I burnt out an expensive servo the other day because I had not run the INT with the Min Max global settings in place. I have this servo mounted so as it will hit an object before it will reach it's internal limit. Using the servo control I pinned it up ageist this object and it continued to push until it burnt out. With the global Min/Max limits set after running my INT, the servo will stop before it reaches this physical barrier. It seems to me that once set, the global min/max setting supersedes any of the servo controls settings or actions.

#8  

Thanks everyone I just set the Min/Max values in the Init script as though the servo was invert and things seemed to work as I needed it.

#9  

Outstanding. So how does it look on paper? Do you make the max the lower number and the min the higher?

#10  

So let me explain because of this design to make the head go up and down both servos need to move at the same time.  the issue is the right servo needs to move in the reverse direction of the left servo. So when I want the head to look up both servo's push down on the links tilting the front up!

So I want to be able to set right and left servo movements using the same values for up and down movements.

User-inserted image

So to do this in the INIT script I just set the right servo that will always be made inverted in servo skills the same as the none inverted left servo.

# specify the ranges for the servos
# this prevents the servos from ever going past these limits

# Head Rotation
SetServoMin(0.D0, 57)
SetServoMax(0.D0, 160)

# Left Neck
SetServoMin(0.D2, 60)
SetServoMax(0.D2, 160)

# Right Neck
SetServoMin(0.D3, 60)
SetServoMax(0.D3, 160