Canada
Asked — Edited

Question With Release() Command

Greeting all, It has been a long while since I posted here. I have been working on my Inmoov whenever I can find time, which is not a lot, but slowly, very slowly progressing.

I now have a fully functional and completed torso with left arm and head. I am now starting the real fun; programming ! Yaaa !

The problem I am encountering at this time is the servo release() command. First, from what I read, on power-up, I must first set servo position, then servo speed. Then I can change servo position and/or speed at will. So far so good. Now, on some of my servos, I would like to release them to stop the "humming/buzzing" noise. I use the Release() command, but after using it in scripting, there is nothing I can do to get the servo to move at all. I know I am doing something fundamentally wrong, but can not figure it out.

Here is the sequence of action:

  • Power-up EZB-V4
  • Connect via wifi
  • Set servo limits in init script (connect)
  • Then, using the script console (or within the init script, or any scripting method), run the following commands:
    • Servo(d10,130) # Set servo position
    • ServoSpeed(d10,2) # Set servo speed These are required on startup. At this point, servo works fine. I can change position and speed at will without problem.
    • Release(d10) # Releases the servo. No noise
    • ServoSpeed(d10,3) # servo speed stays at 2, does not change to 3 (GetServoSpeed(d10) )
    • Servo(d10,75) # servo does not move (stays at previous 130 position). But can hear the "buzzing noise" No matter what I do, I can no longer move the servo position. Tried setting new servo position and servo speed, but no luck.

I have captured the screen and attached it.

Any idea anyone ?


ARC Pro

Upgrade to ARC Pro

Unleash your robot's full potential with the cutting-edge features and intuitive programming offered by Synthiam ARC Pro.

Canada
#25  

I'm very happy about the way this discussion is going.

Tanks Richard, you have described very clearly the causes of the buzzing servos.

@Dave You got it right, this is exactly what is happening with the script.

@Kazobond I have been working on your (Dude script). First, I want to assure you I have not modified any of your code, I have just moved some controls to the virtual desktop and add a new script manager named Servo Buss Control.

You will find the script Kazabond modif_Dude_script in EZ-Cloud App under my alias.

##################################################################################

Some info about how to control the servo buzz problem.

All we want to do is to automatize what we do manually when we have a buzzing servo, we release it

Let me borrow @Dave description: Autopos control is starting a script that is estimating the time it will take a servo to reach a set spot and then sending a release command for that servo.

User-inserted image

So as showed on picture $Phraser at the bottom contains servos final position values #########################################################

Servo Buzz Control V4 right arm assembly

$countr=0


################## servo Target Value $Phrase defined in each frame of servo position #########################

# EX:$phraser="D6,103,D7,015,D8,110,D9,130"  #(Always keep values to 3 digits. EX: 025 not 25)


############################     Restart servo D6, D7, D8, D9   ########################################

ControlCommand("Servo Buzz Control", ScriptStart, "Servo Restart       D6-D7-D8-D9")

sleep(500)
################################ Extract numeric info from servo Target Value (in $Phrase) #####################
  
  repeatuntil( $countr = ( length($phraser) ) ) 
                  

      if ($countr=3)
            $D6=(GetCharAt( $phraser,$countr )) + (GetCharAt( $phraser,$countr+1 ) )+ GetCharAt( $phraser,$countr+2 ) 
            
            $LastPosD6 = getservo(D6)
              
                ControlCommand("Servo Buzz Control", ScriptStart, "Buzz Control   D6     Right elbow")

            endif

Partial script listing

1-Script restart all 4 servos 2-Extract servo target value for each one

########################################################### Buzz Control D6 Right elbow

################# Calculate time needed for servo to move a distance before been release ######                


if ($D6=999)
  Halt() 
endif

if ($D6 > $LastPosD6)
    $DistanceD6 = $D6 - $LastPosD6
     
   elseif ($D6 < $LastPosD6)
    $DistanceD6 = $LastPosD6 - $D6

endif
        
if ($DistanceD6 < 40 )         ### Compensate for too short traveling ###
    $DistanceD6 = $DistanceD6 + 10
endif
        
if ($DistanceD6 > 0 )
     Sleep ( 10 *   $DistanceD6 /( 1/(GetServoSpeed( D6 )+3 ))) ### Time = Distance / speed
     release(D6)
              
endif

Same script for D7,D8 and D9

The magic is in this sample formula

time = distance / speed

sleep time = (servo initial position - servo final position) / (1/servo speed)

sleep time = (GetServo(x) - servo autopos frame position setup) / (1/Getservospeed(y))

Note: you may adjust the formula by add / subtract to the speed.

So multithreading gives us the ability to start a servo and at the same time trigger a sleep time clock before it release it. No matter the speed or the travel distance, the formula takes care of it.

Here is the complete script

InmoovServoBuzzControl.EZB

#26  

@ Richard, Like Aerius says, you have described very clearly the causes of the buzzing servos. Thanks (again:) )

@ Aerius, No I did not miss it (from the other thread). Just did not have the time to play with it yet. To much stuff on the go at the same time (like all of us, LOL)

omg, that's a real neat detailed description. I'll be spending time later today or next week studying it.

Thanks so much.

#27  

@Aerius, This is brilliant. Thanks so much for taking the time to share this valuable example of coding. This helps in more ways then you can imagine.

@Richardr, Also, thanks to you for your detailed explanation of how you think a servo works and why you think it makes noise (buzzes). From your last comment directed at me stating that you think I'm a coding and servo expert it sounded like you were seeking my opinion. The truth is that I'm not an expert and I do benefit from detailed explanations like you and Aerius just gave. You come across much better and are much more helpful to people like me when you offer you advice in this way. I have a hard time understanding your intent when you reply with short and snippy posts like in post #7. :) BTW, Thanks for editing out your angry and insulting words towards me in post #10. This forum and our community works better when we aren't attacking and insulting each other. ;)

#28  

I find that Digital servos BUZZ more than Analog. Could it be that you just need to switch to Analog?