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
Resolved Resolved by thetechguru!

Servo Not Working

I appreciate any help in understanding what I am doing wrong. I have a modified servo panel and a logitech joystick control installed. I have the wheels on d0 and d1. I have two servos with one on d3 and d4. The wheels are running correctly on the joystick but the two servos are running totoally intermittent on the second stick on the joystick controller. I have tried to program joystick 2 and 3 and actually both at the same time. I am all over the place. Sometimes the X servo works sometimes the Y servo works. Sometimes neither and sometimes both work. I am at a loss at what I am doing wrong. Can anyone help.

Also when I got them both running one time using joystic 2 and 3. I tried to first locate the servos with the Servo(d2, 50) and Servo(d3, 50) and then slow them down with ServoSpeed(d2, 25) and ServoSpeed(d3, 25). I put this script in the initiation File. It slowed down the servos to a crawl and they wouldn't work until I used the joystick. They also did not seem to want to find position I requested. I know this is something I am doing but to the life of me I cannot figure it out according to the ARC manual or the EZ-Script manual. Do I need to add ControlCommand script? Any advice you can give would be greatly appreciated. Thanks
Ellis

AI Support Bot
Related Content
Synthiam
#4  
Answer to questions:

Two HB-25 motor controllers hooked to pins d0 and d1. These are used for forward, reverse, left and right movement of the robot.

Two 180 degree standard servos for horizontal and vertical head movement on d2 and d3. I am using these to control head movement and future camera.

I am controlling these with a Logitech wireless controller.

I have set speeds and location back to 0 rebooted and it did make vertical servo move up and down correctly using the right joystick. I have tried programming this joystick with joystick 2 and three. I do not know if it makes a difference but neither would control both axis at the same time. I programmed joystick 2 and three at the same time and both worked but acted random.

As for the values on speed I have tried various speeds from 10 to 0. It will slow servo down to crawl but doesn't seem to do this proportionately. 2 seems to be the same as 8.

I have looked on the samples and am going to add some code like you have done on different units to see if I can get it to work correctly.

Any Ideas.
#5  
I will be receiving a Logitech Joystick in a couple of days and if you haven't resolved this by then, I'll do some experimentation to see if I can figure it out.

Alan
#6  
Why do you need to slow down the 180 deg servos (vertical and horizontal head movements)... When I use a joystick control for a pan and tilt head or camera mechanism I like the servos to move at full speed...

Ok as far as the HB-25s are concerned... Do you have a h-bridge movement control (Not the Modified servo movement control) in ARC set up for them? These are parallax motor controllers right? For regular DC motors (not servos) right? The left joystick control will drive the Movement Panel which in turn would control your 2 HB-25s (and the dc motors connected to them)....

If you're are using modified 360 deg servos to drive your robot then you don't need the HB-25s... You're Movement Panel will then be the Modified servo movement control....
#7  
Yes my HB-25s are connected to control two 12 v dc motors. I used a modified servo panel to set them up. I used the modified servo panel because they are connected with a standard servo connection. They do not use the center pin as they use a separate 12 v power input to run motors. The HBs are supposed to be hooked up as standard modified servos. They are working fine with the left joystick. They do not ramp up to speed yet but l will try to in the future. They are presently a little jerky since they are powerful motors.

I am trying to slow the servos down because I am using an elongated iPhone car mount to provide the head. Since it has a long neck it amplifies the movement.

I may be doing several things wrong but I am in the process of learning this whole system.

Thanks for helping me in such a fast fashion.:)
#8  
Thanks also to Alan. Let me know what you find out.
#9  
@Ellis... Ok... But doesn't the HB in the HB-25s stand for H-bridge? The modified servo Movement Panel is meant for 360 deg servos driven directly from the ezb4 digital pins (servos have their own built in motor driver)... The H-bridge Movement Panel is meant to drive your HB-25s and dc motors... It will also drive the l298 H-bridge sold by ez robot.... I personally use sabertooth motor controllers so I use the sabertooth movement control panel....

I still don't see why you need to change the servo speeds for your pan and tilt servos, though...
#10  
Ok, I was just messing with the joystick control (joystick#2 specifically) with a pan and tilt setup I have.... I am starting to see your problem now... Although I can get the pan and tilt working with the analog joystick #2 control, it's not proportional... I also see why you want to slow your servos down... There seems to be a razor thin move (cliff if you will) threshold... slight push on the control and the servo seems to move full travel instead of proportionally.... Last time I used a joystick for a project I used the button programming because I needed both analog stick channels for something else... My button programming worked well enough for pan and tilt...

I have to dig into this farther as I am sure there is a way to get the x and y (pan and tilt) servos to act proportionally via the right analog joystick control....
#11  
One way to do it would be to define virtual servos in the Joystick, and then have scripts that ramp up and down the actual servos when movement of the virtual servos is detected.

Or we could just asj DJ to update stick 2 and 3 to ramp similar to stick 1, but I find he is more likely to add a fix or feature immediately after one of us develop a viable workaround than if we just ask. I think it helps prioritize. If he sees we are willing to make it work ourselves it must be important:)

Alan
#12  
@Alan, yep... looks like ramping is the a good stopgap for now... Hobby radios really spoil you with their precise proportional stick movements... LOL
#13  
I am glad you are seeing some of my problems. When I set my joystick 2 as control for my pan and tilt i only get the vertical movement. When I try horizontal side to side I get nothing. If you look at the joystick tutorial it says it is just a matter of plugging in the servos and assigning the servos to the joystick and it will work. In my situation it doesn't. I realize the video is old but I do not think things have changed other than the windows. Am I missing something?

As for the HB-25s the HB probably does stand for H-bridge. The information for the HB-25 says it plugs in like a servo. If you think setting it to a H-Bridge control panel would work better let me know. I know the HB-25 only requires signal and ground to control it.

Here is the link to the HB-25 operation manual.

HB-25 manual

Thanks again for helping.

Ellis
#14  
You are correct to use the modified servo panel with the HB-25's. They emulate a modifed servo. I am not sure that joystick speed ramping works with modified servos at all. I don't have HB-25's, but I do have a small test bot with modified servos that I will play with when my joystick gets here (expected delivery Saturday, some free time on Sunday to work on it). The alternate will be to use a custom Movement Panel with scripted movements.

We may need to also do some scripted ramping for them to work smoothly.

I'll get the pan/tilt thing figured out first. That is exactly what I want to use stick 2 for as well, so I need to solve it.

Alan
#15  
Thanks Alan. At lease we are beginning to understand the problem.

Thanks for your help.

Ellis
#16  
Here is what I found so far. Working on the Joystick 2 issue.

When I define my pan/tilt servos in Joystick 2, only the Y axis works when I use the right joystick control. The X axis responds to the RT/LT buttons on the front of the controller, but not to the left/right of the joystick.

If I define the same servos in Joystick 3, just the opposite. X axis works (but not with the LT/RT buttons, but Y axis doesn't.

If I define it in both 2 and 3, both axis and buttons work.

I am not actually sure what Joystick 3 is supposed to control. Joystick 1 drives both the stick and the D-pad if I turn on D-pad mode, and just the stick if I turn off D-pad mode, and the D-pad doesn't do anything.

This is all with the Logitech G710 in X-Mode. Doesn't work at all in D-mode, and the Logitech drivers don't work in Windows 8.1 but it is recognized by Windows as an XBox 360 controller.

Since I have a Roli with an H-bridge, the speed ramping is working fine on stick 1, but I will play around tomorrow with my box bot and rotational servos to see if I can figure out something for you there with virtual ports and scripting.

Alan
#17  
Oh.. regrading proportional movement on stick 2, or at least speed control, I'll look into that tomorrow as well. My Roli battery just died, and by the time it is charged I will need to be going out on some errands, and have plans with friends tonight, so won't have any more time to look at this today.

Alan
#18  
@Alan... my Lynxmotion PS2 controller works for both pan and tilt off the right stick... However, I had to switch it to analog to get it to do that... Also, as mentioned it's not proportional ... I get a "light" switch type servo movement....
#19  
Alan

What you are getting is exactly what I am getting. If I set up both 3 and three I get both X and Y to work but I don't think that it is working as designed. Also when I try to set the speed it is not proportional as Richard stated. Scripting servo speeds with ServoSpeed Script in initiation file seems to work but very jerky and non proportional.

Rich, As far as setting the joystick two to analog, do you know how is that done on a Windows G710 Logitech game controller. I would like to have the 2 joystick work correctly.

Thanks again for all the help. It seems looking at yours and my results it is a controller programming problem. I will also keep trying to find the answer.

Ellis
#20  
Sorry, I have a windows F710 game controller not a G710. I guess the F710 is a keyboard.
#21  
OK, we are using the same controller, and I have had some success tonight.

If you switch from Xinput to DirectInput (the little slider switch on the front from X to D), and install the Logitech drivers, Joystick 2 works like it should and drives both servos. Also, the LT and RT buttons become visible to ARC, where they were not (just drove the X-Axis) in Xinput mode.

As far as having slower/better control of the servos, either in your initialization script or in a separate script you run before using the joystick, set the servo speeds to 1 or higher (0 is fastest, and is too twitchy for joystick control. My pan and tilt is working well with it set to 1). You don't get proportional speed, but do get proportional position (the further you push the stick the further the servo moves, which I think in a pan and tilt is what you would be looking for).

Keep in mind that a servo needs to receive a position command at least once before ServoSpeed() script command will work, so you should have your initialization script set the position of the pan/tilt servos to 90, then set the speed, then the joystick should work.

There is one glitch I have found in DirectInput mode though. Randomly, the debug window throws an error "Already Running Joystick" repeated about 6 times, and when the error is being written the movement is a little jerky. Seems totally random when it hits. I thought I had it reproducing just on going left with the x axis, and then it stopped doing it and hasn't repeated for about 10 minutes.

Tomorrow I'll look into proportional speed on modified servos. I am suspecting we'll need some scripting there, but maybe the DirectInput mode will fix that too.

Alan
#22  
DirectInput mode did not add proportional speed for the modified servo movement panel. I started to experiment with having Joystick 1 drive the servos directly instead of a movement panel. Problem there is that the center position of my servos is 89, not 90, so in the stop position, the bot turns very slowly rather than stopping completely, but I was having some success with proportional control before the batteries dies, but I think I am going to need to go with a custom Movement Panel and scripting.

I am now waiting for the boxbot batteries to charge. I thought I had a charged set, but I was mistaken, so it will be several hours before I can continue, so I may not get to it today.
#23  
I think I can begin to work with the system now. I set up joystick2 and joystick3 with one for x and one for y. They now both work. I do not get it. It just does. I am going to use that until it doesn't work for some reason.

thetechguru did over the top help on this. I really appreciate the help.