Shop OBEX P1 Docs P2 Docs Learn Events
Misunderstanding of PSCU-BS2e communication — Parallax Forums

Misunderstanding of PSCU-BS2e communication

bhaskarghsh4bhaskarghsh4 Posts: 20
edited 2013-11-04 13:30 in BASIC Stamp
I used the following program to move one vehicle continuously in forward & backward direction upto a certain distance.
I am using 2 servos (180 degree rotation) with the two wheels which is controlled by BS2e through PSCU.
When I am running the vehicle with the following program the wheels are rotating at different speed.
I am not getting how this is happening with this code. I will be thankful to you people for helping me to sortout what the problem is with the code.
By the by I measured the speed for both of the wheels with tachometer.
Thanks.
:smile:path_tracing.bse

Comments

  • GadgetmanGadgetman Posts: 2,436
    edited 2013-10-30 05:00
    Can't really tell what's wrong as I don't know the PSCU, but...
    (Are there any difference between the servos? Have you tried switching them around?)

    I do notice that you have a few of these:
    IF err=0 THEN
       Do something
    ELSEIF err=1 THEN
       Do something else
    ENDIF
    

    This is 'not good' programming.
    Sure, in this case err can only have those two values, but...
    That means you could have used:
    If err=0 THEN
      Do something
    ELSE
      Do something else
    ENDIF
    

    In fact, if you turn the jobs around, it can be shortened a bit more:
    If err THEN
      Do something else
    ELSE
      Do something
    ENDIF
    
    (I think that should work. Haven't programmed a BS2 in 'a while')
    Any test like '= something' takes time to execute after all. And it fills up the program memory, too.
  • bhaskarghsh4bhaskarghsh4 Posts: 20
    edited 2013-10-30 12:11
    thanks Gadgetman
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-10-30 22:53
    Are the servos calibrated such that a 750 to both servos causes them to stop moving (not move)?
  • bhaskarghsh4bhaskarghsh4 Posts: 20
    edited 2013-10-31 02:52
    Thank u sir for ur kind attention.
    But for ur kind information i need to say that my vehicle is moving but the wheels have different speed.
    Even as per my view it should not be different according to the code. I have measured the wheel speeds with tachometer.
    So please help me to find out why this happens.
    :smile: Thanks
  • GadgetmanGadgetman Posts: 2,436
    edited 2013-10-31 04:10
    This probably happens because no two servos are alike.

    Try experimenting with changing the speeds of each servo a bit.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-10-31 12:36
    My question about calibration was directly related to your problem. If the servos aren't calibrated it could cause this very issue.
  • bhaskarghsh4bhaskarghsh4 Posts: 20
    edited 2013-10-31 22:23
    Thanks sir .
    But I am a newbie in bs2e (basically all parallax devices).
    So I am not aware about this CALIBRATION process of servo you are talking about.
    Is this done through the proper instruction in PSCU or by something else.
  • GadgetmanGadgetman Posts: 2,436
    edited 2013-11-01 00:35
    To calibrate = to adjust, to correct...

    What we mean is that you measure the difference in speed between the servos, then adjust the program to compensate.
    One motor too slow? Just increase the 'Ramping' on it.
    One motor doesn't stand still after initialisation?
    Adjust up or down from 750 until it does.

    If you look at a RC remote, there's always a set of sliding adjustments around the sticks, used to adjust the neutral position.
    Servo motors use a simple comparator circuit to decide the position they're in and whether or not to move. This circuitry is of course made of the cheapest available components...
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-11-04 13:30
    In the context I intended I was referring to how our Continuous Rotation Servos have an adjustment potentiometer on them which adjusts the center (stop) position. If that potentiometer is not adjusted properly then the servo can exhibit many weird symptoms such as moving faster in one direction than the other or only moving in one direction and not the other.
Sign In or Register to comment.