Shop OBEX P1 Docs P2 Docs Learn Events
Robotic mobile base with lots of sensors — Parallax Forums

Robotic mobile base with lots of sensors

StampNut2StampNut2 Posts: 224
edited 2007-09-03 05:18 in Robotics
Please I need help with this mobile base in the coding area, I am using a BS2p40 with demo board and Bluebells design
subsumption circuit board which has 8 servo inputs and 4 A/D inputs, The pbasic software at present runs the two servo
drive units, IRPD sensors and 2 bump sensors, However I have a number of other sensors which I would like to use and
I do not know where to insert the extra code in the subsumption architexture so that the sensors make the right servo commands.
Also I need the eminic speech chip to say which sensor is activated. Pir to say [noparse][[/noparse]Intruder detected] ect.



2 Bump sensors Programed
1 IRPD sensor Programed
3 GP2D12 sensors To program
1 PIR sensor To program
1 LDR Do not need to program, Used stand alone circuit, not connected to stamp for head lamps.
1 LCD display To program
1 Ultra sonic ping To program
2 Pan/tilt servos to program for ping U/S
4 white LED head lamps Do not need to program, Used stand alone circuit with above LDR, not connected to stamp for head lamps
1 Emic speech chip To program
2 drive servos Programed
Low battery indicator To program

So you can see I have my work cut out in the programing area, I don't think I will have any hair left after this project.
I can post the code that I am using at present and a pic of the robot. I am not sure how to integrate the code from the
sensors to the various movements of the servos, any help in this area would be greatly appreciated. I am learning pbasic
but being 56 yrs I do not find it easy to learn this, younger people seem to pick this sort of thing up easy.
Hardware is no problem for me but software is another thing.
Thanks in anticipation.
Stampnut.

Pics

1 Left side showing sensors
2 Right side showing sensors
3 Subsumption board
4 top view with subsumption board.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never give up when things go wrong.

Post Edited (StampNut2) : 8/7/2007 6:30:13 PM GMT
1600 x 1200 - 805K
1600 x 1200 - 858K
446 x 334 - 49K
«1

Comments

  • GadgetmanGadgetman Posts: 2,436
    edited 2007-07-26 08:21
    1. This topic is in the wrong forum(Completed projects) and should probably have been in either the 'Basic Stamps' or the 'Robotics' forums.

    2. You need a topic title.

    Yes, you need to post your code for us to be able to help you.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't visit my new website...
  • StampNut2StampNut2 Posts: 224
    edited 2007-07-26 08:55
    Thanks, Gadgetman. Just posted in the right section

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never give up when things go wrong.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-07-26 14:20
    This thread is being moved from the Completed Projects Forum to the Robotics Forum. Duplicate thread removed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • floodhoundfloodhound Posts: 45
    edited 2007-07-26 16:56
    Personally I think you have a bit over kill on the sensor arraignment. If you can maximize one sensor you can remove many others.

    True programming is frustrating but soon you will learn how the Stamp works best for your project. Multitasking is going to become difficult because you have so many sensors and truly a Stamp won’t multitask. A Spin chip would be better for this project but if you are stuck on the STAMP then try writing little modules and test each one before moving on the next module. For example write a function that measures distance and test it. Then write code for turning the head and test it as well. Then after testing all the modules try tying them together.

    Please post some code here for more help

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My web site -- > www.floodhound.com <-- take a look if you like
  • StampNut2StampNut2 Posts: 224
    edited 2007-07-26 18:19
    Floodhound: Thanks for your reply, I am using the bluebell design subsumption board in conjunction with the demo board, The subsumption board www.bluebelldesign.com/ offloads a lot of the number crunching leaving the BS2P40 to do other work, So hopefully I can use all these sensors. I will try to get the code I have so far, I need to know where to place it in the system so each sensor can interact with the motor commands, I believe that the subsumption code has 1-5 priority as far as the sensors go.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never give up when things go wrong.

    Post Edited (StampNut2) : 7/26/2007 6:55:53 PM GMT
  • StampNut2StampNut2 Posts: 224
    edited 2007-07-28 07:38
    Can anyone help me on this project???????? I will get the code I have up tomorrow.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never give up when things go wrong.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-07-28 08:22
    StampNut2

    Perhaps you should do some reading on subsumption programming. A search of the Internet shows thousands of hits.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • StampNut2StampNut2 Posts: 224
    edited 2007-07-29 05:33
    Bruce Bates, I have done a fair bit of reading up on subsumption, But I have a hard job in determining where to put the sensor code in the required priority fields 1-5 in the level subsumption area, I have now included the subsumption code above. I need to know where to insert the code for Ultrasonic ping, GD2P12 sensors x 3, LDR, PIR, Serial LCD and Emic text to speech which I want it to say which sensor has been activated.The ping and PIR are scanning left to right but I also want the pan/tilt to scan slow from center to left,stop take a PIR reading, then scan left stop, take A PIR reading, Scan to center, stop take a PIR reading, Scan to right,stop take a PIR reading, As well as taking sonar readings.I may be asking to much here.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never give up when things go wrong.

    Post Edited (StampNut2) : 7/29/2007 5:51:29 AM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2007-07-29 06:30
    Just looking at your list of sensors, I don't think you can get everything done in a 20ms cycle. The PING alone can take up to about 20ms. The GD2P12 sensors produce an analog output and their speed depends on what you use for an ADC. It would probably take at least a couple of ms to read the GD2P12 sensors and LDR. The serial LCD and Emic use serial outputs at around 9600 Baud and will take about a ms per character minimum.

    It sounds like you need to re-think your design before proceeding further.
  • StampNut2StampNut2 Posts: 224
    edited 2007-07-29 11:28
    Mike, I am using bluebells design subsumption circuit board in conjunction with a BS2P40, I am told that with both these boards together it can run most of the sensors I have listed, But I do not know enough programing wise to be certain of this statement Mike. Would you have a look at this site www.bluebelldesign.com/ and let me know what you think. Thanks.
    I have the two servo drives working plus IRPD and bump sensors, If no one knows where to insert the other sensors PLEASE can some one tell me where to insert the roaming with ping and the GD2P12 sensor code into the subsumption 1-5 level.
    Thanks

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never give up when things go wrong.

    Post Edited (StampNut2) : 7/30/2007 6:27:20 PM GMT
  • StampNut2StampNut2 Posts: 224
    edited 2007-08-01 18:23
    M'mmm has anyone got an answer for me code wise for this project.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never give up when things go wrong.
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2007-08-02 02:30
    Hello,

    I tried looking at the url for the bluebelldesign but it is either offline or my ISP is having routing problems.... Maybe it will be fixed by the weekend.

    It looks like you are doing a nice job on the construction of the robot and it should work out well as a platform to experiment on and learn more anout programming. For now just set aside some of the extra's (LCD, speech) and just start adding in one more sensor at a time. The approach I would take is to try inserting the code for your new sensors at different levels and see if it gives go the behaviors you expect. If not, move them to a different level and try again. Even robots that are built similar can act quite a bit different depending upon sensor placement, etc so you have to tweak your code for the robot it's running on. One resource you may want to pickup if you want to read a bit more on Subsumption is: "Mobile Robots Inspiration to Implementation" by Joseph L. Jones and Anita M. Flynn ISBN 1-56881-011-3 It has several examples which may help. They are written in Interactive C for a HandyBoard but the examples are still useful. If you find that the BASIC Stamp isn't quite fast enough then you could drop in an SX48 module in its place:

    http://forums.parallax.com/forums/attach.aspx?a=13623

    It can be programmed in SX/b (BASIC), assembly, and now there are a couple options for a C compiler. For now you should probably stick with what you've got but if you need more performance and control there are options.

    For answers that directly relate to your program you'll probably get more responses if you ask focused questions on programming a particular sensor or output device. Also, if you can give more examples on what you want it to do and how you want it to behave ask which group of sensors would be the best ones to use for the way you want it to act.

    Good luck,

    Robert
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2007-08-02 06:04
    RobotWorkshop -

    Here is the link to Blue Bell Design: http://www.bluebelldesign.com/

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • StampNut2StampNut2 Posts: 224
    edited 2007-08-02 06:40
    RobotWorkshop, Thanks for your reply and info, I will try to get the GD2P12 edge detectors going first, I have three of these two facing 45 degrees right and left and 45 degrees down and one at the rear 45 degrees down, the main question I need to know is exactly where to place the code in the subsumption code I have listed above.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never give up when things go wrong.
  • RobotWorkshopRobotWorkshop Posts: 2,307
    edited 2007-08-02 10:33
    I finally was able to bring up their website. I did have the url right but while I first tried there must have been a problem with the site or with a router on the Internet since the name would resolve to an IP address but the Network was unreachable. It's cleared up now.

    Taking a look at their docs does clarify some things. One the subsumption logic is built in to their co-processor chip and can automatically do some things depending upon the sensor readings that it is taking. That is an important point since many reading this may be under the impression that you are trying to read all the sensors and do the subsumption logic all within the BASIC stamp itself. That changes things a bit. Since you are offloading much of the work that will make it easier for the Stamp to do some higher level functions.

    Does Blue Bell have a similar forum for users of its chip or an e-mail list that you can sign up? That would be the best place to ask about the particulars of using that co-processor. It has its own set of commands and even looking over the datasheet someone would have to try it out and work with it a bit to see how it really reacts before they could offer any decent suggestions on it's use. I expect that most people here would be more familiar with using the BASIC Stamp itself to check all the sensors and drive the servos, etc instead of using that particular chip.

    Robert
  • StampNut2StampNut2 Posts: 224
    edited 2007-08-03 06:26
    RoboWorkshop, Again thanks for your help, You are probably right in what you say. The code above is for the basic stamp in conjunction with the pre programed chip on the subsumption board. I do not think they have a forum site or email list, But I will have another look tonight. Robert, the idea of the subsumption circuit was to offload some of the sensors so as to leave the stamp to do more, as I HAVE A LOT OF SENSORS the stamp would not cope with all of them.
    Thanks
    Mike

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never give up when things go wrong.
  • StampNut2StampNut2 Posts: 224
    edited 2007-08-07 18:50
    Here are some updated photo's, added Emic text to speech, another battery pack for head lamps, and other sensors, Hardware almost complete.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never give up when things go wrong.

    Post Edited (StampNut2) : 8/7/2007 7:00:12 PM GMT
    1600 x 1200 - 884K
    1600 x 1200 - 844K
    1600 x 1200 - 845K
    1600 x 1200 - 808K
  • RobosteinRobostein Posts: 4
    edited 2007-08-07 21:49
    check out the isd1000 line of voice chips playback. or sphinx 4 java code

    Post Edited (Robostein) : 8/8/2007 3:41:58 AM GMT
  • StampNut2StampNut2 Posts: 224
    edited 2007-08-08 06:32
    Robostein, The ISD 1000 is now no longer produced, It has been replaced by the ISD 1400 and ISD 2500 BUT THANKS FOR YOUR SUGGESTION.
    www.winbond-usa.com/products/isd_products/chipcorder/datasheets/1400/ISD1400_Rev1.2.pdf

    ISD speech chip selections
    www.datasheetcatalog.com/informationstoragedevices/1/

    My favorite ISD 5008

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never give up when things go wrong.

    Post Edited (StampNut2) : 8/8/2007 6:57:25 AM GMT
  • MightorMightor Posts: 338
    edited 2007-08-08 06:42
    Wow, that is one seriously pimped-out bot. Soon you'll need a small nuclear powerplant to power that thing. Looks awesome though. Must be a real challenge to program it.

    Gr,
    Mightor

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    | What the world needs is more geniuses with humility, there are so few of us left.
    | "Wait...if that was a compliment, why is my fist of death tingling?"
    | - Alice from Dilbert
  • StampNut2StampNut2 Posts: 224
    edited 2007-08-08 06:56
    Thanks Mightor, Yes the programming is going to be a challenge. Any takers???

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never give up when things go wrong.
  • MightorMightor Posts: 338
    edited 2007-08-08 07:20
    StampNut2 said...
    Thanks Mightor, Yes the programming is going to be a challenge. Any takers???
    I am not sure how you would go about programming all these sensors AND still find time to actually pulse the servos. One way you could do it, I guess, is to offload the servos to (yet) another extra peripheral, namely a servo controller. This would mean you don't need to make sure you stay within the 20ms loop. You could then take more time to read all the sensors. It is also possible that some sensors don't need to be read as frequently as others and you could then read sensor X and sensor Y in alternate loops and sensor Z in every loop. That would cut down on some of the time. I had pull some tricks with my Boe-Bot when I wanted to read my compass module and still pulse the servos. The compass generally takes 30-40ms to come back with a reading, so what I did was reset the compass and ask it to start measuring, if it wasn't busy doing a reading already, pulse the servo, check if compass was ready with a result, if not, wait 10-15ms and loop. the only trouble with that method is that your bot is moving while you're trying to take a reading and I really have no idea when the actual reading takes place in time. That means you can never be 100% sure what angle you're pointing at the time you get your result from the compass.

    Hope this gave you some ideas. If not, don't hesitate to ask. Just so you know though, I won't be able to help you with the actual programming. I'll leave that as an exercise for the reader, hehe.

    Gr,
    Mightor

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    | What the world needs is more geniuses with humility, there are so few of us left.
    | "Wait...if that was a compliment, why is my fist of death tingling?"
    | - Alice from Dilbert
  • StampNut2StampNut2 Posts: 224
    edited 2007-08-08 09:34
    Mightor, Thanks for your input, Regarding the 20ms time, If you look at the first entry above you will see the third photo to the right, this is a subsumption circuit board which has eight servo outputs and four A/D inputs, it also has bump and 1 IRPD sensor so these are offloaded from the BSP40 which leaves the stamp to take care of the sensors. But as I said programming is my weak point, I have the code above for the subsumption but need advice as to where to insert the code for the GD2P12 distance sensors and Ping sonar as well as the pan/tilt servos + Emic speech chip.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never give up when things go wrong.
  • Ken GraceyKen Gracey Posts: 7,392
    edited 2007-08-08 16:10
    StampNut2:

    How about starting by developing your code one piece at a time. For example, first control the motors. Next, add a sensor and integrate it into your program. Continue on until it is too difficult, then add the BlueBell co-processor to take over the motors. That's going to solve a lot of timing problems. Don't try to do everything at once for now - just start writing code one small piece at a time. Use our Robotics book if you need help.

    Ken Gracey
  • StampNut2StampNut2 Posts: 224
    edited 2007-08-08 18:35
    Hello Ken, Thank you for your time in replying to my problem, So, what you are saying is do not use the code that I already have so far [noparse][[/noparse] That is the above code ] which at this stage works the main drive servos, bump and IRPD?, I have snippets of code in block form for most of the sensors that I wish to use , I just do not know where to insert it in the above code 1-5 subsumption. That is: GD2P12 x 3 sensors is this placed in a sub routine or after a variable ect and once it is inserted in the right place what code do I need to transfer that information to the servo motors to drive them in the required direction. I know all this coding is easy for you guys and I do have 5 of your parallax books and I am trying to learn Pbasic, But I find that the easiest way for me to learn is finding a piece of code that works each of the required devices which I know works then I can see how it works but my main problem is stringing it all together in the right order. Can you give me an example Ken say using the above code as to where to insert the GD2P12 sensors and how to intergrate the sensors to the servos and maybe I can start from there. For example, if the right/left/back GD2P12 [noparse][[/noparse] edge detectors angled at 45 degrees ] right sensor detects an edge,left servo reacts to X amount of seconds then continues fwd left sensor detects edge right servo reacts X amount of seconds ect. I am 56 and find it harder to learn this coding, The younger generation seem to find it easy, Arrgghh.
    Thanks
    Mike

    P/s The GD2P12 sensors are connected to the A/D lines on the subsumption board.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never give up when things go wrong.

    Post Edited (StampNut2) : 8/8/2007 6:55:38 PM GMT
  • Ken GraceyKen Gracey Posts: 7,392
    edited 2007-08-08 20:10
    StampNut2:

    I didn't look at your code yet, so I can't say whether or not it is appropriate to start over. What I was trying to convey, though, is that in my limited experience writing code I find it most productive to start with small pieces, adding features/sensors, with total project in mind the whole time. In this case, you've got this 20ms period to revisit the servos.

    You are currently using our working code snippets, and you're trying to link them together. This is AOK and dangerous. It's acceptable if you understand how each piece works before you combine pieces of programs.

    Ken Gracey
  • StampNut2StampNut2 Posts: 224
    edited 2007-08-09 05:07
    Ken, When you say it's dangerous what's the worst case scenario if I go this way??

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never give up when things go wrong.
  • Ken GraceyKen Gracey Posts: 7,392
    edited 2007-08-09 05:24
    StampNut2:

    It's not "dangerous" per se, but perhaps more inefficient to link lots of code together from different places. You will find that each example may use byte and word variables quite freely to showcase the example, and maybe they all use temporary variables as well. Combine all this "stuff" together and you get wastefullness and RAM shortage. For example, some programs we publish may have liberal use of DEBUG statements to show the sensor output on the PC. This could also consume lots of precious time along the way.

    You just need to be aware of how you're mixing things up in the big pot. If each recipe has it's own share of peppers and butter and you add them together you might wake up late at night with a cholesterol problem and acid reflux. Think about the whole recipe and don't necessarily let the ingredients be additive. Understand what you're bringing into your main program from each recipe before you get carried away.

    Others on this forum may be able to put this into words a bit better than I.

    Ken Gracey
    Parallax, Inc.
  • StampNut2StampNut2 Posts: 224
    edited 2007-08-09 07:12
    Thanks Ken for your input. To learn How it works I need to see the code, So I hope someone on this forum can post some code so I can grasp how it goes together in what order, even if it's just the GD2P12 sensors that are on the A/D lines on the subsumption board. Thanks again.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never give up when things go wrong.
  • StampNut2StampNut2 Posts: 224
    edited 2007-08-12 03:13
    Can anyone throw some more light on this subject please. It would help heaps in my understanding as to where the code is inserted. Thanks

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never give up when things go wrong.
Sign In or Register to comment.