Skip to content
This repository has been archived by the owner on May 29, 2022. It is now read-only.

Missing data types for Python #68

Open
nicsalv opened this issue Mar 17, 2020 · 1 comment
Open

Missing data types for Python #68

nicsalv opened this issue Mar 17, 2020 · 1 comment

Comments

@nicsalv
Copy link

nicsalv commented Mar 17, 2020

Hi everyone,
I am trying to use the Python bindings of the GPS Toolkit, in particular the PRSolution class. I followed the swig/examples/example4.py in order to read my RINEX files and to compute the position solutions, and everything was fine.
Now, I would like to use the PRSolution.PreparePRSolution method so as to obtain the corrected pseudoranges without computing the position solution. However, I can not call this method because the argument types do not match.

In particular, the call is

raimSolver.PreparePRSolution(time, satVector, syss, rangeVector, ephStore, SVP)

and the error that raises is

TypeError: in method 'PRSolution_PreparePRSolution', argument 4 of type 'std::vector< gpstk::SatID::SatelliteSystem,std::allocator< gpstk::SatID::SatelliteSystem > > &' 

I know from the PYTHON.md file that the enumerations have been removed in the Python bindings, so I do not know how I could define the syss variable. After several trials, I tried

syss = [gpstk.SatID.systemGPS, gpstk.SatID.systemGlonass]

without success.

Then, I tried to use the PRSolution2 class; it has a similar method called PrepareAutonomousSolution that does not need the previous argument. I made the call

gpstk.PRSolution2_PrepareAutonomousSolution(time, satVector, rangeVector, ephStore, SVP)

and unfortunately another error raised

TypeError: Wrong number or type of arguments for overloaded function 'PRSolution2_PrepareAutonomousSolution'.
  Possible C/C++ prototypes are:
    gpstk::PRSolution2::PrepareAutonomousSolution(gpstk::CommonTime const &,std::vector< gpstk::SatID,std::allocator< gpstk::SatID > > &,std::vector< double,std::allocator< double > > const &,gpstk::XvtStore< gpstk::SatID > const &,Matrix< double > &,std::ostream *)
    gpstk::PRSolution2::PrepareAutonomousSolution(gpstk::CommonTime const &,std::vector< gpstk::SatID,std::allocator< gpstk::SatID > > &,std::vector< double,std::allocator< double > > const &,gpstk::XvtStore< gpstk::SatID > const &,Matrix< double > &)

I definitely think that the problem concerns the variable SVP, since the other ones have been previously used for the computation of the position solution.
Always from the PYTHON.md file, I know that the Matrix class is not wrapped so I do not know how to pass this argument. I tried with a list, a numpy array and even with the gpstk.seqToVector without success.
Furthermore, I do not know how the GPS Toolkit could return the filled SVP matrix since it is passed as argument. I saw that functions modifying parameters passed by reference are opportunely modified but this method still requires the matrix as an argument.

Looking at the source code of PRSolution, I came across the RAIMComputeSimple method, that is used in order to avoid using "data types not exposed in swig". Therefore, I wonder if there actually exist a way to make things work.

What am I doing wrong? Is there a way to call those functions in Python?
These are the only pieces of code where I found something that corrects the measured pseudoranges. If there are other way to do this, please let me know.

Thank you for your time, and for this great library.

@UT-dave
Copy link
Contributor

UT-dave commented Jun 11, 2021

There were a number of SWIG issues, many of which have been resolved recently. We plan to push a major update to the GPSTk later this summer, which solves numerous of these problems.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants