Asked — Edited

Servo Movement At Power Up Before Initialization

When running my servo initialization in the connection script I am able to set position and speed just fine. I noticed that when first powering up before the connection init script runs the tilt and rotation servos both always go to the "0" degree position which is a bit awkward.

I read the servo positioning and speed setting tutorial and it mentions about a reverse init routine before powering down to set the servos in the position that you want them in at power down. This could be done via a button in the mobile app via scripting. At the end it is implied as far as I can tell from reading the tutorial, that once this is done and power is applied again (and before the init script is run) the servos would remain in the same positions as they were when power was removed. This doesn't seem to be the case however.

Wondering if there is a way to keep the servos in the same position at powerup (before the int script is executed) as they were at power down? Why do the servos when power is applied always go to the zero degree position?

I noticed when you use the servo slider in the mobile app, that when you first move the servos after poweup no matter what position the servos are in they go to 0 degree position and then start to function normally.

Any clarification on these issues is much appreciated....Rick


ARC Pro

Upgrade to ARC Pro

ARC Pro is your passport to a world of endless possibilities in robot programming, waiting for you to explore.

PRO
Synthiam
#1  

Servos are not instructed to move on power up or connection by default in ezrobot software or ezb.

Any movement of servos must be done by your code, only. Ezrobot will NOT move a servo into any position on startup or connection without code instructing them to move. ARC and the ezb is unaware of what ports have servos connected, so there is no possible way for the software to move servos on its own.

Lastly, there is no position 0

You can share your project if you'd like it to be reviewed.

#2  

I think what you're saying is that when a servo is powered up it will naturally move to "center" without being commanded to move. So if the servo is powered down without the horn or whatever is attached to the servo being at this center position the servo will jerk back to center when powered up. This is totally independent of ARC and a natural act of the servo.

You can't expect ARC to know where the servo is positioned when it the servo powers up. There is no feedback from the servo to ARC to tell EZ where the servo is. Typical servos don't have a built in sensor that sends this info out to a controller. So there is no way for ARC to send a shutdown position command (other than center) to the serov, shut down servo power and ARC and then when you turn everything back on expect the servo to stay at any spot without jerking other then at the center position.

With that said, what do we do? Simply power down the servo at the center position and try to keep it there until the next power up. You don't need to have whatever is attached to your servo attached at the center position.

Hope this all makes sense. :)

#3  

@DAVE,

Would I be correct in saying the center position for each servo is 90 degrees? If not what is center position. DJ mentioned servos don't move on powerup unless commanded to do so.

@DJ, @DAVE,

I have uploaded my project to the cloud and made it public so you can take a look see at the servo issue. Servos move quite a bit when power is first applied before the init script. Any thoughts are much appreciated. The project name is:

RC_TRUCK_DEMO_MOBILE_APP.EZB

Any thoughts are much appreciated...Rick

PRO
USA
#4  

Two different issues:

1)

Tutorial: https://synthiam.com/Community/Tutorials/155/1

Problem:

Quote:

our robot has a servo controlled head and you have it set at "90" in your Init script. When you power off your EZ-B, maybe the head servo is facing at "180". When you power on and connect your EZ-B to the ARC project again, that servo will still go at full speed to the position back to the "90" you have set up as in your "Init" script.

Solution purposed:

Quote:

One way to combat this is to do a reverse "Init" script. By this I mean a kind of Off button in ARC that would be pressed when you are finished with your robot. This could be an EZ-Script control, or a button on the mobile interface. This is where you would use the same servo speed and position "Init" script to move the servos to their starting position, so when you turn it on again, the servo don't move.

This is between ARC and EZ-B controller basically before power off/disconnect you set the the servos positions to the same position you have in your initialization script.

====

2)

Quote:

Wondering if there is a way to keep the servos in the same position at powerup (before the int script is executed) as they were at power down?

No without any other hardware/software changes.

Firmware: My custom EZB4 V1's firmware allows you to configure the initial servo position values. Only the micro-controller firmware can react immediately after a power on event.

The new EZB4 V2 is a different chip and does not support the custom firmware, although supports OTA updates, maybe new firmware features will be released.

Extra hardware: the SSC-32 allows you to set the initial startup positions of the servos, i believe the default configuration is 1500us more or less the center position. The configuration is done via hardware tools.

Quote:

Why do the servos when power is applied always go to the zero degree position?

There is no zero degree. The power-on random move of a servo is normal, until the servo has power and received the first pulse it has no idea where it is headed, also while the micro-controller is initializing the hardware ports are in undefined logical states.

I share your pain.

My big bot uses two parallax HB-25 motor controllers, they support high amps and the construction is very good, unfortunatelly the motor controller emulates a Servo. So every time i powered on the bot, or reboted the PC (powering the Parallax propeller micro-controller) and it was frequent, the robot moved it was like he got electrocuted.

It was very annoying.

User-inserted image

User-inserted image

I solved the problem adding two relays (always off) to cut the motor power (not the controller power). When the system (micro-controller and or the pc) power ups, checks several sensors, initializes the servo position to center (continuous servo stop position), and only then activates the relay, so the servo receives at same time power and the position.

You can obtain the same result if you introduce ONE relay (always off) between the VIN and your servos, all the servos vcc (red) will be connected to the relay port.

Then you can open ARC, set the initial servo positions and only then you activate the relay.

Canada
#5  

On my Inmoov,

I am using an init script where the maximum, minimum and home or relax position is define for each servo.

When I wish to disconect my EZB's I am using this type of script:

 :loop
servo(D0,$relaxD0)                #head position looking straight (value 73)


$HeadPos =  GetServo( D0 )


if( $HeadPos =73 )              
ControlCommand("Connection", Disconnect0)
endif 

goto (loop) 

What will happend, is the EZB will emit the disconect sound, but the servo will still move to the position (in this case the relax position 73).

Then you could power down the robot.

At power up, if the servo have not been move mechanicly, when you restart the EZB, the servo will not move, because the init value match the position where you have left the servo at power down.

Watch the end of this video, you will here the EZB disconnecting and servos still moving to home position

PRO
USA
#6  

@Aerius: What kind of servos are you using?

Canada
#7  

@ptp The new HDD servo, they are just great. no buzz and strong.

United Kingdom
#8  

Wow Giles, is that InMoov number 2 build? I love the new shoulder moment and pivot points on the chest. Your print quality is excellent are you still using your FF Dreamer?

Cheers Chris.

Canada
#9  

@cem Tanks Chris, It is InMoov #1 modified. I'm still using my Flash Forge Dreamer

#10  

I have 2 of the old servos from the kit in my project, and when powered on they move every time?

I have tried everything to try stop this from happening, but every time i power on the ezb4, they move with every power up.

I have centered the servo, saved it, but that doesn't seem to work, they keep moving..do i have to remove these servos from my project and replace them?

I don't really want my robot to be twisting its torso and neck on every power up..so any help would be great.:)

#11  

Most if not all inexpensive hobby servos jerk or move sporadically when power is initially applied... You can't stop it from happening...

#12  

@Aerius I think you posted something about that neck mechanism you are using on your Inmoov...I forgot to bookmark it, could you provide the link one more time?:)

#13  

These servos move quite a bit.

And on every power up they move more and more in one direction until they can't go anymore.:(

All the other servos don't even twitch or spasm on power up.

Will just remove them and swap them out.

Australia
#15  

@Aerius great job on your inmoov, can I ask how your doing object tracking with the new neck ?

#16  

Thanks a lot! Its such an interesting setup, I will print one to check how it works..:)

Canada
#17  

@nick777

Tanks for the good words. I am using the camera tracking capability of ARC and EZB.

Important point, like us, the eyes are driving the head position

But first to avoid any binding between the 3 neck servos you will need to find the min & max value of each one.

Then these value will be incorporate in a init script attatch to the connection control.

You may look at my project named New Neck for Inmoov

#18  

Setting all Min, Max servo positions is a must! It keeps every servo from overshooting either it's physical end stop or the end of motion of what you have attached to it. Here's a section out of my int script setting all my servo's Min, Max:


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

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

# Right Claw
SetServoMin(2.D3, 74)
SetServoMax(2.D3, 102)

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

# Bubble Blocks
SetServoMin(D15, 85)
SetServoMax(D15, 177)

# Bubble Servo
SetServoMin(D1, 45)
SetServoMax(D1, 97)

# Rt Wrist Rest Servo
#SetServoMin(2.D2, 93)
#SetServoMax(2.D2, 139)

Another method to try to keep servos from jumping at startup is to build a centering image (Action) of all servo's rest position in the Auto Position control. You can then place a command in the INT script to call this Action to center all servos at startup of ARC. However it's very important NOT to use the AutoPoitionFrame command. You need to use the AutoPositionFrameJump command. This initializes your servos and automatically sets your position and speeds.

If I first use the AutoPoitionFrame command my servos will move all around before going to center (even if they start close to the center positions). Useing the AutoPositionFrameJump command keeps them from snaking around and they go directly to center.

If you don't want your servos to move at all at startup then you need to: *Place the attached part in it final resting position on the servo horn or hub in the servos center position. *Move the part attached to the servo to it's final resting position at shut down. *Keep the part in the resting position until startup. *Use the Min, Max settings and AutoPositionFrameJump center action command you built in the Auto Position control in your INT script.

Here's how I find my servo's natural center that it moves to at power up and set the part that is attached to it's resting position: *Remove the hub or horn from the servo. *Apply power to the servo and watch it jump to it center. *I then reattach the hub or horn with the part attached orientated in that parts resting position.

Your servos will always correct themselves to what they consider their default position at power up if they were moved when there was no power. So in short; Take the screws out of the servo arms, power up the system, pop off the servo arms and put them on again as close to center as possible, put the screws back in. Then power up your system again using the suggestions I gave for your ARC's INT script.;)

Disclaimer: I've used nothing but the high end analog HiTech Servos in my B9 Robot. Other servos may act differently for you. I'm not advocating HiTech over any other servo. At the time of my build I considered these HiTech servos to be the best for my needs. There may be better ones out there in the wild now (including the new EZ Robot HDD servos). ;)

Canada
#19  

@Dave Schulpius

Quote:

You need to use the AutoPositionFrameJump command

Hi Dave, could you clarify about this command? Do you use it within a script or is it part of the existing AutoPositionFrame command?

#20  

sure, no problem.

You create a frame in the AutoPosition control just like normal. This frame would have all your servos in their "at rest" positions. This would ideally be the position that your servos will be in when you turn off power Then you go into the Action section of the AP control and make an Action using only this one frame.

Then in your INT script you would find a good place to insert your startup AutoPositionFrameJump command to initialize these servos so they are in your startup and at rest position.

Again, the servos should be the same position as when you turned off power if possible. If you can't keep your servos in the same position when the power is off then they will still move. However using the AutoPositionFrameJump command for that frame, the servos should return to the wanted "at rest" position smoothly.

The only place I can find the AutoPositionFrameJump command without writing it myself is in the Cheat Sheet located in every EZ Script or Script Manager control. It won't be listed by Right clicking in the script window. Look at the Cheat Sheet and scroll down to the Auto Position control where the frame is you built. Find the AutoPositionFrameJump ControlCommand for the frame you built with servos in the At Rest position. Then double click on it to insert it into your script. It will look scomething like this:


ControlCommand("Auto Right Arm", AutoPositionFrameJump, "Center")

Hope this helps and is clear. :)

Australia
#21  

@Aerius @Dave Schulpius

Thanks for the tips and the project files

Canada
#23  

@ Dave Schulpius Tanks Dave, it helps a lot.

#24  

@ Dave Schulpius

Dave, Thanks for the detailed info on how to do this.

By the way, I just looked into the init script for JD and that's how he does that rigid "snap to attention" movement on connection

Regards, Frank