smarc-project / smarc_missions

🟢 Behavior trees and such for different missions
Other
5 stars 13 forks source link

[smarc_bt] Crashes on startup #44

Closed nilsbore closed 3 years ago

nilsbore commented 3 years ago

When I try to run the new code from a devel workspace, I get the following crash on startup:

            smarc_bt: Traceback (most recent call last):
            smarc_bt:   File "/home/nbore/Workspace/ros/dr_sim_ws/devel/lib/smar
                   ~  c_bt/smarc_bt.py", line 15, in <module>
            smarc_bt:     exec(compile(fh.read(), python_script, 'exec'), contex
                   ~  t)
            smarc_bt:   File "/home/nbore/Workspace/ros/dr_sim_ws/src/smarc_miss
                   ~  ions/smarc_bt/src/smarc_bt.py", line 24, in <module>
            smarc_bt:     from auv_config import AUVConfig
            smarc_bt: ModuleNotFoundError: No module named 'auv_config'
nilsbore commented 3 years ago

Alright, I realized why this was and it's not an error on your part. I think it's because auv_config still has the original python shebang in there, which is replaced when using the catkin_install_python command that's used to create the install space.

nilsbore commented 3 years ago

It works with an install space as I though but I do not understand why it does not work from a devel space (I replaced with the correct shebang and it still doesn't work). It looks like noetic has some mechanic for dealing with this to make it work even for a devel space. I suspect it's this mechanic that doesn't work because your python project setup is not exactly standard.

cisprague commented 3 years ago

What do you mean by standard?

KKalem commented 3 years ago

I had tried making the __init__.py, the folder structure etc. of "standard" python projects, then it worked in devel space but this time not in install space, so I opted for keeping it running in install.

nilsbore commented 3 years ago

Ok! So what did you have to do to make it work with an install space?

nilsbore commented 3 years ago

@cisprague E.g. this is a pretty good tutorial for how ROS python packages are typically structured: http://www.artificialhumancompanions.com/structure-python-based-ros-package/ . Note that this was before the new catkin_install_python cmake thing for python3 compatibility.

nilsbore commented 3 years ago

I'm gonna guess that it might be the absence of a setup.py file that confuses catkin. It's a bit tricky to say what's happening since everything is imported basically as local imports.

cisprague commented 3 years ago

Can we get away with it for now while we work on other things? Then, later, we can emulate what is described in the link you shared.

nilsbore commented 3 years ago

Yes, we can get away with this for now. However, we need to think about how it should work on the vehicle. ATM, we are using a devel workspace there. But I guess that should still work with melodic. Can you confirm that devel workspace works with melodic?

cisprague commented 3 years ago

I cannot, I am using Noetic.

KKalem commented 3 years ago

Confirmed working in Melodic devel space on LoLo yesterday.