hsr-project / hsr_ros2_doc

6 stars 1 forks source link

Build problem for actual robot #5

Open y-masutani opened 5 months ago

y-masutani commented 5 months ago

I am trying to install according to the "Actual Robot" section, and I needed to run the following command to resolve the rosdep error.

sudo apt install ros-foxy-xacro ros-foxy-camera-info-manager ros-foxy-usb-cam \
ros-foxy-transmission-interface ros-foxy-realtime-tools ros-foxy-joint-trajectory-controller \
ros-foxy-joint-state-publisher-gui ros-foxy-urg-node ros-foxy-joint-state-broadcaster \
ros-foxy-depth-image-proc ros-foxy-controller-manager

After that, I then executed colcon build, but got the following error

--- stderr: openni2_camera             
CMake Error at CMakeLists.txt:73 (rosidl_get_typesupport_target):
  Unknown CMake command "rosidl_get_typesupport_target".

It seems that rosidl_get_typesupport_target is not available in ROS Foxy. I changed the relevant part of CMakeLists.txt as follows.

# rosidl_get_typesupport_target(cpp_typesupport_target
#   ${PROJECT_NAME} "rosidl_typesupport_cpp")
# target_link_libraries(openni2_camera_lib "${cpp_typesupport_target}")
rosidl_target_interfaces(openni2_camera_lib
  ${PROJECT_NAME} "rosidl_typesupport_cpp")

After the above correction, I faced the following error

--- stderr: openni2_camera                               
/home/masutani/hsr_ros2_ws/openni2_camera/openni2_camera/src/openni2_device_manager.cpp: In member function 'virtual void openni2_wrapper::OpenNI2DeviceListener::onDeviceConnected(const openni::DeviceInfo*)':
/home/masutani/hsr_ros2_ws/openni2_camera/openni2_camera/src/openni2_device_manager.cpp:109:21: error: missing template arguments before 'l'
  109 |     std::lock_guard l(device_mutex_);
      |                     ^

omitting the rest

Argument deduction of C++ class templates can be used only since C++17. So I changed CMakeLists.txt as follows

if(NOT CMAKE_CXX_STANDARD)
  set(CMAKE_CXX_STANDARD 17)
endif()

Then the build was complete.

Are the above solutions correct? How did other people deal with these problems?

Furthermore, openni2_camera is not developed by HSR project. What should we do?

yulat214 commented 5 months ago

Hi. I had the same problem.

It seems that openni2_camera only supports humble and later. I solved this by going back to the commit where openni2_camera supports foxy.

Since foxy is already EOL, I don't think openni2_camera is even going to support it. The only solution seems to be to support HSR's Humble.

y-masutani commented 4 months ago

Thank you for your comment.

I think it would be best to be able to install Ubuntu 22.04 and ROS Humble on HSR.

The next best solution is to fork the openni2_camera repository and provide a ready-to-build version for ROS Foxy.