Re: Displaying data graphically (Ultrasonic radar)
Hi GremlinSA, thanks to your explanations and article I finally understood the concept of double buffering (or at least I think so :)).
However I the program is still running slow :/
I have tried your method of drawing as you wrote on your last post but the scan line went really funny and the speed was the same as it was before.
Do you mind having a look at my code and see if I missing something? I'd really appreciate that!
Thanks in advance! :)
Re: Displaying data graphically (Ultrasonic radar)
Do me a Favor ...
Zip the entire project directory, Delete the Debug and Release folders from the zip (as those are recreated each time you debug or build)..
Post it here (use the advanced posting page and use the Manage Attachments button lower down to attach the zip...) and i will download it and go through it...
Only problem is that i dont have the Serial Device, but i'll try a serial loop to pump the data through...
Re: Displaying data graphically (Ultrasonic radar)
Hi GremlinSA, I have fixed the problem which was slowing my system down - I was reading one character at a time, invoking the GUI, coming back, reading another character, invoking the GUI thread, etc. So it was taking a fair amount of time switching threads back and forth for every character.
My system now is (almost) fully working, but I have another question for you though. I am now trying to display the detected objects (little circles or squares).
I can display them fine, however I can only display one at each angle (the current position). How can I draw, let's say, 5 dots and then only after 5 the last one gets erased?
To draw them I just added e.Graphics.FillEllipse(Brushes.Red, 0, radius, 5, 5) to the end of PictureBox1_Paint subroutine.
Thanks in advance!
Re: Displaying data graphically (Ultrasonic radar)
Add another vector, in the inverse color, to erase the one BEFORE the current one. Erase one, then draw the next, in the same cycle
Re: Displaying data graphically (Ultrasonic radar)
This is where layering images comes to play.. If you look at the next article in the series it describes simply how to overlap images.. (you may need to read the linked VB6 article to understand the process better)
So in this case you have your base image that is the Sonar Grid.. This image remains static and is drawn onto the buffer at the start of each frame..
Next you store the last 10 (or how ever many you like) scans and redraw all of them onto a new image.. set the transparency, and then draw it onto the buffer..
if you want you could even draw each previous dot in a lighter colour giving it that same Diminishing effect from real radars..
Re: Displaying data graphically (Ultrasonic radar)
Hi all,
Just passing by to say that I've finished my project.
Thank you very much for your help :)
Re: Displaying data graphically (Ultrasonic radar)
Quote:
Originally Posted by
Alex83UK
Hi all,
Just passing by to say that I've finished my project.
Thank you very much for your help :)
Dear Alex83UK, Could you share the source code for reference?
my email: dominhson.vtv@gmail.com