ms-van3t-devs / ms-van3t

A multi-stack, ETSI compliant, V2X framework for ns-3.
GNU General Public License v2.0
102 stars 33 forks source link

Waiting for OpenCDA Control Interface to be ready. #29

Closed brianach closed 3 months ago

brianach commented 3 months ago

Hi again guys,

I've installed ms-van3t on a new PC with i9 CPU and Nvidia RTXA4000. I had to install Carla manually but it loads fine when I run one of the examples. However OpenCDA still doesn't load. I checked the 'opencda_output.txt' file and found the following. sh: 1: */bin/python3: not found When I type python3 in a terminal it runs fine so I don't know why OpenCDA is not seeing it. Any ideas?

Brían

carlosrisma commented 3 months ago

Hi @brianach,

from the output I don't understand if you are using a conda environment or not. In any case, what are you specifying in the CARLA-OpenCDA.conf as Python interpreter? Consider that the carla python package for version 0.9.12 is only available for Python 3.7. If you are setting as python interpreter /bin/python3 then you should try with just python3 or the default python3.7.

Carlos

brianach commented 3 months ago

Hi Carlos,

I specified conda during the installation. Here is the line from the config file Python_Interpreter=/home/ctrl-adm/anaconda3/envs/msvan3t_carla/bin/python3

Brían

brianach commented 3 months ago

Getting a bit further but failing on this error ..... OpenCDA Version: 0.1.3 Traceback (most recent call last): File "opencda.py", line 78, in <module> main() File "opencda.py", line 62, in main "opencda.scenario_testing.%s" % opt.test_scenario) File "/home/ctrl-adm/anaconda3/envs/msvan3t_carla/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 677, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 728, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home/ctrl-adm/ms-van3t/ns-3-dev/OpenCDA/opencda/scenario_testing/ms_van3t_example.py", line 13, in <module> from opencda.scenario_testing.utils.ms_van3t_cosim_api import MsVan3tCoScenarioManager File "/home/ctrl-adm/ms-van3t/ns-3-dev/OpenCDA/opencda/scenario_testing/utils/ms_van3t_cosim_api.py", line 14, in <module> from google.protobuf import empty_pb2 ModuleNotFoundError: No module named 'google'

brianach commented 3 months ago

Hj @carlosrisma ,

I decided to reinstall Ubuntu and start again from there. I followed the instruction and everything seems to be set up correctly. When I run ./ns3 run "v2v-carla-80211p" or ./ns3 run "v2v-carla-nrv2x" I get 'Exception: Couldn't find the specified program: .... '

I decided to run "./sandbox_builder.sh" again in the ns-3-dev folder without the attributes as this isn't the first install having already run "./sandbox_builder.sh install-dependencies" during the initial install. This time another ns-3-dev folder was created inside the existing ns-3-dev folder.

When I run in the first ns-3-dev folder I get the same error as above and if I run it in the sub ns-3-dev folder I get "CMake Error: The current CMakeCache.txt directory /home/ctrlrm-adm/ms-van3t/ns-3-dev/ns-3-dev/cmake-cache/CMakeCache.txt is different than the directory /home/ctrlrm-adm/ms-van3t/ns-3-dev/cmake-cache where CMakeCache.txt was created. This may result in binaries being created in the wrong place. If you are not sure, reedit the CMakeCache.txt"

I'm a step further back since last week now and I have run out of ideas. Could you advise what I might be doing wrong. During the install I selected conda as the python package.

Brían

carlosrisma commented 3 months ago

Hi @brianach,

Just for me to understand your steps, from a clean Ubuntu installation you cloned the repo, and did ./sandbox_builder.sh install-dependencies. Then I guess that you executed, from the ns-3-dev folder, ./switch_ms-van3t-CARLA.sh for which I'm not sure from your description if you installed CARLA and OpenCDA with the script or on your own. Then you say that from ns-3-dev you ran again the sandbox_builder.sh which would sort of duplicate the ns-3 installation inside itself that is why you get the error. Now, if you are getting 'Exception: Couldn't find the specified program: .... ', my suspicion is that you didn't run the switch_ms-van3t-CARLA.sh, am i right ?
At this point I would suggest you do the following, go to your home directory (the one from which you cloned the repo) and do the following in terminal:

  1. rm -rf ms-van3t
  2. git clone https://github.com/ms-van3t-devs/ms-van3t.git
  3. ./sandbox_builder.sh install-dependencies
  4. cd ns-3-dev
  5. If you already have a CARLA installation, inside the ms-van3t/ns-3-dev/ folder create a file called CARLA-OpenCDA.conf and write CARLA_HOME=/path/to/CARLA_0.9.12 replacing 'path/to' with you are actual full path.
  6. ./switch_ms-van3t-CARLA.sh
  7. ./ns3 configure --build-profile=optimized --enable-examples --enable-tests --disable-python --disable-werror
  8. ./ns3 build
  9. ./ns3 run v2v-carla-80211p

Hope this works, let me know. If I manage to find some free time I'll make a video showing the installation steps and post the youtube link in the readme and documentation.

Carlos

brianach commented 3 months ago

Hi @carlosrisma ,

thanks again for the quick reply. I should have been clearer. After reinstalling Ubuntu I did these steps first:

  1. git clone https://github.com/ms-van3t-devs/ms-van3t.git
  2. ./sandbox_builder.sh install-dependencies
  3. /ns3 configure --build-profile=optimized --enable-examples --enable-tests --disable-python --disable-werror
  4. ./ns3 build
  5. ./switch_ms-van3t-CARLA.sh
  6. ./ns3 run "v2v-carla-80211p"

At this point I got the error 'Exception: Couldn't find the specified program: .... ' So at this point I tried to do './sandbox_builder.sh' as per the readme line 44 (https://github.com/ms-van3t-devs/ms-van3t/blob/master/README.md?plain=1). Then I continued from step 3 above.

  1. /ns3 configure --build-profile=optimized --enable-examples --enable-tests --disable-python --disable-werror
  2. ./ns3 build
  3. ./switch_ms-van3t-CARLA.sh
  4. ./ns3 run "v2v-carla-80211p"

At this point I got the error 'Exception: Couldn't find the specified program: .... ' again. So I checked the folder to see that the files were there and I saw that there was another ns-3-dev folder inside the original ns-3-dev folder. I think the reason this happened is that when the repo is clones the first time, . sandbox_builder.sh is saved into the ms-van3t folder but sometime during the rest of the installation it gets moved into the ns-3-dev folder so that when I ran it again in that folder, of course it created another ns-3-dev folder and messed up the installation.

I can take some time and recreate these exact steps to confirm if you like and to convince myself I'm not losing my mind !!!

Brían

brianach commented 3 months ago

Hi @carlosrisma,

I followed your steps to the letter. I noticed the following message at the end of step 2.

OpenCDA installation completed.
./switch_ms-van3t-CARLA.sh: line 209: cd: src/automotive/: No such file or directory

At step 5 I just pressed Enter where it says

Current mode is 'base', do you wish to switch to ms-van3t-CARLA?

After completeing the installtion and running step 9 I got this error:

ctrlrm-adm@ctrlrmadm-Precision-3660:~/ms-van3t/ns-3-dev$ ./ns3 run v2v-carla-80211p
Traceback (most recent call last):
  File "/home/ctrlrm-adm/ms-van3t/ns-3-dev/./ns3", line 1336, in <module>
    main()
  File "/home/ctrlrm-adm/ms-van3t/ns-3-dev/./ns3", line 1275, in main
    raise Exception("Couldn't find the specified program: %s" % target_to_run)
Exception: Couldn't find the specified program: v2v-carla-80211p

When I checked if CARLA is installed I found an empty '_CARLA0.0.12' folder under 'ns-3-dev' and there was no 'CARLA-OpenCDA.conf' file.

At this point I decided to run through all the steps again and press 'y' at step 5. After step 8 I checked if Carla was installed and I found it was not. At this point I decided to manually install Carla. After manually installing Carla and making sure it was in the correct location and matching 'CARLA-OpenCDA.conf' I ran the last step again and got this:

ctrlrm-adm@ctrlrmadm-Precision-3660:~/ms-van3t/ns-3-dev$ ./ns3 run v2v-carla-80211p
Traceback (most recent call last):
  File "/home/ctrlrm-adm/ms-van3t/ns-3-dev/./ns3", line 1336, in <module>
    main()
  File "/home/ctrlrm-adm/ms-van3t/ns-3-dev/./ns3", line 1275, in main
    raise Exception("Couldn't find the specified program: %s" % target_to_run)
Exception: Couldn't find the specified program: v2v-carla-80211p

Is there something else I could check at this point?

Brían

brianach commented 3 months ago

Strange thing I noticed is that if I look at the src/automotive folder in the 'files' application it shows empty but in 'terminal' I can see the contents
image

brianach commented 3 months ago

A restart of the workstation resolved the files issue. I searched for v2v-carla-80211p and the file is not there so maybe that explains why it isn't running.

brianach commented 3 months ago

Hi @carlosrisma,

I finally got it to work. It seems that manually installing CARLA first does the trick. Also grpcio and grpcio-tools had to be manually installed and then the additional maps from CARLA. It still slow enough on my system:

image

Brían

carlosrisma commented 3 months ago

Hi @brianach,

I'm glad to hear that you managed to make it work. This weekend, I have to reinstall Ubuntu 22.04 myself, so I will take the opportunity to do the installation and see if I can reproduce your issues and solve the bugs in the installation script if needed.

Regarding the simulation speed, unfortunately, there is not much to do on our side, but I can explain the different reasons for your simulation to be slow:

Carlos