Please help me! How can I set the servo port P16 and P17 to drive PING))) and front servo?
hans90
Posts: 29
in Propeller 1
I am recently stuck on my project to develop a Smart Car with Activity Board. I built the car as indicated in pictures. I used servo port P12 and P13 for right and left high speed servos to drive wheels; and P14 and P15 to drive right and left encoders. In addition, I built a front servo to drive for the mounted PING))) at front, fed from servo port's regulated 5V. However my question is how can I set P16 and P17 on the servo ports to drive mounted PING))) and front servo? I looked in the 'abdrive.h' library and only find cal_encoderPins() and cal_servoPins() which are used only for the wheels and encoders.
Comments
Connect the Ping cable to the breadboard as shown in the ping tutorial:
learn.parallax.com/tutorials/robot/activitybot/activitybot/navigate-ultrasound/build-and-test-ping-sensor-circuit
Have your program turn the servo to point ping where you want. Wait until it moves to that position. take a ping reading. rotate again, ping again, etc.
This is a link to a thread where I show code that I wrote to make a map of an area using the activitybot, ping, the ping servo, and an SD memory card to save the data. forums.parallax.com/discussion/161231/help-with-activity-bot-and-ping-bracket
The program just combines programs from a number of the activitybot tutorials.
It works as follows. Place the activitybot facing in direction you want to be a baseline. Start the program. The bot will turn to left 90 deg. It will then start to scan the area in 5 degree increments getting a ping measurement of any obstacles. When finished, it will save the data to the memory card, turn right 90 deg and move a distance along the baseline. It will then stop, rotate left 90 deg and repeat the scan from the new position, again saving the data. Once the data is saved the user can load the data into a plotting program (I used excel) to make a rudimentary map.
That program should show you how to ue the ping and servo bracket. Note that it was written a few years ago when I was learning how to program the activitybot, so could be cleaned up. I also noticed that it used an early version of the simpleide library so there is a function that no longer exists (I explain how to fix it in the thread), but that is only used for storing data to the SD card so that section could be removed.
Tom
Remove the SD card from the bot and put it in a PC card reader.
The SD file is a text file so you can import it into excel using "data", "get external data", "from text"
Position the data however you want. I think I just put it into 2 columns deg & distance, the second data set (after the bot traveled) is under the first.
Then just convert the degrees and distance into x & y .
Then adjust the second measurement's x to bring it to the same origin as the first data set. (just subtract the distance traveled by the bot between data sets.) Then plot the x & y data. You will get an approximation of the shape of the obstacles. Try playing with the distance traveled by the bot, and the plotting method and maybe the number of data sets to try to improve the detail of the map.
I'd like to see your results.
Tom
Included is my excel data analysis. Note the red plot is the first scan and blue plot is the second scan. Because the ABOT has traveled for 1m, I added the distance to the second scan's x column.
Thanks!
When I did my scans, I had placed a couple of rounded objects in the rectangular area to be mapped that was surrounded by cabinets. I subtracted the distance traveled from the x-reading of the second scan. This brought the origin of the 2 scans together and gave an indication of the shape of the objects since the ultrasound would hit different aspects of the objects. (the differences in the x-distances of each showed the approximate width of the object and the y-values showed its depth dimension.)
I took your spreadsheet and changed the +100 to -100 in the x calculation of the second set of data. It did bring one of the blue slanted lines together with part of the red slanted line (separated by about 10 to 20 cm).
What did the area mapped look like? If you subtract 100 from x does the map resemble the actual area?
Tom
I actually started my ABOT along the wall on the left side. In the first scan, ABOT ran near a cart on the left side and the cart's bottom was scanned in. The ABOT then moved out of cart's sight and it scanned the long wall instead. I think the part of the plot actually fall in the same line, same as yours:)