Closed Jaeyoung-Lim closed 3 years ago
As can be seen here we actually pass the log as a relative path and then in the function automatically uses the current working directory to generate the needed absolute path to interface with the pyulog library to load the ulog. Not sure if it is possible to pass a relative path to the library.
As far as I know the os.getcwd() function gets the current working directory from an environmental variable. Could it be that you somewhere change this variable in your process to /home/jaeyoung
? As far as I know we should not expect a different behaviour of this method between ubuntu 20.04 and 18.04.
Furthermore I have tried to run the application without the virtual environment and it still works for me. So we can exclude that as a source of the error.
@manumerous I have always been running the script from the root of the repo (never cd-ing into the parametric_model directory).
Does it work for you this way? Can you also not reproduce it when using the docker environment?
The problem is that currently the code takes the current working directory, goes back two directories and then searches the logs relative from there. As can be seen in code.
Therefore it fails when the python script is run using the Makefile, because the project directory will be the current working directory.
In contrast it works when directly calling the script using e.g. python3 generate_parametric_model.py simple_quadrotor_model logs/2021-04-12/14_28_28.ulg
, because in that case the current working directory will always be the directory where generate_parametric_model.py
is in regardless from where the script is called.
I guess we should either converge on one way of running the script or adapt load_ulog() to check for this. I think it would be good to do the latter anyways. But the former also makes sense.
@manumerous Okay now it makes more sense.
The script is assuming that the "current" directory is somewhere in the project. While it should always take the relative directory to where the user is running the directory (unless it is an absolute path).
Therefore, a more correct path is
python3 generate_parametric_model.py simple_quadrotor_model ../../logs/2021-04-12/14_28_28.ulg
Since the logs directory is not under the parametric_model directory
Problem Description When running trying to process a log, the log is passed as an absolute path, which just adds inconvenience of typing more of the path
Expected Behavior Be able to use relative paths since the logs directory is a symbolic link inside the repository