Shop OBEX P1 Docs P2 Docs Learn Events
Programming a TEACH or RECORD function — Parallax Forums

Programming a TEACH or RECORD function

Quik_DrawQuik_Draw Posts: 5
edited 2006-08-31 00:35 in Robotics
I am VERY new to this stuff as it applies to bots but I DO have some experience with VB and BASIC programming...

I am interested in how to go about programming a TEACH function, or, RECORD/REPLAY function, wherein I can "WALK" the bot through a specific course and save the pulse counts for each sequence, or, time measures, either way, and assign those values to the·corresponding leg of the sequence.·Then, by restarting or replaying the program, WITH the added distances saved, repeat the course as defined in the WALK through...Is that DEEP?

I have looked at the GUI style of programming and time based sampling, but, I want to put the ability of recording the path into the operator's convenience, rather than have the operator access the GUI software to change parameters...Rather have the operator TEACH the bot on the fly if it doesnt take millions of lines of code to setup the ability to do so...

I appreciate any assitance and/or guidance anyone can provide...

Thanks for your time and consideration of my inquiry...

Regards,

Quik_Draw

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2006-08-30 16:02
    If you are talking about recording the position of servo's, then the following link may be of interest to you.· Although this uses a Propeller for the demonstration,
    ANY of our microcontrollers (BS1,BS2,SX,Propeller) would work.· Note: there is a voltage divider used on the sense pin for the Propeller.· This is only because the
    Propeller is a 3.3V device and the 5V operating the servo would be to much for the Propeller input.· Dividing this down to 2.5 Volts allows the Propeller input to still
    "see" this as a HIGH.

    http://forums.parallax.com/showthread.php?p=582447

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Kevin WoodKevin Wood Posts: 1,266
    edited 2006-08-30 16:07
    First, what robot are you referencing?

    Second, what do you mean by GUI style of programming? Do you mean creating GUIs in Visual Basic, or programming a robot with a programming editor?

    What you are proposing to do can be done, but it's not a trivial exercise. If you are looking to "throw something together," your success may be limited. If you are looking for an on-going project to work on, you'll need to put some design time into it.

    So, what are you starting with, and what programming experience do you have?
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-08-30 16:28
    Were I to do this, I'd first build an interface using a hand-held remote, using the Sony protocol (because that's fairly easy for the BS2 to translate). Oh, and an LED for the 'bot to indicate what it's 'thinking', and perhaps a small speaker.

    Then, I'd have to design some way of 'storing' the programmed 'steps' in an updateable memory -- probably an external eeprom, so when I wear it out during testing or use I can replace it. One simple way of doing this might be to store what should happen, and how long it should happen, so each 'record' in the eeprom has an Action and a Duration.

    Since the BS2 can't both measure time AND move the robot, I'd probably use a 'tick' co-processor like the http://www.rhombus-tek.com/co-processors.html 'tiny multi-tasking' chip. This would give me 'hard' 50 mSec 'ticks' that the BS2 could use while learning to add up the times, and use while running to time its actions.

    I think that's enough hardware. OK, so having built this, I'd now write a program that would have a 'learn' mode, and a 'run' mode. Some key on the remote would trigger the BOE-Bot to enter 'run' mode -- it would 'beep' when it reached the end of the 'stored steps'. Some other key would trigger the BOE-Bot entering 'learn' mode. In 'learn' mode, it would 'listen' to the remote. The user would 'drive' the BOE-BOT using the remote. The BOE-Bot would 'record' the actions commanded, and how long the actions were commanded.

    Another key would then tell the BOE-Bot 'done'. The 'run' key could then be pressed, and the BOE-Bot would execute the 'stored steps'.

    One expansion to this would allow the user to store several 'stored step sequences', and select them with the remote. And you'd probably want to be able to 'dock' the BS2 with the PC, and have some BS2 code upload and download sequences from PC to the BS2 controlled EEPROM.

    Now there's one problem with all of this, and that is that as the batteries get used up, the same timed sequence won't necessarily cause exact repitition of the same path. Some wheel encoder's can help with this for version 2.
  • Quik_DrawQuik_Draw Posts: 5
    edited 2006-08-30 19:01
    Basically, I am trying to build a bot lawn mower that·has the capacity·where·user can define a SPECIFIC cutting path, as opposed to a random one like the ROOMBA vaccuum follows, or, those that only work within a perimeter wire, still random...

    I have some small optical encoders for the geared wheels to take pulse counts and interpolate those into distance traveled...I also have the POCKET WATCH, BS module to add a real time clock for timing needs...

    I have also downloaded and looked at the GUIbot software...that's good for programming the thing for a ONE TIME, single application.· I am more interested in something that an end user could EASILY select a mode to teach a specific pattern for each given "YARD" to be mown, much like the LEARN and RUN mode described in one of the replies.

    GPS costs too much to get down to that accuracy level...

    Using sensors at pre-defined placements around the yard could probably produce some triangulation possibilities, wirelessly communicating the bots location relative to the sensors, but, that is WAY over my head...

    I need to keep the end user interface as simple as possible...I have even considered (Although my programming experience is too rookie to do it) using a spreadsheet to "GRAB" or "PUT" the parameters into, i.e. counts, seconds, whatever, and using the data table in conjunction with the control program with pointers to·"GET" values from the table by cell address when called in the program...

    I DID·dabble with using an RC setup to guide it through the initial routine as well.

    Guess I'm just bouncing the ideas around to get a comfortable take on what I am up against...NOT TO MENTION the safety part of it all, which I have considered extensively...

    As far as what I have now...I ordered the kit for the frame and hardware as seen here:

    http://www.evatech.net/

    I want to convert the uint from the RC control to full autonomous, PLAYBACK style pattern following...

    For BRAINS, I am dabbling with BS2s and the required supprot boards and sensors...I ordered the development Board of education and the full boe-bot kit to do preliminary program design work with, eventually hoping to perfect it there and transfer everything to the actual unit asseen in the link...Battery won't be an issue with the automotive alternator to recharge it...(As simplified as possible) CONTROL programming, obstruction avoidance, moving object, i.e. Kids, pets. etc..., shutting down in case of failures...these are the areas I am working on now...

    Thanks for your replies...Interesting points from all of you...

    Thanks

    Quik

    Post Edited (Quik_Draw) : 8/30/2006 7:12:00 PM GMT
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-08-30 19:21
    Hmm. Several problems with what you're trying to do. The one that jumps out at me is that a lawn can be a pretty un-even place, with slick grass, tree-roots, slopes, etc. So a 'self-driven' lawnmower has to be able to constantly correct its path. This means it needs some feedback element, so it can know if it's on course or not.

    Now, typical feedback elements for this are GPS (but even then, you'll need some directional component) or a compass module (but I'm not sure those are accurate enough). Following a wire buried a few inches down is possible, but technically difficult. Having a 'fence' of laser-diodes pointing out a path might work, but then you'd have to maintain the fence, and sunlight might reduce its effectiveness.

    And then there's the safety aspect. I saw one of these done by Popular Electronics, but they created a 'string trimmer' based mower, whose 'blades' were mono-filament lines. Plus, any small 'bot' powerful enough, and with enough traction to traverse an entire yard and cut the grass could be a dangerous 'bot.

    Probably the 'open loop', turn your wheels a certain number of revolutions, then turn around and come back, is not going to work on as uncertain a place as a yard.
  • John R.John R. Posts: 1,376
    edited 2006-08-30 20:33
    Not to mention wind, ropes, twine, trash, animals, ant hills, fallen brances, thrown stones, kids toys, etc.

    I would agree that without some type of "active" feedback, there will be no way you can "memorize" how to mow a specific lawn. There will be all kinds of "unknown" things that will alter the course.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John R.

    8 + 8 = 10
  • Kevin WoodKevin Wood Posts: 1,266
    edited 2006-08-30 20:47
    Sounds like the perfect application for...a goat!
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-08-30 21:02
    Yeah, I thought of a goat, but how do you program it's 'brain'?
  • Quik_DrawQuik_Draw Posts: 5
    edited 2006-08-31 00:35
    Back to the perimeter fence and the random pattern inside it with that one...LOL...I could use the BASIC stamp to make the SHOCK COLLAR respond when he reaches the "FENCE"...GEEZ...Sorry I asked...
Sign In or Register to comment.