ExistentialRobotics / SSMI

Active Multi-class Mapping using Semantic Shannon Mutual Information (SSMI)
Other
71 stars 8 forks source link

about _exploration_cpp.py #4

Open heheguoqushi opened 1 year ago

heheguoqushi commented 1 year ago

When I run SSMI-Planning, error appeared, File "/home/txy/ws/src/semantic_info_gathering/src/exploration/collision_cpp.py", line 7, in from _exploration_cpp import c_check_for_collision ImportError: No module named _exploration_cpp I can't find _exploration_cpp.py in the code, Could you help me?

beaulolve commented 1 year ago

hey,have you fixed it, l meet the same question!

heheguoqushi commented 1 year ago

hello,_exploration_cpp.so is a C++ library for python. Basically, The author running some C++ functions in python using pybind11, so when the planning part is being built, it needs to connect the C++ compiler to a valid python interpreter. Also, you need to enable the 'install' directory of catkin, using 'catkin config --install' before building anything in the corresponding workspace. For SSMI planning, you might need to make some changes based on your python version. If you are using python3.x (where x is the specific version), you need to change this line of the CMakeFile accordingly. I also suggest you put the SSMI-mapping in a workspace and the SSMI-planning in another workspace.

beaulolve commented 1 year ago

hello,_exploration_cpp.so is a C++ library for python. Basically, The author running some C++ functions in python using pybind11, so when the planning part is being built, it needs to connect the C++ compiler to a valid python interpreter. Also, you need to enable the 'install' directory of catkin, using 'catkin config --install' before building anything in the corresponding workspace. For SSMI planning, you might need to make some changes based on your python version. If you are using python3.x (where x is the specific version), you need to change this line of the CMakeFile accordingly. I also suggest you put the SSMI-mapping in a workspace and the SSMI-planning in another workspace.

OK, thank you very much!

InsightofSPb commented 10 months ago

Hello! Run into the same trouble. What step should I do to resolve the issue with "ImportError: No module named _exploration_cpp"? Or there is no way to fix it because there is no such file? And there is a second small question: modules like costmap and others are in different folders and when starting run_semantic_exploration.launch same error with import occured. Although I can put all files in one folder and run them (and receive error with _exploration_cpp) I do not think it is a good way to fix it. Tried to add __init__.py files in each folder, didn't help. What am I missing?

heheguoqushi commented 10 months ago

Hello! Run into the same trouble. What step should I do to resolve the issue with "ImportError: No module named _exploration_cpp"? Or there is no way to fix it because there is no such file? And there is a second small question: modules like costmap and others are in different folders and when starting run_semantic_exploration.launch same error with import occured. Although I can put all files in one folder and run them (and receive error with _exploration_cpp) I do not think it is a good way to fix it. Tried to add __init__.py files in each folder, didn't help. What am I missing?

hello,_exploration_cpp.so is a C++ library for python. You need compile the related C++ file to  produce it as the below steps:
First, The author running some C++ functions in python using pybind11, so when the planning part is being built, it needs to connect the C++ compiler to a valid python interpreter. Also, you need to enable the 'install' directory of catkin, using 'catkin config --install' before building anything in the corresponding workspace.
For SSMI planning, you might need to make some changes based on your python version. If you are using python3.x (where x is the specific version), you need to change [this line of the CMakeFile](https://github.com/ExistentialRobotics/SSMI/blob/b12ae8525af3dc6313f27aeb0d803009f23b04ca/SSMI-Planning/CMakeLists.txt#L10) accordingly.

I also suggest you put the SSMI-mapping in a workspace and the SSMI-planning in another workspace. As for the second problem, I also put all python files in one folder and run them.

InsightofSPb commented 10 months ago

Thanks for the answer! It helped. There were some troubles with pybind11, after fixing the file was in install dir

InsightofSPb commented 10 months ago

Hellow again!

I also suggest you put the SSMI-mapping in a workspace and the SSMI-planning in another workspace.

I use python 2.7.17, ros melodic Started mapping and planning folders in different workspaces and received this error

Traceback (most recent call last): File "/home/s/wp/src/SSMI-Planning/src/semantic_exploration_node.py", line 27, in <module> from semantic_octomap.srv import * ImportError: No module named semantic_octomap.srv What have I done: added Husky robot via adding two lines in run_semantic_exploration.launch: 1) <param name="/husky/robot_description" command="cat $(find husky_description)/urdf/husky.urdf.xacro" /> 2) <include file="$(find husky_gazebo)/launch/husky_empty_world.launch"/> Still, I cannot see the robot in rviz, although in Gazebo it is shown and can be controlled with teleop. In rviz there is an error Global Status:Error, Fixed Frame: Fixed Frame [world] does not exist. Tried to fix it with rosrun tf static_transform_publisher 0 0 0 0 0 0 world map 100 in another terminal tab, it helped for I launch, but still there is no map neither in rviz, nor in Gazebo

If I try to start in both mapping and planning in one workspace, this error is not raised, but ... still no map or anything in rviz

heheguoqushi commented 9 months ago

I suggest you put SSMI-mapping and SSMI-planning into different workspace Because SSMI-mapping and planning are independent parts. And the robot should plan path based on mapping so you need confirm the mapping part is ok. As you said, you can't see map and otherthing. Try the following steps. First,a semantic segement moudle is needed to produce semantic image. Second you can generate the semantic pointcloud through the camera depth image、RGB image and semantic image. Third, the code will generate semantic octomap based on semanctic pointcloud(eg, the following picture) Screenshot from 2023-11-25 11-07-16 Then you can continue the SSMI-Planning part.Some advice and answers for you. First, You use the husky robot is ok, and a location Algorithm like A-loam is needed to transform the robot to map or world coordinate. Second, if your mapping part is ok, from semantic_octomap.srv import should success beacuse i think the ROS will find the semantic_octomap package automatically. Third, You should change and check all the coordinate in SSMI-Planning code as your robot param and your definition.

InsightofSPb commented 9 months ago

Thank you so much for your detailed answer! I'll try this step by step