Shop OBEX P1 Docs P2 Docs Learn Events
Position Controller Confusion/Frustration — Parallax Forums

Position Controller Confusion/Frustration

spletcher1spletcher1 Posts: 7
edited 2010-07-15 21:30 in Robotics
Hi All,
I was wondering whether anyone had experienced issues with the position controllers (#29319) that come with the motor mount and wheel kit (#27971).· The kit is very nice, but the encoders are giving me lots of unexpected behaviors. Perhaps there is something that I am not understanding.· Although I am controlling them with a PIC32 at the moment, I get similar behaviors when I control with the propeller.·The PIC/Propeller is connected to the position controllers which are connected to the motors through HB-25s.

Here are couple of the strange behaviors that I am able to replicate consistently:

1) Although the range for SMAX (set max speed) is stated as 0 -> 655535, I seem to see no increase of speed beyond a value of about 40.

2) Moreover, when I do set SMAX above 40, I start getting strange behaviors from the controllers, including smooth stopping well before the set stopping point, failure to respond to commands such as query position (or a gargabe response), and unexpected abrupt stops.· I am rather sure that this is not my code because if I reduce the SMAX to 32, everything runs fine.· If I increase the SMAX to one of the two controllers to above 40 then I get problems querying that encoder. The other continues to respond just fine.

Again, everything seems to run just fine with a low SMAX (<=32).· I could just keep it low and deal, but the robot is pretty slow and this problem is really nagging at me.

I have been trying to debug this for days and am at wits end.· Any suggestions would be appreciated.

Thanks, Scott

Comments

  • rpdbrpdb Posts: 101
    edited 2010-07-13 05:15
    Can you post your Prop code? use the # tags. Might help to look at what you got going on.
  • spletcher1spletcher1 Posts: 7
    edited 2010-07-14 04:25
    Thanks for the response.· Actually, before dismantling the PIC setup to examine the issue using a propeller, I decided to actually make some measurements.· Surprisingly, it seems that the default value in the encoders is nearly max speed.· This surprised me a bit because the encoder documentation states that the max speed can range from 0 - 65535 (16bits), and the default value is only 36.· It turns out that this default value is over 85% of the max speed, which seems to occur at around SMAX=45.· It is at this speed value that the output to my HB-25s is maxed at a little over 2ms/pulse.· So it seems that the practical range of speeds is 0- 45. I am still getting some strange behaviors with much higher SMAX values written to the encoders, but because those values are well beyond the practical range, I am less concerned about it.·

    Nevertheless, it does seem strange that the speed is limited to such a narrow range while 16bits are accepted to set it. I guess that I also expected a little more umph out of these motors.

    Can anyone confirm that the encoders (with the HB-25s) work similiary in their hands.

    Thanks again everyone,

    Scott
  • Kevin McCulloughKevin McCullough Posts: 62
    edited 2010-07-15 18:43
    Hi Scott,

    If I understand your last post correctly, it sounds like you observed the servo-type pulses (going to the HB-25s) while running at different max speed settings. The reason you see the default value (SMAX=36) outputting a pulse width of about 85% of full-throttle to the HB-25 all has to do with the physical speed of the motor. The practical limit to the SMAX value is really the motor's maximum speed capability. The default value of 36 is appropriate for the motors provided with the kit (around 85% of their top speed) because it still leaves a little extra top-end in the motor's power to maintain their speed under some loading (while going up a hill, carrying lots of weight, etc).

    Basically, the Position Controllers will generate a pulse proportional to how much power the motors should get to maintain the exact desired speed. If it is going up hill, you will see the pulse width change to give the motors more power. If you are going down a hill, it will actually back off power to the motors (or even apply reverse torque) to keep them going at the appropriate speed. However, it is key to remember that your speed is limited by the physical capability of the motor. If you try to make the motors go faster than they actually can, then all they can get is 100% power and they will still not be able to acquire the desired speed.

    The reason that SMAX is a 16-bit number is to support higher speed motors. The motors supplied with the kit have quite a bit of torque and are geared to a speed of about 150 RPM or so, but someone could possibly use the Position Controllers with a motor that goes 6,000 RPM or more, in which case they would definitely want the ability to set a higher maximum speed value.

    Also, one additional note about driving the motors faster than they can go: when doing so, it may not ramp down the speed smoothly because the set point (where the wheel is supposed to be) will ramp down and arrive at its destination much sooner than the wheel actually does (because the motor physically couldn't match the speed). So by the time the wheel actually catches up, the set point has already ramped down and is stopped and waiting for the wheel to arrive. But as long as you are not driving the motors faster than they can go, this should not be a problem.

    Hope this helps.
    -Kevin

    Post Edited (Kevin McCullough (Parallax)) : 7/15/2010 6:49:09 PM GMT
  • spletcher1spletcher1 Posts: 7
    edited 2010-07-15 20:51
    Thanks for the clarification Kevin.· Once I looked closely at the behavior of the encoders I came to many of the conclusions that you outline.· It is good to have those confirmed.· I am really quite happy with the kit.· When I said surprised, I did not mean disappointed.· I guess that if I had any request at all it would be to have the documentation for the kit reflect the parameters and hardware relevant to that kit.· It would have saved me some time.· Nevertheless, I have everything working well now, and I am back having fun!

    Scott


    P.S.· Now that I think about it, I guess that I am still a bit confused about one thing.· The SMAX values are applicable only to the HB-25 interface, correct?· If so, I though that SMAX would simply determine the pulse width to the HB-25 when at cruising speed.··A pulse width of 2ms is the max speed for the HB-25, and I see this pulse width at an SMAX >= 45 or so (and the pulse width from the encoders does not seem to change when I provide resistance to the wheels). So how is the behavior of the encoders (in terms of its communication to the HB-25s) different at an SMAX = 2000 from SMAX = 45?·
  • Kevin McCulloughKevin McCullough Posts: 62
    edited 2010-07-15 21:30
    Hi Scott,

    Great to hear you are back to having fun! After all, electronics definitely should be fun! smilewinkgrin.gif

    You are correct that a pulse width of 2ms equates to max speed for the HB-25's. So when using the motors included in the kit, you will probably see the same pulse widths going to the HB-25 with a speed setting of 2000 as you would with a speed setting of 45-50 because they are both speed settings beyond the possible speed of the motor. The Position Controllers would love to be able to push the HB-25's even harder/faster to try to keep up if it could, but it also must be sure to generate valid pulses, so it limits the pulses to about 2ms - which equates to the HB-25 driving at 100% power (anything more than 100% is not possible, otherwise 100% wouldn't really be 100%... ).

    Now, if you had a different motor that was capable of a faster top speed of 500 (I think that should equate to about ~1,667 RPM or so) then if you set SMAX=45, then you would find the pulses to the HB-25 would probably be around 15% or so since the HB-25's don't have to provide that much power to the motors to make them hold that speed. But for that same motor, if you tried to set the speed at 2000, then you would again find the pulses to the HB-25 are maxed out at 100%.

    Basically any SMAX speed setting that is equal or faster than the motor can go at full-throttle will result in the pulses to the HB-25 being at 100% (they can never go beyond +/-100%). Any speed setting less than full throttle will be some amount less than 100% to the HB-25's, but the pulses will definitely fluctuate if the strain on the motor changes (because it tries to adjust the pulses to maintain the desired output speed).

    Keep having fun! burger.gif
    -Kevin

    idea.gif P.S. Another way to look at it is that the Position Controller sends pulses to the HB-25 to tell it how much "power" to give the motors (and in which direction). While more power roughly relates to more speed, there are a lot of other factors that really determine the motor's actual output speed at any given time (such as the load on the motor, its temperature, efficiency of the gears, etc) so the Position Controller continually adjusts the pulse values accordingly. And faster or slower styles of motors will need different amounts of power applied to them to go the same speeds.

    Post Edited (Kevin McCullough (Parallax)) : 7/15/2010 9:50:51 PM GMT
Sign In or Register to comment.