Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No module named 'map_generator' #6

Open
DaddyWesker opened this issue Jun 18, 2021 · 24 comments
Open

No module named 'map_generator' #6

DaddyWesker opened this issue Jun 18, 2021 · 24 comments

Comments

@DaddyWesker
Copy link

Hello,

When trying to launch your run_C.sh i'm getting No module named 'map_generator' error. How to install it?

THanks in advance.

@1989Ryan
Copy link
Owner

i think it is due to the compiling via catkin_make. when compile the catkin_ws, i first compile the part with map_generator, then compile the rest of the program since the rest parts need to include the map_generator module.

@DaddyWesker
Copy link
Author

Hm. I've ran catkin_make befor running run_C.sh, of course, but still... By the way, i'm using ros_noetic, if that is the case. SO what should i do? Run catkin_make again?

@1989Ryan
Copy link
Owner

try multithreading. however i am not pretty sure whether this project will work under ros_noetic. i use ros_kinetic and this project is years ago. direct implementation might not be applicable. my advice is to view the code as reference to your own program.

@DaddyWesker
Copy link
Author

What do you mean by "try multithreading"?

Well, if this is not directly appliable to ros noetic, i guess the only option i have is to use another PC or virutual machine...

Weird thing is, that catkin make indeed building map_generator, but maybe this is just not installing to my ros... If i've already have some packages installed to ROS, maybe i should somehow place your project in the same folder and build there? And do i need to build ORB SLAM 2 and PSPNet via ROS too?

@1989Ryan
Copy link
Owner

after you successfully compile the project, there should be some head file for map_generator. thus when you compile the rest of the program, your compiler will include the head file directly. that is the key. you can first compile the program with map_generator part, then compile the rest, the rest parts already include the ORBSLAM and PSPNet.

that issue is because i build up the system step-by-step. I first wrote the map_generator part and compiled it. then after i finished the rest part then compile the whole program, the program then naturally included the map_generator.

@DaddyWesker
Copy link
Author

Hm. So, i've already built catkin_ws with catkin_build. And there is a map_generator proj there. So, after that i should go into third_party and build ORB and PSPNet, yes? At least, that's what i did.

By the way, i forgot to mention that this error "no module named map generator" occurs when i launch this command from run_c.sh

gnome-terminal -x bash -c "cd Third_Part/PSPNet_Keras_tensorflow/python Semantic_Information_Publisher_C.py image:=/camera/image_raw" so, my python interpreter should somehow know about your map_generator, i suppose.

@1989Ryan
Copy link
Owner

that issue might because you didnt source the setup.bash i suppose.

@DaddyWesker
Copy link
Author

Hm, that might be the case... Source.bash from devel folder in catkin_ws, right? I'll try that and will get back to you.

@yushijie94
Copy link

just cd the catkin_ws folder and source ./devel/setup.bash, the it works

@DaddyWesker
Copy link
Author

DaddyWesker commented Jun 21, 2021

well, i tried to add
source /home/daddywesker/Dioram/TestingRGB/Semantic_SLAM/catkin_ws/devel/setup.bash
line to bashrc file. But, now i'm getting ModuleNotFoundError: No module named 'rospkg' This could be related to thing that I have another similar line source ~/catkin_ws/devel/setup.bash but this is another package. I guess, i need to unite them, yes?

I've checked this. Problem is, that i'm trying to launch your py script from anaconda env. And it doesn't see my ros installation. WHen i'm trying just to import rospy from anaconda env it can't import it, but without any conda env - it can. ANy clues how to make it work inside anaconda env?

@DaddyWesker
Copy link
Author

DaddyWesker commented Jun 21, 2021

Alright, i've installed ros into anaconda. But currently when launching
python Semantic_Information_Publisher_C.py image:=/home/daddywesker/datasets/Euroc/V2_01_easy/mav0/cam0/data/

i'm facing this

Keras model & weights found, loading...
Traceback (most recent call last):
  File "Semantic_Information_Publisher_C.py", line 76, in <module>
    tensor = Semantic_Imformation_Publisher()
  File "Semantic_Information_Publisher_C.py", line 33, in __init__
    self.pspnet = PSPNet101(nb_classes=19, input_shape=(713, 713),
  File "/home/daddywesker/Dioram/TestingRGB/Semantic_SLAM/Third_Part/PSPNet_Keras_tensorflow/pspnet.py", line 143, in __init__
    PSPNet.__init__(self, nb_classes=nb_classes, resnet_layers=101,
  File "/home/daddywesker/Dioram/TestingRGB/Semantic_SLAM/Third_Part/PSPNet_Keras_tensorflow/pspnet.py", line 34, in __init__
    self.model = model_from_json(file_handle.read())
  File "/home/daddywesker/anaconda3/envs/tf/lib/python3.8/site-packages/tensorflow/python/keras/saving/model_config.py", line 131, in model_from_json
    return deserialize(config, custom_objects=custom_objects)
  File "/home/daddywesker/anaconda3/envs/tf/lib/python3.8/site-packages/tensorflow/python/keras/layers/serialization.py", line 173, in deserialize
    return generic_utils.deserialize_keras_object(
  File "/home/daddywesker/anaconda3/envs/tf/lib/python3.8/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 354, in deserialize_keras_object
    return cls.from_config(
  File "/home/daddywesker/anaconda3/envs/tf/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py", line 2261, in from_config
    return functional.Functional.from_config(
  File "/home/daddywesker/anaconda3/envs/tf/lib/python3.8/site-packages/tensorflow/python/keras/engine/functional.py", line 668, in from_config
    input_tensors, output_tensors, created_layers = reconstruct_from_config(
  File "/home/daddywesker/anaconda3/envs/tf/lib/python3.8/site-packages/tensorflow/python/keras/engine/functional.py", line 1275, in reconstruct_from_config
    process_layer(layer_data)
  File "/home/daddywesker/anaconda3/envs/tf/lib/python3.8/site-packages/tensorflow/python/keras/engine/functional.py", line 1257, in process_layer
    layer = deserialize_layer(layer_data, custom_objects=custom_objects)
  File "/home/daddywesker/anaconda3/envs/tf/lib/python3.8/site-packages/tensorflow/python/keras/layers/serialization.py", line 173, in deserialize
    return generic_utils.deserialize_keras_object(
  File "/home/daddywesker/anaconda3/envs/tf/lib/python3.8/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 354, in deserialize_keras_object
    return cls.from_config(
  File "/home/daddywesker/anaconda3/envs/tf/lib/python3.8/site-packages/tensorflow/python/keras/layers/core.py", line 1019, in from_config
    function = cls._parse_function_from_config(
  File "/home/daddywesker/anaconda3/envs/tf/lib/python3.8/site-packages/tensorflow/python/keras/layers/core.py", line 1071, in _parse_function_from_config
    function = generic_utils.func_load(
  File "/home/daddywesker/anaconda3/envs/tf/lib/python3.8/site-packages/tensorflow/python/keras/utils/generic_utils.py", line 457, in func_load
    code = marshal.loads(raw_code)
ValueError: bad marshal data (unknown type code)

What could it be? /home/daddywesker/datasets/Euroc/V2_01_easy/mav0/cam0/data/ is the folder with images. json and h5 files are in place as code requires - weights/keras/ and i'm launching code from PSPNet folder. SO shouldn't be problem with finding file.

@yushijie94
Copy link

Sir, Semantic_Information_Publisher_C.py will read the picture from the ros topic and give out semantic result. So your should use python Semantic_Information_Publisher_C.py image:=/camera/image_raw. You should supply the ros topic named /camera/image_raw. The original KITTI dataset is image files not the rosbag. So you should convert the files to the rosbag. You can find the tools easily.

@DaddyWesker
Copy link
Author

Hm. So, when i'm launching python script Semantic_Information_Publisher_C.py, i should point him to the rostopic of some rosbag, yes? And where should i put the desired rosbag then? To the orb_slam_2 launch?

@yushijie94
Copy link

Yes the rosbag author did not supply it. You should download by yourself. https://gitee.com/zengtaiping/image2rosbag_KITTIodometry. Try it. This is a chinese website.
And about how to run all the semantic slam system, you can see run.sh in this github.

@DaddyWesker
Copy link
Author

I have euroc rosbag, thanks. Alright, i'll take a look into run.sh instead of run_C.sh then. Thanks.

@DaddyWesker
Copy link
Author

Well, unfortunately i can't get past rosrun ORB_SLAM2 Mono Vocabulary/ORBvoc.txt Examples/Monocular/KITTI00-02.yaml since I'm receiving errors when I'm trying to build ORB_SLAM2 inside Thrid_Part folder. Actually, i've successfully run file build.sh, but build_ros.sh throws an error

No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Deprecation Warning at /opt/ros/noetic/share/ros/core/rosbuild/rosbuild.cmake:7 (cmake_policy):
  The OLD behavior for policy CMP0011 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
  CMakeLists.txt:2 (include)


CMake Deprecation Warning at /opt/ros/noetic/share/ros/core/rosbuild/rosbuild.cmake:16 (cmake_policy):
  The OLD behavior for policy CMP0002 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
  CMakeLists.txt:2 (include)


CMake Deprecation Warning at /opt/ros/noetic/share/ros/core/rosbuild/rosbuild.cmake:18 (cmake_policy):
  The OLD behavior for policy CMP0003 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
  CMakeLists.txt:2 (include)


CMake Deprecation Warning at /opt/ros/noetic/share/ros/core/rosbuild/rosbuild.cmake:20 (cmake_policy):
  The OLD behavior for policy CMP0005 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
  CMakeLists.txt:2 (include)


CMake Deprecation Warning at /opt/ros/noetic/share/ros/core/rosbuild/rosbuild.cmake:23 (cmake_policy):
  The OLD behavior for policy CMP0011 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.
Call Stack (most recent call first):
  CMakeLists.txt:2 (include)


[rosbuild] Building package ORB_SLAM2
[rosbuild] Error from directory check: /opt/ros/noetic/share/ros/core/rosbuild/bin/check_same_directories.py  /home/daddywesker/Dioram/TestingRGB/Semantic_SLAM/Third_Part/ORB_SLAM2/Examples/ROS/ORB_SLAM2
1
Traceback (most recent call last):
  File "/opt/ros/noetic/share/ros/core/rosbuild/bin/check_same_directories.py", line 46, in <module>
    raise Exception
Exception
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 153, in apport_excepthook
    with os.fdopen(os.open(pr_filename,
FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_opt_ros_noetic_share_ros_core_rosbuild_bin_check_same_directories.py.1000.crash'

Original exception was:
Traceback (most recent call last):
  File "/opt/ros/noetic/share/ros/core/rosbuild/bin/check_same_directories.py", line 46, in <module>
    raise Exception
Exception
CMake Error at /opt/ros/noetic/share/ros/core/rosbuild/private.cmake:99 (message):
  [rosbuild] rospack found package "ORB_SLAM2" at "", but the current
  directory is
  "/home/daddywesker/Dioram/TestingRGB/Semantic_SLAM/Third_Part/ORB_SLAM2/Examples/ROS/ORB_SLAM2".
  You should double-check your ROS_PACKAGE_PATH to ensure that packages are
  found in the correct precedence order.
Call Stack (most recent call first):
  /opt/ros/noetic/share/ros/core/rosbuild/public.cmake:177 (_rosbuild_check_package_location)
  CMakeLists.txt:4 (rosbuild_init)


-- Configuring incomplete, errors occurred!
See also "/home/daddywesker/Dioram/TestingRGB/Semantic_SLAM/Third_Part/ORB_SLAM2/Examples/ROS/ORB_SLAM2/build/CMakeFiles/CMakeOutput.log".

I've also tried to build orb_slam2_ros from here https://github.com/appliedAI-Initiative/orb_slam_2_ros but it doesn't build executable Mono (though, after build.sh in Third_Part/ORB_SLAM2 i've got no Mono executable file either).

@DaddyWesker
Copy link
Author

Alright, i've beat that issue with adding
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/PATH/TO/Semantic_SLAM/Third_Part/ORB_SLAM2_C/Examples/ROS
to bashrc and cmaked orb_slam2_ros in example folder. Unfortunately, now i'm facing this issue when i'm trying to make it

Semantic_SLAM/Third_Part/ORB_SLAM2_C/Examples/ROS/ORB_SLAM2/src/AR/ros_mono_ar.cc:153:84: error: no matching function for call to ‘ORB_SLAM2::System::TrackMonocular(const cv::Mat&, double)’
  153 |     cv::Mat Tcw = mpSLAM->TrackMonocular(cv_ptr->image,cv_ptr->header.stamp.toSec());

Currently, no clue here...

@yushijie94
Copy link

use
cv::Mat Tcw = mpSLAM->TrackMonocular(cv_ptr->image, cv_ptr->image, cv_ptr->header.stamp.toSec());
instead of
cv::Mat Tcw = mpSLAM->TrackMonocular(cv_ptr->image,cv_ptr->header.stamp.toSec());

You may need do it some more times in other files.

@DaddyWesker
Copy link
Author

Yes, that helps, thanks. Unfortunately, i'm now getting this error

/usr/bin/ld: warning: libopencv_imgproc.so.4.2, needed by /opt/ros/noetic/lib/libcv_bridge.so, may conflict with libopencv_imgproc.so.3.4
/usr/bin/ld: CMakeFiles/MonoAR.dir/src/AR/ViewerAR.cc.o: undefined reference to symbol '_ZN2cv7putTextERKNS_17_InputOutputArrayERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS_6Point_IiEEidNS_7Scalar_IdEEiib'
/usr/bin/ld: /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.4.2.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

I'm afraid that noetic ROS i've built with another opencv than orb_slam2. I've tried actually to build orb_slam2 with opencv 4 but there were many errors. Is there some other way than rebuilding of ros or orb_slam with another opencv version?

@yushijie94
Copy link

you used ubuntu20.04, maybe you should install another opencv version 3.4, and orbslam2 link the opencv 3.4 instead(change the cmakeList.txt). OS problem is hard to solved, try or use ubuntu 16.04 instead.

@DaddyWesker
Copy link
Author

Well, i've managed to build it using this fix/hack by Marcus

UZ-SLAMLab/ORB_SLAM3#97

Will try to launch now.

@DaddyWesker
Copy link
Author

Launched with gdb using
rosrun --prefix 'gdb -ex run --args' ORB_SLAM2 Mono Vocabulary/ORBvoc.txt Examples/Monocular/KITTI00-02.yaml

and got

Input sensor was set to: Monocular

Thread 1 "Mono" received signal SIGSEGV, Segmentation fault.
0x00007ffff77b4d12 in ?? () from /lib/x86_64-linux-gnu/libopencv_core.so.4.2

I guess that fix/hack for opencv didn't worked so well...

@DaddyWesker
Copy link
Author

DaddyWesker commented Jun 24, 2021

Alright. I've re-built ORB_SLAM2 with rebuilt opencv 4.2, fixed some compatibility issues and now i've launched all lines from run.sh in a separate terminals. And after i'm running last one, python cluster.py, i'm getting this error

[ERROR] [1624527912.019743647]: Client [/cluster] wants topic /trajectory to have datatype/md5sum [nav_msgs/Path/6227e2b7e9cce15051f669a5e197bbf7], but our version has [map_generator/tjy/0d7fb206b66f869d41c3fc6ff889cb36]. Dropping connection.

in the window, where i've launched rosrun ORB_SLAM2. Is there are something else to be run? Maybe some sort of rosplay bag? Map viewer and current frame are just showing nothing (current frame is black, map is whit with green triangle and nothing happens).

Upd 25.06.2021
@yushijie94 have you managed to launch this project? I'm struggling for yesterday and today to launch it and error still occurs...

@zhoushuailin
Copy link

Hello,

When trying to launch your run_C.sh i'm getting No module named 'map_generator' error. How to install it?

THanks in advance.

Hello,

When trying to launch your run_C.sh i'm getting No module named 'map_generator' error. How to install it?

THanks in advance.

hi , have you reproduce the result? where is the cluster node?

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

No branches or pull requests

4 participants