Welcome to gadgetPool.de!
gadgetPool
Homepage
Projekt veröffentlichen
Artikel schreiben
Projekte lesen
Artikel lesen
Forum
Diskussionen Ideen Vorschläge
Downloads
Treiber Dateien Datenblätter
Anmeldung
Passwort Mail Einstellungen

     Menue
WebShop
Hier gibt's die gadgets

     Languages
Sprache für das Interface auswählen

English German

     Login
Benutzername

Passwort

Kostenlos registrieren!. Gestalten Sie Ihr eigenes Erscheinungsbild. Passen Sie das Seitenlayout Ihren Wünschen an

gadgetPool.de: Forum

gadgetPool.de :: View topic - How to filter bad SeaTalk Data?
 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile   Log inLog in 

How to filter bad SeaTalk Data?

 
Post new topic   Reply to topic    gadgetPool.de Forum Index -> Seatalk NMEA Bridge
View previous topic :: View next topic  
Author Message
jferguson
Master
Master


Joined: May 20, 2011
Posts: 17
Location: US East Coast

PostPosted: Wed Aug 15, 2012 5:22 pm    Post subject: How to filter bad SeaTalk Data? Reply with quote

Problem is my project keeps track of maximum windspeed and least depth. If software reads SeaTalk wind datagram as 60Knots and this is wrong, my max windspeed will now show 60Knots even though it never happened. Same thing with depth, only it might show 0, which is impossible.

Depth seems easy to fix - maybe throw out any reading more than 2 feet higher or lower than previous reading. this would clean out readings of fish.

it might cause me to lose a correct reading but would be corrected on later readings.

Problem is with windspeed. a gust might last only a few seconds. And I would want to record it. With the SeaTalk depth and Anemometer, i get 3 SeaTalk datagrams which at 4800 bps with some delays cycle at about 1 Hz.

If I read Seatalk for 4 seconds, look at the wind data and throw out any reading which is very different from the others, will this work? Is it even a good idea?

Frank's code appears to validate datagrams by length, if the length isn't correct than it ignores it.

Is there any other way to validate datagrams for depth, wind direction and wind speed - the only ones i need? Maybe Frank's way is the best Very Happy Very Happy
Back to top
View user's profile Send private message
jferguson
Master
Master


Joined: May 20, 2011
Posts: 17
Location: US East Coast

PostPosted: Thu Aug 16, 2012 2:03 pm    Post subject: Reply with quote

I think I can do something like what Frank did in his code. I've added a boolean errorflag which is set if the seatalkread routine comes to start of next datagram string without having seen all the bytes on the previous datagramstring. For those familiar with SeaTalk, I only have 3 datagrams on my setup and they always show up in same sequence so I look for command byte for depth, then read depth,windangle, and winspeed as one string. If any of the three datagrams is short, the total length will be short, I set the errorflag, don't use that data, and read until I get another complete datagram string.

This won't protect from a 1 foot depth, which could be from a fish. So for depth I'll compare reading to average of last three readings and throw it out if it's off by more than maybe 30%.

I still don't know what to do about wind, maybe same thing which would mean that a windspeed reading which wasn't held for more than 2 seconds would be ignored.

Anyone have any other ideas, or want to see the code?
Back to top
View user's profile Send private message
jferguson
Master
Master


Joined: May 20, 2011
Posts: 17
Location: US East Coast

PostPosted: Sat Aug 18, 2012 5:40 pm    Post subject: Here's what i did and it seems to work Reply with quote

First thing was to add an errorflag line which dropped any 3datagram-sentences which were not the right length of 12 bytes.

Code:
void readSeaTalk()

{
  if (Serial.available ())
   { inbyte = (Serial.read());
     if (inbyte == 0x100)
     if (!(pointer = 12)) //attempt at error filtering 8/17/12 jaf
     errorflag = 1 ;
     else
     pointer = 0 ;

     if (!(errorflag)) {
     printwind = wind ;
     printangle = angle ;
     printdepth = depth ;
     }
 /* Code above reads SeaTalk Stream and starts inbyte buffer when
    9th bit and first byte of depth sentence (command byte)come in. 
    On my system with two talkers, ST40 depth and wind, the datagrams
    follow each other in sequence so it's easy to pick out the
    bytes needed to derive wanted data - always in same place */
   
   SeaTalkData[pointer++] = inbyte ;
 
   wind = ((SeaTalkData[11] & 0x7f) + SeaTalkData[12]/10.0) ;
   angle = (makeWord(SeaTalkData[7] , SeaTalkData[8]))/2 ; 
   depth = (makeWord(SeaTalkData[4] , SeaTalkData[3])) / 10.0 ;
 
   
   }
}


I didn't have any more problems with crazy windspeeds so didn't need any filter for that.

Then I did this for crazy depths. Depth sounder can see a fish and show a depth of 1 foot. it is a real reading, but i don't want it because i'm more interested in the boat grounding, so I did this:

Code:

void processdata()
{
    winddir = (heading + printangle) ;
   if (winddir > 360)
     winddir -= 360 ;
   if (printwind > highwspeed)
      highwspeed = printwind ;
   //routine to filter out goofy leastdepths 8/17/12 jaf
    depth3 = depth2 ;
    depth2 = depth1 ;
    depth1 = depth ;
   
   if (!(depth < (.8*((depth3 + depth2 + depth1) /3))))     
   { if (  depth < leastdepth)
     leastdepth = depth ;
     }
}



Comments or criticisms are welcome.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    gadgetPool.de Forum Index -> Seatalk NMEA Bridge All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001-2003 phpBB Group
phpBB port v2.0.7 based on Tom Nitzschner's phpbb2.0.6 upgraded to phpBB 2.0.7 standalone was developed and tested by:
ChatServ, mikem,
and Paul Laudanski (aka Zhen-Xjell).

Version 2.0.7 by Nuke Cops © 2004 http://www.nukecops.com
Forums ©




All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © 2006-2015 by gadgetPool.


PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Erstellung der Seite: 0.17 Sekunden