![]() |
Quote:
|
Quote:
|
Hmm, well thats a bit more simple than I thought... however, I was more concerned about no information coming over because of a radio failure between the robot and the oi or some interfereance...
Quote:
|
actually dan, before you even posted that, or at least before i read that last post, that's what i just did. hopefully it will work...
|
I'd think so...
If not, here's the code I used. It takes the cross between two consecutive packets, but it really doesn't matter since the refresh rate is much higher than the eye could ever detect. Code:
int i; |
ahhhh, now I see what you were talking about all along!
Just I don't like the fact that you overlap 2 packets into one... yeah it's too high to pick up, but just so I know I have an understanding of packets, this code would make it get the full packet, right? Code:
int i; |
Looks good. It should also align the data for all subsequent reads, making it a little bit faster. Just make sure start isn't equal to 0 before you go into that last block of code, as I don't know how VC++ deals with arrays of size 0 or how ReadFile deals with requests of length 0. Might be OK, might cause page faults; you never know 'til you try.
I definately agree that overlapping two packets isn't ideal, but I was too lazy to change it after I realized that was what it was doing (I wrote the algorithim around 3am last year in Florida and wasn't quite thinking right). |
When I wrote my dashboard viewer, I took a bit different take on how to read in the data. I did read in everything one byte at a time. Once I received two 255's, I then started a count. Given the value of the count, I determined what data I was actually reading in. Given that, I processed the data into a structure (ie the structure was updated everytime through the loop which means everytime a byte was read). Then, once the count reached the end of data, I updated the display.
As far as speed issues go, there is no problem reading in a byte at a time. Remember, the data will only be coming at you 20 times per second (20 Hz) which is something a computer can easily process. Matt |
one quick problem/question...
is it in anyway possible to loose a byte or two between reads? i'm doubting that, because of what i've heard, but it's something that's probably useful to know :p. |
theoretically, yes. Probably, no. The only way you could loose a byte is if the PC's buffers overflow, and the only way I can imagine this happening is if you do a lot of time-consuming work between reads.
|
What about if there's a break or interfereance in the radios between the robot and the oi?
|
The OI should continue sending data even if there's a break between radios. It will only stall in between packets (ie all 26 bytes); that's because it doesn't have all the data to send.
Matt |
so, theoretically, the OI will only send a complete packet, so the only way to get a partial packet is to unhook the cable from the dashboard port? that seems to make the most sense to me, so i'll go with that. also, that would mean we don't need to elaborate on some huge thing to crack down on missing packets and ignore them so they don't screw up the computer. makes everything a bit easier :D.
|
| All times are GMT -5. The time now is 22:53. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi