Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
Asked
Resolved Resolved by AI Support Bot!

Servos Go Beyond Global Max/Min When Release Button Is Pressed

I am having a couple related problems. I set the initialization servo max/mins which are working correctly. However, sometimes (not every time though), when I click release, the servos go past the limits. Other times they release to the correct min position.

Second, I have noticed that the arduinos keep sending the position signal even after disconnecting the board. Even when I close ARC completely and reboot the arduino, and power on the robot, the servos are still sending a position signal that was last sent when ARC was still open. It seems that hitting the release button each time fixes this. Does this mean I need to program in release at the end of every servo position control? Once I do click release, I encounter the first problem I discussed above.


Related Hardware Arduino Due/Mega

ARC Pro

Upgrade to ARC Pro

ARC Early Access will give you immediate updates and new features needed to unleash your robot's potential!

PRO
Synthiam
#1   — Edited
Your description is how servos work :). This is a great read: https://synthiam.com/Support/Advanced-Fundamentals/servo-motor

releasing a servo can be a weird one as well and it’s dependent on how the servo behaves. It stops sending a signal which allows the servo to move freely. That’s how a servo behaves when there’s no signal. Also, some lower quality servos may jump into weird positions when there’s power applied but no signal 

give that article a thorough read and it’ll make sense:)

the alternative is to choose higher quality servos, such as robotis Dynamixel. Or, even some higher quality pwm hobby servos such as the ezrobot hdd ones.
#2  
Thank you. However, the MAX/MIN limits are not working. Sometimes it works, but other times it still lets me push the horizontal servo control past the limits specified in the init script. When I change the MIN position, and reboot ARC, the mins are shown correctly in the init script, however the horizontal control still allows me to go past. Is it possible there is some sort of 'cache' that is still being read from the previous max/min settings?

To be sure I am doing this correctly, I have this code under EZ script under the respective connection port #:
SetServoMin( D11,140)
SetServoMax( D11,160)
However I am still able to push the servo under 140.

I notice other people's projects used an INIT script inside a module instead of in the main connection tab. Am I missing something?
#3   — Edited
Is it possible that you have the min/max setting reversed in the horizontal control it's self? I set min/max in my INT script and have accentually reversed the settings in a servo control. I got the same effect you are having.
#4  
Thanks Dave, but unfortunatley that isn't it. I actually made that same mistake previously as well!

Quick question though: When you say INIT script, do you mean in the main connection panel using EZ-Script? Or do you have another module that you inserted with the INIT script in it?
PRO
Belgium
#5   — Edited
elektrophunktronic

open an original jd ARC. there you see the init  .
you can open that and see whats inside .

User-inserted image
#6  
Thanks Nomad. I set up the INIT inside a module instead of the connection area but it still overshoots the MIN for some of the Servos.
PRO
Synthiam
#7   — Edited
Sorry, I'm unable to reproduce this. Did you read the servo initialization manual here? https://synthiam.com/Support/Tips-to-Make-a-Robot/initialize-servos

I wonder if your Init script isn't being executed - or it's not being executed entirely and has an error missing the servo limit commands. You can run the script while editing it to preview if there are any errors.

Using the EZB emulator, this screenshot shows that the position never exceeds 20 or below 10. I specified the min and max positions to 10 and 20, respectively. This is the result of sliding the servo position from 30 to 1. You can see how the servo is never moved outside the specified limits.

User-inserted image


Here's the initialization code that specifies the servo min and max positions.

Code:


Servo.setMinPositionLimit(d0, 10);

Servo.setMaxPositionLimit(d0, 20);

I'm using a horizontal servo robot skill with the range set to min 1 and max 30. That means I can slide the position outside of the range. However, the servos will never move to a position outside of the specified limit range.
User-inserted image
PRO
Belgium
#8  
hi elektrophunktronic

here's were you put the init script . start klick on the tree dots left unbove .
User-inserted image


then you see this .klick connection 1 .then another page opens .

User-inserted image


and here you put your init script that you choose from the cheat sheet 

choose this one . initstart .

User-inserted image

and save on your pc and in cloud .

ps : witch servo's  are using ?
#9   — Edited
elektrophunktronic, I don't put my int script in the connection control. I have a separate stand alone int script in an ez script that sits on the ARC desktop. I have a shortcut on Windows desktop that will both start ARC and run this INT script after ARC starts up. Like my previous post said, I set my min, max in that int script. Once set the servo won't go past that no matter what I do or set in a servo control. Just like DJ mentioned.  I'm sure that placing it in the connection control works just as well. I just don't do it like that. 
Is it possible that you have a second script or command in a servo script that might be resetting these min, max values? I've done that by mistake before as I was writing different scripts for my robot to move.
Also I need to validate DJ's comment that your int script may not be completely finishing. Not that DJ needs my validation. Lol. As I write a  a script, that happens to me a lot if I've made a mistake in the coding. Like DJ mentioned, run it while you're in editing mode and it will tell you what's wrong. I think there's a box at the top of the script editing window that actavates this feature. Can't confirm that right now.
#10  
Thanks everyone. I can confirm that the code compiles correctly. I have it working for most servos except for a couple on the same arudino, so it may be possible that it is a wiring issue. For reference I am using JX 180 PDI-HV2060MG servos inside an INMOOV. I am using the inmoov 'nervo board' which I didn't do the best job of soldering. I ordered a standard servo shield for the MEGA and will try again and see if the issue persists.

However, for the Servos that ARE correctly obeying the max/min settings within ARC, I am having issues, related to servo functionality that we were discussing earlier, DJ:

When I shut down ARC or disconnect from the Arduino, the servos instantly jump well past the max/min settings. Is there something inside ARC I can do to avoid this? With these particular servos inside the inmoov, if they go past the global max/min they will cause damage to the inmoov. Curious if other people have run into this issue.
PRO
Synthiam
#11  
when closing ARC with a connection, the servos will be "Released." Some servos behave strangely when a PWM signal is stopped and floating. You could modify the Arduino source code and comment out the release commands. That will prevent the servos from being released, but they will hold the position forever, which may be what you want.
#13  
UPDATE - So I think I figured it out. When specifing the max/min I did not specify the connection channel. I had:

SetServoMin(D9, 47)
SetServoMax(D9, 101)

Instead of:
SetServoMin(1.D9, 47)
SetServoMax(1.D9, 101)

I assumed that if the max/min was set inside the main channel-specific connection script that I did not need to specify the connection ( due to it already being under the relevant channel).  Futher confusing me is that I did not need to include the 1.D9 when calibrating the first arduino. I assume this is because it was on channel 0 which is the default. 

Thanks everyone!