×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

libnova deprecated...

  • Posts: 34
  • Thank you received: 2
Hello everyone, I wanted to compile some older files with libnova for a Telescope driver... but I got the following error: 'lnobserver' was not declared in this scope

on the INDI forum there is this note:

Do not use libnova directly since it uses different conventions which…might cause issues in INDI drivers if not accounted for carefully. To avoid driver authors making such mistakes, the coordinate transformation functions were ported to libastro. All the functions use INDI standard units

what do I do now???
Matthias
1 year 2 months ago #90827

Please Log in or Create an account to join the conversation.

  • Posts: 111
  • Thank you received: 41

Replied by Thomas Stibor on topic libnova deprecated...

GIT checking out INDI core and grepping:
$ grep -r "libnova" .
./libs/indibase/indiccd.cpp:#include <libnova/julian_day.h>
./libs/indibase/indiccd.cpp:#include <libnova/precession.h>
./libs/indibase/indiccd.cpp:#include <libnova/airmass.h>
./libs/indibase/indiccd.cpp:#include <libnova/transform.h>
./libs/indibase/indiccd.cpp:#include <libnova/ln_types.h>
./libs/indibase/indidome.cpp:#include <libnova/julian_day.h>
./libs/indibase/indidome.cpp:#include <libnova/sidereal_time.h>
./libs/indibase/indidome.cpp:#include <libnova/transform.h>
./libs/indibase/indicorrelator.cpp:#include <libnova/julian_day.h>
./libs/indibase/indicorrelator.cpp:#include <libnova/ln_types.h>
./libs/indibase/indicorrelator.cpp:#include <libnova/precession.h>
./libs/indibase/indispectrograph.cpp:#include <libnova/julian_day.h>
./libs/indibase/indispectrograph.cpp:#include <libnova/ln_types.h>
./libs/indibase/indispectrograph.cpp:#include <libnova/precession.h>
./libs/indibase/indisensorinterface.cpp:#include <libnova/julian_day.h>
./libs/indibase/indisensorinterface.cpp:#include <libnova/ln_types.h>
./libs/indibase/indisensorinterface.cpp:#include <libnova/precession.h>
./libs/indibase/inditelescope.h:#include <libnova/julian_day.h>
...
...
./drivers/telescope/synscandriverlegacy.cpp:#include <libnova/utility.h>
./drivers/telescope/lx200gotonova.cpp:#include <libnova/transform.h>
./drivers/telescope/ioptronv3driver.cpp:#include <libnova/julian_day.h>
./drivers/telescope/astrotrac.cpp:#include <libnova/sidereal_time.h>
./drivers/telescope/astrotrac.cpp:#include <libnova/transform.h>
./drivers/telescope/lx200classic.cpp:#include <libnova/transform.h>
./drivers/telescope/synscandriver.cpp:#include <libnova/transform.h>
./drivers/telescope/synscandriver.cpp:#include <libnova/precession.h>
./drivers/telescope/synscandriver.cpp:// libnova specifies round() on old systems and it collides with the new gcc 5.x/6.x headers
./drivers/telescope/synscandriver.cpp:#include <libnova/utility.h>
...
...
you see libnova is all over the place and used in most of the cpp/h files.

Apt-sourcing lib-nova and checking for "lnobserver" reveals, there exists no such function:
$ apt source libnova && cd libnova-0.16 && grep -r "lnobserver" .

There exists however, the C
struct ln_lnlat_posn
Which is frequently used as follows in libnova source:
$ grep -r "struct ln_lnlat_posn *observer" .
./examples/transforms.c:	struct ln_lnlat_posn observer;
./examples/lunar.c:	struct ln_lnlat_posn observer;
./examples/mars.c:	struct ln_lnlat_posn observer;
./examples/sun.c:	struct ln_lnlat_posn observer;
./examples/comet.c:	struct ln_lnlat_posn observer;
./examples/asteroid.c:	struct ln_lnlat_posn observer;
./lntest/test.c:	struct ln_lnlat_posn observer, ecl;
./lntest/test.c:	struct ln_lnlat_posn observer;
./lntest/test.c:  	struct ln_lnlat_posn observer;
./lntest/test.c:	struct ln_lnlat_posn observer;
./lntest/test.c:	struct ln_lnlat_posn observer;
./lntest/test.c:  	struct ln_lnlat_posn observer;
1 year 2 months ago #90842

Please Log in or Create an account to join the conversation.

  • Posts: 34
  • Thank you received: 2
Hallo Thomas, vielen Dank für Deine doch aufwendige Mühe. Leider bin ich nicht so firm in C und darauf angewiesen, dass mir von kompetenter Seite bei solchen Dingen geholfen wird. Ich würde gerne das compiling des Treibers hinbekommen... würde es denn reichen die Variable einfach zu definieren um den Fehler zu beseitigen? z.B. als double? ok, ich weiß klingt laienhaft. Trotzdem Danke nochmals, wie es scheint ist es nicht unbedingt das Problem...Matthias
Hello Thomas, thank you for your time-consuming effort. Unfortunately, I'm not so proficient in C and rely on someone competent to help me with such things. I would like to compile the driver... would it be enough to simply define the variable to eliminate the error? e.g. as a double? ok, i know sounds amateurish. Anyway, thanks again, it doesn't seem to be the problem...Matthias
1 year 2 months ago #90846

Please Log in or Create an account to join the conversation.

  • Posts: 111
  • Thank you received: 41

Replied by Thomas Stibor on topic libnova deprecated...

We found the problem. The INDI driver uses in one method the call:
get_hrz_from_equ(&equ_t0, &lnobserver, jd, &hor);
In commit:
 
commit 7488e284ee58e4b78c33eea554d5a3c63f919764
Author: Jasem Mutlaq <mutlaqja@ikarustech.com>
Date:   Sat May 22 04:56:26 2021 +0300
 
    Do not use libnova directly since it uses different conventions which might cause issues in INDI drivers if not accounted for carefully. To avoid driver au
thors making such mistakes, the coordinate transformation functions were ported to libastro. All the function use INDI standard units
 
diff --git a/libs/indibase/inditelescope.h b/libs/indibase/inditelescope.h
index 171a48bee..9ce9106f1 100644
--- a/libs/indibase/inditelescope.h
+++ b/libs/indibase/inditelescope.h
@@ -19,7 +19,7 @@
 #pragma once
 
 #include "defaultdevice.h"
-
+#include "libastro.h"
 #include <libnova/julian_day.h>
 
 #include <string>
@@ -637,10 +637,8 @@ class Telescope : public DefaultDevice
          */
         TelescopePierSide expectedPierSide(double ra);
 
-        // helper functions
-        double getAzimuth(double r, double d);
-
-        ln_lnlat_posn lnobserver { 0, 0 };
+        // Geographic Location
+        IGeographicCoordinates m_Location { 0, 0, 0 };

the helper variable
ln_lnlat_posn lnobserver { 0, 0 }
is removed and replaced
by
IGeographicCoordinates
, where
struct ln_lnlat_posn {
    double lng; /*!< longitude. Object longitude. */
    double lat; /*!< latitude. Object latitude */
};

and
typedef struct
{
    double longitude; /*!< Longitude in degrees (0 to 360 eastward.)*/
    double latitude;  /*!< Latitude in degrees (-90 to +90) */
    double elevation; /*!< Elevation from Mean Sea Level in meters */
} IGeographicCoordinates;

As the variable lnobserver is not further used in the code, adding the line:
struct ln_lnlat_posn lnobserver;
before the call
get_hrz_from_equ(&equ_t0, &lnobserver, jd, &hor);

solves the problem.
The following user(s) said Thank You: Gonzothegreat
1 year 2 months ago #90851

Please Log in or Create an account to join the conversation.

  • Posts: 34
  • Thank you received: 2
Hi Thomas, thanks a lot, it works!! you saved my day! Matthias
1 year 2 months ago #90877

Please Log in or Create an account to join the conversation.

Time to create page: 0.224 seconds