Help with activity bot and ping bracket
dsomashe
Posts: 21
I am new to the activity bot but love it so far. I installed the ping bracket, but didn't have any idea how to begin having the bot sweep and ping to avoid obstacles. I was wondering if anyone knew where to find some example source code to help me get started with the ping bracket setup. I saw PINGDAR but I think that is for the STAMP microcontroller, not the propeller board. Is this correct? Thanks so much for any help!
Comments
Look in the Learn sections of the Parallax website. In the C - Learning simple devices there is a section on Standard Servo. That will show how to sweep the Ping Bracket.
In the ActivityBot section of Learn, there is a tutorial on Navigating using ultra sound.
It is easy to navigate with the Ping in a fixed position. Using the bracket and rotating it requires that you rotate the bracket a few degrees. Stop the rotation. Take a ping reading, and then figure out what you want to do next.
Be sure to read the tutorials show how much area ping covers and how the ultrasound reflects from an object. If the angle is too shallow, the reflection might not return directly to the Ping.
When I got my bracket, the first program I wrote just mapped the area around the ABot.
Hope this helps you get started.
Tom
Do you have an example of mapping the area around the bot that you could share?
I don't have access to my computers with the programs on it today, but I'll try to post them later this week.
Briefly, l place the ActivityBot in the direction I want to have a baseline and start the program. The ActivityBot turns 90 degrees to the left. The Ping is rotated 90 degrees to the right (pointing in the direction of the baseline). It the takes a distance reading, rotates a few degrees left, takes another reading, and repeats for a full 180 degrees. The data (angle and distance to whatever object is detected) is stored in a file on the SD card. The the ActivityBot turns 90 degrees to the right, travels along the baseline for a specific distance, stops, turns left 90 degrees, and repeats the measurements. That data is saved in another file on the SD card.
Then I import the data files into an excel spreadsheet, do some calculations combining the data from both locations and plot the data. By taking measurements from 2 locations you can get some idea of the location and shape of the objects.
One of these days, I want to use ROBOT BASIC together with XBEE radios to transfer the data live from the ActivityBot to the PC and plot with ROBOT BASIC. But I have a lot to learn regarding the BASIC, and with my current list of robot projects and commitments at home and work, it will be a while before I get a chance to do that.
Tom
atoi parameters are integer to convert, character string to hold converted digits, number base of the integer.
int n = sprinti(buffer, "%d", x); // convert number to string, n is length, buffer is character array long enough to hold the integer digits, x is the integer, %d is the formatting which converts the decimal (base 10) representation of x. sprinti only works with integers and saves significant code space.
The excel spreadsheet with a sample of the data is also attached. My earlier post where I stated that I used 2 SD files was incorrect. I just used one file and added the second scan data to the end of the first. Note in the spreadsheet where the 2nd scan begins (row 39 where the angle is zero), the formula for "x" changes by adding 86. That is to account for the distance moved by the Bot between scans. This was an early version of the spreadsheet, and I don't recall why I used 86, possibly that was the actual distance traveled?? The plot didn't turn out as well as I had hoped, I recall that I did improve on that somewhat. But I haven't been able to locate the disks where I had saved the spreadsheet.
I hope that this gives you a starting point to work from if you are interested.
Tom
TEST2.xls
- record of a labyrinth at slow speed
- exit the maze at full speed with data recorded.