1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

GPS controlled NMEA DATA following tracker

Discussion in 'Oshonsoft' started by camerart, Dec 27, 2015.

  1. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,315
    Likes:
    11
    Location:
    Dorset UK.
    Hi J,
    If I enter a variable to be 19.9 and it makes it 19.899999, then in a program 19.9 does not = 19.899999. Is this is important? I even tried making it 19.900001 and it made it 19.900001.

    In this case I can round it up to 20. Should I do that or try to get it correct?

    C.
     
  2. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,180
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi C,
    IIRC correctly we were using a WORD variable for 3599, which infers a resolution of only 1 Bit , equivalent to 0.1 Degree.

    Also the Yagi aerial, which is tracking the Remote transmitter, has a beam width of approx 8 degrees, why do you think a better than 1 degree dead band/zone is required.?

    Eric
     
  3. jjw

    jjw Member

    Joined:
    Apr 16, 2012
    Messages:
    258
    Likes:
    15
    Location:
    Helsinki, Finland
    You can't get it correct due to rounding errors in the single variables, but you can test if they are almost equal by calculating the difference being smaller than some value.

    For example testing if a is within 0.1 of b:

    If a<b Then
    difference = b-a
    Else
    difference=a-b
    Endif

    If difference < 0.1 Then
    eq= 1
    Else
    eq=0
    Endif


    Or simpler:
    difference = a-b
    eq=0
    If difference <=0.1 and difference >= -0.1 Then
    eq = 1
    Endif
     
    Last edited: Jan 13, 2016
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,315
    Likes:
    11
    Location:
    Dorset UK.

    Hi Eric,

    I think you introduced the SINGLE type variable to take care of negative numbers, but I'm not certain. As the little equasion that avoids negative numbers is now being used, I asume I can go back to WORD values.

    I recently found that the previously thought 100:1 gearbox, has a 99.5:1 ratio, so 3599 is now 3581.

    The resolution of the tracker is from the AXXX input which is 1 degree accuracy then x9.95. I am trying to get the DEADBAND to be 3 degrees wide which is 9.95 each side of the SETPOINT.

    C.
     
  6. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,315
    Likes:
    11
    Location:
    Dorset UK.
    Hi J,

    Ok, thanks.

    Is it not advised then to put If A=B, if one of them could have been rounded up by 0,000001, when in fact they are really the same?

    C.
     
  7. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,315
    Likes:
    11
    Location:
    Dorset UK.
    Eric,

    Woke up this morning recalling that SINGLEs are used for (brackets) :)

    I need SINGLES for adding the wider DEADBAND. The program has changed since you used WORDs when you wrote it.

    C.
     
  8. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,180
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi C,
    Not sure what that means?o_O

    Looking at the 3581 and 3599, that's a 0.01% percent error in a 360 degree rotation.

    As IIRC, your tracking Head is not capable of a continuous circular rotation, the 0.01% error is not cumulative.

    Your 8 degree beam width Yagi can acquire the Remote signal within say, +/-4degress, which is approx +/-1% of a full rotation.

    IMHO you are making the band/zone over complicated.

    Have you carried out the 'tests' we discussed, using a weight/mass equal to the Head assembly and cabling.?
    [ or with the complete final Head assembly mounted on a tripod]

    When doing this doing this test, what was the measured angular error.?
    ie: input Azimuth angle compared to the Actual angle the Head came to rest.??

    E
     
  9. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,315
    Likes:
    11
    Location:
    Dorset UK.
     
  10. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,315
    Likes:
    11
    Location:
    Dorset UK.
    Hi,
    Trying to add a DEADBAND and following a suggestion to make a kind of 24hour clock around the 3581 to 0 and 0 to 3581 point, so that a DEADBAND doesn't hit a jump. I've been trying this:
    EDIT:
    poscalc = poscnt
    azcalc = azimval


    If poscalc <= 49.75 Then '=5 DEG
    If azcalc >= 3532.25 Then '=355 DEG
    poscalc = poscalc + 3582
    Endif
    Endif
    If azcalc <= 49.75 Then '=5 DEG
    If poscalc >= 3532.25 Then '=355 DEG
    azcalc = azcalc + 3582
    Endif
    Endif

    If poscalc <= 49.75 Then '=5 DEG
    If azcalc <= 49.75 Then
    poscalc = poscalc + 3581
    azcalc = azcalc + 3582
    Endif
    Endif

    azminus = azcalc - dband 'test with smaller deadband ################
    azplus = azcalc + dband

    It nearly works, apart from AZIMVAL 359, and I've got tangled up in the spaghetti of it. If someone can see through my error, as I can see it could be 'simplified' I'd appreciate it.

    C
     
    Last edited: Jan 28, 2016
  11. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,315
    Likes:
    11
    Location:
    Dorset UK.
    Hi,
    Here are the latest files for the project. They all work in a test rig, so next to finalise them all, try them in the Tracker and comment them better.
    I WILL UPDATE THE FILES HERE AS I UPDATE THEM!
    Camerart.
     

    Attached Files:

    Last edited: Aug 23, 2016
  12. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,315
    Likes:
    11
    Location:
    Dorset UK.
    Apologies for keep changing the title, but I hope that's the last time.
    C.
     
  13. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,315
    Likes:
    11
    Location:
    Dorset UK.
    Hi,
    Here's the reply regarding a superfluous line in my program:
    ((hi,
    That basecos is equivalent to latcos1, so its now redundant.

    'extract from your listing
    latrad1 = 50.662341 / 57.295779
    lonrad1 = 1.591347 / 57.295779
    latcos1 = Cos(50.662341).???? degrees !

    ''Note:
    latcos1 = cos(50.662341/57.295779) ' REM Rads !! == 0.884224665 ==latrad1

    E

    You have lots of free RAM))

    REPLY: Hi Eric,
    I removed the BASECOS line, but it gave wrong readings in test, So I replaced it and it is working again?????
    I can't see LATRAD1, LONRAD1 LATCOS1 in my program?
    I've updated the 18F4520 program in POST #30. This works ok, and is sometimes 1 degree out due to rounding.
    There is still a problem with reset, as in the: http://www.electro-tech-online.com/threads/reset-on-18f4520.148815/ thread.
    C.
     
    Last edited: Aug 23, 2016
  14. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,180
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi,
    It that program you are using the prefix 'base' for the Lat/Lon of the Base station reference, in earlier programs we used
    Lat1, Lon1 as the 'base' and Lat2, Lon2 as the 'remote'
    Why did you ask me 'is the code basecos required.???

    E
     

    Attached Files:

    • A01.gif
      A01.gif
      File size:
      46.4 KB
      Views:
      68
  15. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,315
    Likes:
    11
    Location:
    Dorset UK.
    Hi Eric,
    I'm pretty slow working through the programs and testing them, sometimes with the tracker and sometimes each PIC individually in separate circuit boards. Each time I change something in the program, that works ok, I try to keep the files updated in post #30.
    Regarding the basecos line, I couldn't see how it worked, as it is before getting the GPS input. It appears that it is needed though. (I see why your puzzled:))
    Anyway, the latest 18F4520 program is working on the test circuit, apart from the reset problem, which always sorts itself out after a couple of restarts? I'm trying different things.
    C.
     
  16. ericgibbs

    ericgibbs Well-Known Member Most Helpful Member

    Joined:
    Jan 4, 2007
    Messages:
    21,180
    Likes:
    644
    Location:
    Ex Yorks' Hants UK
    hi C,
    The lines of Latitude around the planet are 15 degrees for every hour of time difference.

    Assuming the Earth circumference at the Equator is say 40,000 km
    If you divide 40,000km by 360 degrees you get 111.11km distance per degree at the Equator.

    At 50Deg North of the Equator [ ie the ~UK] the distance for 1 degree is no longer 111.11km. [ it is shorter]

    So we have to use the Cosine of 50deg to calc the actual East/West distance for our location and the Cosine of the remotes East/West location, so that we can calc the Azimuth and Distance from our location to the remote location.

    Do You follow OK.?
    E
     
  17. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,315
    Likes:
    11
    Location:
    Dorset UK.
    Hi E,
    Thanks for the explanation, I follow.
    Thinking that the basecos line was in the wrong place, I moved it down into the 'loop', so that it can do it's calculation properly. I also moved my push button section.
    I have updated the 18F4520 program again in post #30, with these changes.
    This appears to have solved what I have been calling the 'reset problem' too.
    I have run tests in circuit and it looks as though the program is now working ok. (Further tests, to make sure:))
    C.
     
  18. camerart

    camerart Active Member

    Joined:
    Jun 12, 2008
    Messages:
    1,315
    Likes:
    11
    Location:
    Dorset UK.
    Removed
     
    Last edited: Apr 4, 2017

Share This Page