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

How to install pal-robotics / realsense_gazebo_plugin in ros2 #56

Open
adinathkale01 opened this issue Apr 1, 2024 · 8 comments
Open

Comments

@adinathkale01
Copy link

Please explain the steps how to use above repo in ros2 humble.
I cloned the repo in src folder and did colcon build but it showing following error.
How do i genererate "librealsense_gazebo_plugin.so" file.

--- stderr: realsense_gazebo_plugin
CMake Error at CMakeLists.txt:5 (find_package):
By not providing "Findcatkin.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "catkin", but
CMake did not find one.

Could not find a package configuration file provided by "catkin" with any
of the following names:

catkinConfig.cmake
catkin-config.cmake

Add the installation prefix of "catkin" to CMAKE_PREFIX_PATH or set
"catkin_DIR" to a directory containing one of the above files. If "catkin"
provides a separate development package or SDK, be sure it has been
installed.


Failed <<< realsense_gazebo_plugin [0.45s, exited with code 1]

@lss0815
Copy link

lss0815 commented Apr 3, 2024

I think you tried with the branch melodic-devel. Catkin is a build sytem for ROS1.

And FYI, there seems no version for humble yet.

Edited: foxy branch will work on humble

@MarioCavero
Copy link

MarioCavero commented Apr 23, 2024

I found in this issue #20 that there is a ros2 branch:

This branch is aimed for ROS2, if you are ROS1 user you can see the other branches(e.g melodic). This is a continuation of work done by SyrianSpock for a Gazebo ROS plugin with RS200 camera. This package also includes the work developed by Intel Corporation with the ROS model for the D435 camera.

And their example says: Note that this was tested for the ROS2 branch with ROS Foxy distro.

It seems it works, I will test it out.

@lss0815
Copy link

lss0815 commented Apr 23, 2024

Sorry I forgot to revise.
I've also tried last week. It succeeded to get data with the version in humble.

@MarioCavero
Copy link

MarioCavero commented Apr 24, 2024

What did you do to set it up? @lss0815 I added the specifics for my robot, downloading that repo as a ros2 package. But when I colcon build, I get the following message. To note, I downloaded the urdfs, it showed me an error related a file called macros.xacro for some reason, as I already had a file called like that. After fixing:

--- stderr: realsense_gazebo_plugin                             
/home/mk/ros2_ws/src/realsense_gazebo_plugin/src/gazebo_ros_realsense.cpp: In member function ‘virtual void gazebo::GazeboRosRealsense::Load(gazebo::physics::ModelPtr, sdf::v9::ElementPtr)’:
/home/mk/ros2_ws/src/realsense_gazebo_plugin/src/gazebo_ros_realsense.cpp:63:10: error: ‘using element_type = class rclcpp::Node’ {aka ‘class rclcpp::Node’} has no member named ‘setParam’
   63 |   node_->setParam(node_->resolveName(cameraParamsMap_[DEPTH_CAMERA_NAME].topic_name) + "/compressed/format", "png");
      |          ^~~~~~~~
/home/mk/ros2_ws/src/realsense_gazebo_plugin/src/gazebo_ros_realsense.cpp:63:26: error: ‘using element_type = class rclcpp::Node’ {aka ‘class rclcpp::Node’} has no member named ‘resolveName’
   63 |   node_->setParam(node_->resolveName(cameraParamsMap_[DEPTH_CAMERA_NAME].topic_name) + "/compressed/format", "png");
      |                          ^~~~~~~~~~~
/home/mk/ros2_ws/src/realsense_gazebo_plugin/src/gazebo_ros_realsense.cpp:64:10: error: ‘using element_type = class rclcpp::Node’ {aka ‘class rclcpp::Node’} has no member named ‘setParam’
   64 |   node_->setParam(node_->resolveName(cameraParamsMap_[DEPTH_CAMERA_NAME].topic_name) + "/compressed/png_level", 1);
      |          ^~~~~~~~
/home/mk/ros2_ws/src/realsense_gazebo_plugin/src/gazebo_ros_realsense.cpp:64:26: error: ‘using element_type = class rclcpp::Node’ {aka ‘class rclcpp::Node’} has no member named ‘resolveName’
   64 |   node_->setParam(node_->resolveName(cameraParamsMap_[DEPTH_CAMERA_NAME].topic_name) + "/compressed/png_level", 1);
      |                          ^~~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-inconsistent-missing-override’ may have been intended to silence earlier diagnostics
gmake[2]: *** [CMakeFiles/realsense_gazebo_plugin.dir/build.make:90: CMakeFiles/realsense_gazebo_plugin.dir/src/gazebo_ros_realsense.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:137: CMakeFiles/realsense_gazebo_plugin.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< realsense_gazebo_plugin [16.4s, exited with code 2]

  // set 'png' compression format for depth images
  // default functional parameters for compressed_image_transport to have lossless png compression
  rosnode_->setParam(rosnode_->resolveName(cameraParamsMap_[DEPTH_CAMERA_NAME].topic_name) + "/compressed/format", "png");
  rosnode_->setParam(rosnode_->resolveName(cameraParamsMap_[DEPTH_CAMERA_NAME].topic_name) + "/compressed/png_level", 1);

EDIT: A fix to this if experienced, take this into account.

Remove the old rosnode lines preventing the package from building (addresses #40 ).
Remove std::cout in favor of RCLCPP logging.
Ensure the image_transport object gets freed when the plugin object is deleted.

Probably better to just copy that same file. To edit /opt/ros/foxy for /opt/ros/humble

@lss0815
Copy link

lss0815 commented Apr 25, 2024

I think you've solved well by yourself, but FYI I was able to use the plugin only after adding models.

Maybe, could you check the git branch once again? The branch needs to be foxy-devel

@MarioCavero
Copy link

Thanks! I fixed it. My situation was adding the camera linked to base_link, but not physically to the robot. It was not straightforward as in the tutorials, as the xacro:sensor in my case needed to be called different:
from my robot.urdf.xacro:

<xacro:include filename="$(find mypackage_whatever)/urdf/_d435.urdf.xacro"/>

(and in the _d435.urdf.xacro, the proper filename for _d435.gazebo.xacro

The sensor had to be instantiated like this (probably works without origin?):

    <xacro:sensor_d435 name="realsense_d435" topics_ns="realsense_d435" parent="base_link">
  <origin xyz="0.3 0.8 0.8" rpy="0 0.685 -1.57"/>
</xacro:sensor_d435>

ros2 topic list outputs the correct info, and after reviewing the images, and IRs, all looks good. On rqt view image, depth images are not working, probably because the range needs to be changed as suggested to do in rviz too. The camera cannot be seen visually though but I am not bothered by that.

@zp2546265641
Copy link

I think you tried with the branch melodic-devel. Catkin is a build sytem for ROS1.

And FYI, there seems no version for humble yet.

Edited: foxy branch will work on humble

hello, i download and how to use it in gazebo plugin

@lss0815
Copy link

lss0815 commented Jun 28, 2024

@zp2546265641 Hello, it might be presumptuous of me, but it would be helpful to refer to the turtlebot3 simulation and chatGPT when you get started.

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