Shop OBEX P1 Docs P2 Docs Learn Events
Ping)))Dar - Radar Style Display — Parallax Forums

Ping)))Dar - Radar Style Display

snit3snit3 Posts: 12
edited 2012-01-05 10:32 in Robotics
Ping.jpg


I'm somewhat new to PBASIC and the Ping system and need some help. I've set up a Boe-Bot with a Ping module and loaded the software (named above in the Title) from the Parallax "Mini Projects" book link. I'm using a BS2 Stamp and haven't messed with the original code I downloaded, so timing shouldn't be an issue. The problem is this: The sweep display (with nothing in the field of view) looks like the jpg above. Notice that the edge of the scan field markers stop short of completing the final portion of the 180 deg scan on the left side. The sweep servo is accuratey calibrated, and the proper limit values updated in the code. The Ping is physically sweeping the full 180 deg arc. Everything works well escept for the missing portion of the DEBUG screen display! Can someone suggest why my "clear field" sweep display is not indicating a full 180 deg sweep?
1024 x 640 - 29K

Comments

  • Martin_HMartin_H Posts: 4,051
    edited 2012-01-04 17:17
    I did the Ping))) dar a while back. If I recall correctly the ping always returns a distance, so when there is no object at all it returns a distance of as far as possible. This displays as a semi circle like you have. If you put an object in the field it should show up as a dent in the circle.

    When using the Ping))) normally you care about objects closer than a threshold, so this isn't a problem.
  • JLockeJLocke Posts: 354
    edited 2012-01-04 18:20
    I think his question was why does the semi-circle not display a full 180-degree sweep when the servo is sweeping through a 180-degree turn?

    Questions for snit3: are you sure the ping is sweeping a FULL 180? Is the missing segment from the beginning or the end of the servo rotation?
  • JLockeJLocke Posts: 354
    edited 2012-01-04 18:34
    I guess the question is why does the plot not look like this? (not from an experiment; I Photo-shopped his plot posted above).

    PingPlot.png


    Of course, now that I look at it, another question comes to mind... have you examined the actual data points returned from your sweep? Maybe the left-hand portion just isn't being plotted? (i.e., maybe the plot X-axis needs to slide to the right).
    1024 x 640 - 88K
  • Martin_HMartin_H Posts: 4,051
    edited 2012-01-04 18:43
    JLocke, I reread his post and you are correct. I am not sure why his arc is truncated as I did this so long ago. I would guess it is related to PBASIC 8 bit trig and integer math.
  • snit3snit3 Posts: 12
    edited 2012-01-05 07:30
    JLocke wrote: »
    I think his question was why does the semi-circle not display a full 180-degree sweep when the servo is sweeping through a 180-degree turn?

    Questions for snit3: are you sure the ping is sweeping a FULL 180? Is the missing segment from the beginning or the end of the servo rotation?


    Yes. The ping is "physically" sweeping the full 180 deg, but I just noticed something new. If I place an object at the extreme 180 deg position on the right side of the sweep it shows up perfectly positioned on the display. However, if I put the object on the extreme left side it doesn't show at all even though the ping is looking right at it. I have to move the object 15 or 20 deg away from left side of the arc before it's shown in the display. That's exactly where the arc in my jpg picks up.

    Is it possible that the math is producing a non-linear representation of the actual, physical arc of the ping servo? In other words, the data points toward the left side of the field are compressed relative to those on the right, and that's why the displayed arc is truncated on the left? My head hurts...
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-01-05 07:39
    snit3,

    Could you post either a link to the code you're using or the code itself?

    It looks like this should be something relatively easy to fix.
  • snit3snit3 Posts: 12
    edited 2012-01-05 09:52
    Duane Degn

    Here's the link to the text. The project "Ping)))Dar is # 10 in the index. https://www.parallax.com/portals/0/Downloads/docs/prod/sic/Web-122-28100-SicMiniProjects-v1.0.pdf

    *******CASE CLOSED - I figured it out and, of course, it was my error. The "PingDirToAngle CON" needed to recalculated to account for my servo calibration numbers. I changed the right and left limit CON's, but forgot to change the scaling! That's why the sweep was short. Whew!


    Thanks for all your input on this. It's really a learning experience!
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-01-05 10:32
    I don't have the hardware for this project set up myself but I have two suggestions to offer.

    First try changing the line:
    DEBUG CRSRXY, 50 + x, 25 - y, "*"
    

    to:
    DEBUG CRSRXY, [B][COLOR=#ff0000]56[/COLOR][/B] + x, 25 - y, "*"
    

    If that does do the trick then use:
    DEBUG CRSRXY, 50 + x, 25 - y, [B][COLOR=#ff0000]x[/COLOR][/B]
    

    To see what the lowest value of x is being displayed.

    If the first fix doesn't work, let us know if it looks different and let us know what the lowest value displayed for the variable "x" is (using the second change).

    Edit: If the first suggestion works, you'll also need to change the "X" at the origin.
Sign In or Register to comment.