Shop OBEX P1 Docs P2 Docs Learn Events
Run ActivityBot C Code in the Arlo! — Parallax Forums

Run ActivityBot C Code in the Arlo!

NikosGNikosG Posts: 705
edited 2014-11-07 07:29 in Learn with BlocklyProp
Hello everybody,

Ken announced on Parallax insider News that the Andy’s “Arlodrive” is ready for use! Does anyone tried to run any code from ActivityBot into an Arlo robot or any other large robot with Arlo’s motor and wheel kit?
Where we can found the “arlodrive.h”? What exactly steps we must follow in order to use this new ability?
Any diagram in order to connect the encoders with the HB-25 end the Propeller Activity Board?
I hope that Andy has given parameters in his code on characteristics like: wheel diameter, turning radius and speed in order to give the opportunity to users with other large robots (not necessary Arlo robots) to take the benefits of his code!

Nikos
«1

Comments

  • fataldavefataldave Posts: 61
    edited 2013-12-24 15:21
    Been looking forward to the insider post. Does not look like the actual code was posted yet, or at least I cannot find it. Ken posted a sneak peak of the code a few weeks back, but I could not get it to work. I suspected it was missing a ArloCalibrate file and the insider post suggest this was the issue but the zip file Ken posted didn't include the ArloCalibrate.
  • Ken GraceyKen Gracey Posts: 7,392
    edited 2013-12-26 22:15
    fataldave wrote: »
    Been looking forward to the insider post. Does not look like the actual code was posted yet, or at least I cannot find it. Ken posted a sneak peak of the code a few weeks back, but I could not get it to work. I suspected it was missing a ArloCalibrate file and the insider post suggest this was the issue but the zip file Ken posted didn't include the ArloCalibrate.

    Apologies for it not being uploaded to that web page - it's attached to this post.

    Ken Gracey
  • fataldavefataldave Posts: 61
    edited 2013-12-27 10:22
    Ken Gracey wrote: »
    Apologies for it not being uploaded to that web page - it's attached to this post.

    Ken Gracey

    No problem, Thought it might have been posted on the Learn site but could not find any Libs with a recent change date. Looking forward to giving this a try when I get back. Already downloaded and got it loaded in SimpleIDE.

    Thanks for the update!

    Dave
  • fataldavefataldave Posts: 61
    edited 2013-12-30 13:56
    Had time today to get the code loaded and try it out. Looks like the missing ArloCalibrate was my original issue. Did some testing with it, noticed that the example had the following code to make it go forward:
    drive_rampStep(100, 100);                 // Forward
    

    but that just made it go in a circle. I actually had to change it to
    drive_rampStep(-100, 100);                 // Forward
    

    to make it go forward. I suppose this is because one of the encoders has to be installed in reverse from the other. Going to have to look up some of the ActivityBot examples now.

    Thanks Ken!
  • edited 2013-12-30 14:46
    I think what you are seeing is the +/- terminals on one of the motors being reverse of what it is in the prototype. I'd recommend swapping the +/- terminals on the motor that goes backwards when it's expected to go forward. Then, your code will be able to match what's in the .zip.
  • fataldavefataldave Posts: 61
    edited 2013-12-30 15:48
    I think what you are seeing is the +/- terminals on one of the motors being reverse of what it is in the prototype. I'd recommend swapping the +/- terminals on the motor that goes backwards when it's expected to go forward. Then, your code will be able to match what's in the .zip.

    I have both Blue wires going to M2 on each HB25 and each Red wire going to M1. So each is wired the same unless they are wired wrong inside the motor. I can reverse one so that Red=M1/Blue=M2 and Red=M2/Blue=M1 and check that.
  • edited 2013-12-30 17:13
    Yeah, I'm not sure who's got the Arlo right now, but they'll likely reply with more info when they see my APB. While writing the test code, I asked the guy who put it together to make some motor wire changes so that the code (as written) would make the Arlo go straight forward with drive_speed(128, 128). I do not remember the details, but I set it up so that the power switches were at the "tail" of the Arlo. BTW, if you swap motor leads, re-run the calibration code.
  • fataldavefataldave Posts: 61
    edited 2013-12-30 20:22
    Yeah, I'm not sure who's got the Arlo right now, but they'll likely reply with more info when they see my APB. While writing the test code, I asked the guy who put it together to make some motor wire changes so that the code (as written) would make the Arlo go straight forward with drive_speed(128, 128). I do not remember the details, but I set it up so that the power switches were at the "tail" of the Arlo. BTW, if you swap motor leads, re-run the calibration code.

    Alright reversed the polarity on one of the motors then re-ran the calibration and now all is well, a +/+ drives forward and -/- reverse.

    Edit:

    For others, the way I have it setup now is:

    Left Motor
    Red=M1
    Blue=M2

    Right Motor
    Red=M2
    Blue=M1

    (Left and Right are figured while looking at Alro with the Parallax logo on the base of Arlo pointing at you)
  • NikosGNikosG Posts: 705
    edited 2013-12-30 22:27
    fataldave wrote: »

    Motor 1
    Red=M1
    Blue=M2

    Motor 2
    Red=M2
    Blue=M1

    I think is useful to make clear which one is the Motor Left and which one is the Motor Right.
    Instead of Motor 1 and Motor 2 use Motor Left and Motor Right. For instance when you said Motor 1 you mean the Left or the Right motor?
  • fataldavefataldave Posts: 61
    edited 2013-12-31 07:25
    NikosG wrote: »
    I think is useful to make clear which one is the Motor Left and which one is the Motor Right.
    Instead of Motor 1 and Motor 2 use Motor Left and Motor Right. For instance when you said Motor 1 you mean the Left or the Right motor?

    I edited the post to be clear on that.
  • Matt GillilandMatt Gilliland Posts: 1,406
    edited 2013-12-31 11:42
    Hi fataldave - Forgive me for stepping in late on this...dis-regard the following if it's redundant :-)

    Don't reverse the + and - power on the HB-25's. Only reverse the outputs (that are connected to the motors).

    That's the bi-directional output to the motors (I know you know this, but it's for others that may come across this thread that might not).

    ...and for the record, every Arlo I've ever built gets *stolen* by somebody in this building - I don't have one that's functional right now...I'll fix that on Friday :thumb:
    so that I've got test-case machine too!
    For others, the way I have it setup now is:

    Left Motor
    Red=M1
    Blue=M2

    Right Motor
    Red=M2
    Blue=M1

    (Left and Right are figured while looking at Alro with the Parallax logo on the base of Arlo pointing at you)
    -Perfect.

    -MattG
  • fataldavefataldave Posts: 61
    edited 2013-12-31 13:54
    Don't reverse the + and - power on the HB-25's. Only reverse the outputs (that are connected to the motors).

    Yep, Just reversed the M1/M2 terminals as noted. To also avoid confusion, the Red/Blue are wires from the Parallax Wheel Kit. Problem was resolved after doing this, just wanted to document it for others.
    ...and for the record, every Arlo I've ever built gets *stolen* by somebody in this building - I don't have one that's functional right now...I'll fix that on Friday :thumb:
    so that I've got test-case machine too!

    I can see that being a problem, At least they are fun to build!
  • NikosGNikosG Posts: 705
    edited 2014-01-01 11:19
    Hi fataldave - Forgive me for stepping in late on this...dis-regard the following if it's redundant :-)

    Don't reverse the + and - power on the HB-25's. Only reverse the outputs (that are connected to the motors).

    That's the bi-directional output to the motors (I know you know this, but it's for others that may come across this thread that might not).

    ...and for the record, every Arlo I've ever built gets *stolen* by somebody in this building - I don't have one that's functional right now...I'll fix that on Friday :thumb:
    so that I've got test-case machine too!

    -Perfect.

    -MattG

    Hi Matt,

    I' m trying to build an Arlo Robot with the motors from the MadeUSA Robot Base Kit.
    I replaced the old encoders with the NEW 36-position Quadrature Encoder Set
    The old motors wires was yellow and Blue, The NEW Arlo motors have blue and Red wires.
    Can you tell me please in wich cable correspondence the blue and the Red ?
  • fataldavefataldave Posts: 61
    edited 2014-01-01 11:38
    NikosG wrote: »
    Hi Matt,

    I' m trying to build an Arlo Robot with the motors from the MadeUSA Robot Base Kit.
    I replaced the old encoders with the NEW 36-position Quadrature Encoder Set
    The old motors wires was yellow and Blue, The NEW Arlo motors have blue and Red wires.
    Can you tell me please in wich cable correspondence the blue and the Red ?

    If you want to figure this out before Matt responds, you can wire them up assuming Yellow=Red. If you are wrong when you send a +/+ command to go forward and it goes in reverse you just have to reverse each side and you are good. As Matt said, just do not reverse the input power (From the battery) on the HB25's.
  • NikosGNikosG Posts: 705
    edited 2014-01-01 14:07
    fataldave wrote: »
    If you want to figure this out before Matt responds, you can wire them up assuming Yellow=Red. If you are wrong when you send a +/+ command to go forward and it goes in reverse you just have to reverse each side and you are good. As Matt said, just do not reverse the input power (From the battery) on the HB25's.

    What mode of operation do you use for the HB-25s Connections ?
    Mode -1 or Mode-2 ?

    attachment.php?attachmentid=105868&d=1388613897

    I suppose that we must use the mode-1 because the Propeller Activity Board uses two pins in order to control the servos.

    Have I right?
    1024 x 623 - 72K
  • fataldavefataldave Posts: 61
    edited 2014-01-01 14:22
    NikosG wrote: »
    What mode of operation do you use for the HB-25s Connections ?
    Mode -1 or Mode-2 ?

    I suppose that we must use the mode-1 because the Propeller Activity Board uses two pins in order to control the servos.

    Have I right?

    Yeah you have to use Mode 1 with this code. Just figure each HB25 is a 'Servo' in the example above.
  • NikosGNikosG Posts: 705
    edited 2014-01-02 21:57
    Each encoder has two sockets. Which goes to the HB-25 and which to the propeller activity Board?


    attachment.php?attachmentid=105895&d=1388728601
    1024 x 757 - 69K
  • fataldavefataldave Posts: 61
    edited 2014-01-03 05:02
    NikosG wrote: »
    Each encoder has two sockets. Which goes to the HB-25 and which to the propeller activity Board?

    None go to the HB25, I ran the A line to the Activity Board and left the B line unplugged for now. The code as it is now does not support the quad encoders yet, I hear its coming some day but for now I just used the one side.

    Dave
  • NikosGNikosG Posts: 705
    edited 2014-01-03 09:49
    So,
    according what you said, you and Matt (post #12) ,
    the Arlo wiring diagram in order to run the Andy's Arlodrive must be the next?

    attachment.php?attachmentid=105903&d=1388771218
    1024 x 1227 - 144K
  • Jessica UelmenJessica Uelmen Posts: 490
    edited 2014-01-03 11:57
    Hi Nikos,

    I've just verified your diagram with an Arlo in Ken's office, and they match! So yes, your diagram is correct.

    Jessica
  • NikosGNikosG Posts: 705
    edited 2014-01-03 13:36
    Thank you Jessica,

    Happy new year!!!!

    I’m trying to create a big differential robot using the benefits of the ActivityBot and the Andy’s Arlodrive code. I use the Eddie motors instead of Arlo motors but I replaced the old encoders with the new 36 position encoders. As Ken said in this thread Arlo motors are about 100 RPM but Eddie motors are about 150 RPM. Is this a problem? Must I change any parameter on arlodrive code?


    Nikos
  • edited 2014-01-06 15:54
    Hi Nikos,

    The library will hopefully work as-is. I'd say try it out (unmodified) and let us know how it goes. Make sure to run the calibration code first, and let it completely finish with P26 and P27 LEDs turning off. Then, try some navigation code.

    Although it should work, it'll probably work better with some tuning. I usually use Control System Test and Display.side, which is in the zip, to monitor and display frequency and magnitude of position errors with an XBee. I also go back and forth between testing with that and updating libarlodrive -> arlodrive.c. There's some additional info in Control System Test and Display.side, but it's pretty terse. Let me know when you get to that point, and I'll supply details and clarifications as needed.

    Andy
  • NikosGNikosG Posts: 705
    edited 2014-01-08 14:18
    Hi Andy,
    and Happy New Year!!!

    Thank you for your Alrodrive code!
    This new ability is very promising! I’m looking forward to finish my new Robot in order to test your code. Unfortunately I have some technical problems with my 3d printer but I hope that I’ll overcome the problem soon and my Robot will be ready to test the Arlodrive.
    Of course you will have feedback, I’m sure that I’ll have a lot of questions.


    Nikos
  • NikosGNikosG Posts: 705
    edited 2014-04-12 01:38
    Hi Nikos,

    The library will hopefully work as-is. I'd say try it out (unmodified) and let us know how it goes. Make sure to run the calibration code first, and let it completely finish with P26 and P27 LEDs turning off. Then, try some navigation code.

    Although it should work, it'll probably work better with some tuning. I usually use Control System Test and Display.side, which is in the zip, to monitor and display frequency and magnitude of position errors with an XBee. I also go back and forth between testing with that and updating libarlodrive -> arlodrive.c. There's some additional info in Control System Test and Display.side, but it's pretty terse. Let me know when you get to that point, and I'll supply details and clarifications as needed.

    Andy

    Dear Andy,

    Your Arlodrive Library code is excellent! Congratulation for another time!

    Few lines of code in conjunction with Parallax Hardware were enough to make my robot (The Artist) to do amazing things! The accuracy and the control of the robot’s movement are Amazing!!!!

    I have 3 questions:

    1) When will be ready the drive_distance (int left, int right) Function?
    (At the moment I use the drive_goto as you suggest in the help Documentation)

    2) I want to use for the “Artist” brain, the Propeller Boe of Education Instead of the Propeller Activity Board. Can I use the Arlodrive with PropBOE? (Is it compatible with the "Arlo robot philosophy"?The problem is that I must use different pins for the servos. Isn’t it? (So I tried to use for servo Pins the 18,19 that has the PropBOE instead of the 12,13 that uses the Activity Board). So I used your function: drive_servoPins (18,19) in order to change the servo pins but I had not result. Why? Can you give an example please?

    3) The version of Arlo Library that I have is the V0.5 . Which is the current version? Have you release a newer version from the v0.5? Will be freeware and the new versions?

    Thank you,
    Nikos Giannakopoulos
  • edited 2014-04-12 18:03
    Hi Nikos,

    Hey, that's great! I'm really glad to hear it's working, and thank you very much for the favorable comments.

    (1) The abdrive and arlodrive library updates have been rescheduled a couple times, but I'm confident I'll get to start making adjustments soon. I'll let you know as soon as drive_distance is ready. Sorry for the delay. In the meantime, use drive_goto for straight lines and turning in place. In the next set of updates, drive_goto will be modified to support curves. For now, curves can be executed with drive_speed(a, b), where a > b or or b > a, and just make sure to run it for a certain amount of time.

    (2) Have you tried making drive_servoPins(18, 19) the very first call in your main function? If you call it before any calls to drive_speed, it should work. If not, please let me know, there are some other things we can try.

    (3) No updates yet, 0.5 is current.

    Andy
  • NikosGNikosG Posts: 705
    edited 2014-04-17 12:06

    ....Have you tried making drive_servoPins(18, 19) the very first call in your main function? .......

    I put the “drive_servoPins(18, 19)” first command in my main function but I had no result.
    I suspect that the problem is on the procedure or calibration….. Must I do again the calibration? I did it, but the robot had no reaction during the calibration procedure with the PropBOE board.

    No updates yet, 0.5 is current.

    In the newer version of the Arlodrive can you add two functions ?
    The “move_to(x, y)” in order yo Move directly to the point (x, y).
    And the “arc_to(x, y, radius) '' in order to move to the point (x, y) via an arc of the specified radius …..something like the S2 code……
    it would be very convenient for many people ..... :)


    Nikos Giannakopoulos
  • edited 2014-04-17 15:01
    Yeah, the calibration goes with the board, so if that Propeller BOE has never run a calibration program, it will need to. Hmm, it looks like the arlocalibrate library is set up to use servo_pins(18, 19) for that. I should change that to drive_servoPins(18, 19) to match arlodrive. But for now, try adding servo_pins(18, 19) as the very first command in your Arlo Calibrate program's main function and run the calibration. In your application programs, keep drive_servo_pins(18, 19) as the first command in its main function, and please let us know if it works with those modifications.

    The arlodrive library is designed so that you should only have to call drive_servoPins(18, 19) once. (Assuming calibration has been completed.) Programs after that should automatically use P18 and P19. If that doesn't work for you, please let me know so that I can add it to my repair list.

    Great idea on move_to(x, y) and arc_to(x, y). On move_to(x, y), do we want to execute that in a polar coordinates fashion? If that's the case, move_to would convert (x, y) into (r, theta). It would first turn by theta, and then go in a straight line distance of r. Is that what you had in mind?

    Andy
  • NikosGNikosG Posts: 705
    edited 2014-04-19 01:34
    ......for now, try adding servo_pins(18, 19) as the very first command in your Arlo Calibrate program's main function and run the calibration. .....

    There is a problem when I try to add the "servo_pins(18, 19)" in my Arlo Calibrate program:

    attachment.php?attachmentid=108218&d=1397895364

    Why happens this?

    ..... On move_to(x, y), do we want to execute that in a polar coordinates fashion? If that's the case, move_to would convert (x, y) into (r, theta). It would first turn by theta, and then go in a straight line distance of r. Is that what you had in mind?

    That I have in mind is: When I give for example: move_to(1000, 50) I want the robot to move to a point 1000 to the right and 50 above the origin.
    and when I give arc_to(1000, 50, -100) 'Move to the point 1000 to the right and 50 above the origin in a clockwise arc of radius 25.
    Exactly as the functions s2_move_to and s2_arc_to in S2.spin

    attachment.php?attachmentid=108219&d=1397896221

    Of course these function must do the job of "move_by" and "arc_by" functions....

    Nikos Giannakopoulos
    664 x 661 - 108K
    538 x 72 - 20K
  • edited 2014-04-21 12:54
    Nikos,

    Use servo_pins(18, 19) with the arlocalibrate library, not drive_servoPins(18, 19). For now, only use drive_servoPins with arlodrive. I will correct this in the next revision so that both arlocalibrate and arlodrive use the same function names.

    Andy
  • NikosGNikosG Posts: 705
    edited 2014-04-22 16:06
    Nikos,

    Use servo_pins(18, 19) with the arlocalibrate library, not drive_servoPins(18, 19). For now, only use drive_servoPins with arlodrive. I will correct this in the next revision so that both arlocalibrate and arlodrive use the same function names.

    Andy
    Thank you Andy!

    I was completely heedless! Now everything is Ok!

    The calibration with Propeller Boe was successful !
Sign In or Register to comment.