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

Issue on starting demo of rs_camera.launch #2078

Closed
GitNzino opened this issue Sep 14, 2021 · 25 comments
Closed

Issue on starting demo of rs_camera.launch #2078

GitNzino opened this issue Sep 14, 2021 · 25 comments
Labels

Comments

@GitNzino
Copy link

Hi everyone,

I had some issue on starting the demo examples of realsense camera. I followed all the instruction that are on the README file and i don't understand where is the error.

Thank you in advice, have a nice day!
Lorenzo

image

@MartyG-RealSense
Copy link
Collaborator

Hi @GitNzino The _ZN20ddynamic_reconfigure error may occur if there is more than one instance of the ddynamic_reconfigure component installed on your computer, as described in #1922 (comment)

Some RealSense users resolved the problem by doing a complete wipe and clean reinstall of their system.

Another took the approach of uninstalling ddynamic_reconfigure with the instruction uninstall apt remove ddynamic* and then reinstalling ddynamic_reconfigure

A quick way to install it for Melodic is with the instruction sudo apt-get install ros-melodic-ddynamic-reconfigure

@GitNzino
Copy link
Author

Thank you, after checking i have only one ddynamic_recongifure installed on my pc.
What should i do for using the ros package?

thank you for help!

@MartyG-RealSense
Copy link
Collaborator

#838 is the main reference for this problem. As mentioned earlier, some RealSense users solved it with a complete system wipe and re-installation, whilst others suggested methods that did not involve a wipe.

Could you tell me about the method that you used to install the librealsense SDK and the RealSense ROS wrapper that led to the problem that you are experiencing, please? Thanks!

@GitNzino
Copy link
Author

GitNzino commented Sep 15, 2021

I installed all the libraries with sudo apt install only the realsense-ros package is installed in catkin workspace.

In your opinion is it possible to use the python code in python and use it in ros?

Anyway I continue to investigate the other methods mentioned in your comment with the hope to solve the problem.

Last question: with system wipe is intended Ros or Ubuntu?

@MartyG-RealSense
Copy link
Collaborator

You can access Python from ROS by using a Python ROS node script, as discussed in IntelRealSense/librealsense#6367

A system wipe is a wipe and fresh reinstall of everything on the computer - Ubuntu, librealsense and ROS.

Good luck with your investigations and please do update here when you have new results.

@GitNzino
Copy link
Author

GitNzino commented Sep 16, 2021

Thank you for the example reported they helped to understand some things, maybe the situation could be resolved in a easy way.

The following question are written in order to try to use some realsense functionality without doing a system wipe (because it could be take away time in rebuilding all the other scripts and procedure):

  • Is it possible to use in ROS the example written for python, so using the librealsense API in python to dialogue with the camera and the write the acquired information from the camera to a subscriber node for other purpose?
  • It is possible taking a ROS example putting in a new personal package and use them without ddynamic_reconfigure?

In the end i tried most of the suggested action to start the rs_camera.launch without doing a system wipe but for the moment nothing seem works properly, i hope that there is a method to remedy this issue.

Thank you very much for the help and support, hope a nice day for you!

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Sep 16, 2021

I am not aware of an example of align-depth2color.py being launched from ROS. As the 'ROS example' script show_center_depth.py is a pyrealsense2 script though, this suggests that align-depth2color.py (also a pyrealsense2 script) may be launchable from ROS.

https://github.com/IntelRealSense/realsense-ros/blob/development/realsense2_camera/scripts/show_center_depth.py#L8

Doronhi the RealSense ROS wrapper developer provides more information about how show_center_depth.py works in #1086 (comment)

However, you do not necessarily need a Python script to perform alignment. If you add the term align_depth:=true to your roslaunch instruction then it publishes a pair of depth-to-color topics called /camera/aligned_depth_to_color/image_raw and /camera/aligned_depth_to_color/camera_info. A pointcloud, if enabled, will be built based on the aligned_depth_to_color image.

In regard to your second question: if you are askng if a ROS Python example script could be converted for non-ROS use in Python then it may be easier to use a pyrealsense2 script that performs a similar function. The Python wrapper has a list of example programs at the link below, and many others can be found on the librealsense forum.

https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python/examples

If you meant instead though whether there was a way to use ROS without dynamic_reconfigure, then the RealSense ROS2 wrapper could do that because ROS2 does not use dynamic_reconfigure.

https://github.com/IntelRealSense/realsense-ros/tree/ros2

@GitNzino
Copy link
Author

GitNzino commented Sep 17, 2021

Thank you for help again!

What I want to do is using the python wrapper example in ROS to overcome the problem of ddynamic_reconfigure, but I'm not sure that it is easy or possible.

Alternatively to use the /camera/aligned_depth_to_color/image_raw and /camera/aligned_depth_to_color/camera_info is mandatory to have a workng ddynamic _reconfigure?

Sorry for the question but if is possible i would like to avoid a system wipe because this camera step is the last step of an entire system that involves many programs, library and scripts already working.

In the end I want to share the terminal output for the rosrun realsense2_camera show_center_depth.py command

' @ error/constitute.c/WriteImage/1037.
from: can't read /var/mail/sensor_msgs.msg
from: can't read /var/mail/sensor_msgs.msg
from: can't read /var/mail/cv_bridge
' @ error/constitute.c/WriteImage/1037.
' @ error/constitute.c/WriteImage/1037.
^C^C/home/lorenzo/cw_kinova/src/realsense-ros/realsense2_camera/scripts/show_center_depth.py: line 9: syntax error near unexpected token `('
/home/lorenzo/cw_kinova/src/realsense-ros/realsense2_camera/scripts/show_center_'epth.py: line 9: `if (not hasattr(rs2, 'intrinsics')):

@MartyG-RealSense
Copy link
Collaborator

As far as I am aware, ddynamic_reconfigure is a necessary installation requirement for the ROS1 wrapper when installing it from source with Method 2.

It is not a described part though of the Method 1 installation (which installs librealsense and the wrapper together from packages).

https://github.com/IntelRealSense/realsense-ros#method-1-the-ros-distribution

@GitNzino
Copy link
Author

Thank you!

This week I'll try to do the system wipe, hope that all go right.
After them is needed to do sudo apt install ros-melodic-ddynamic_reconfigure && sudo apt install ros-melodic-realsense2-* and then import the raw and depth frames using the appropriate node. I think it comes by itself that i need to launch the roslaunch realsense2_camera rs_camera.launch before I start the ros script that reads the node output.

Can you confirm?

@MartyG-RealSense
Copy link
Collaborator

Processes that depend upon the output of the RealSense ROS wrapper (such as the camera data topics that it publishes) do usually have to be launched after the ROS wrapper launch has completed.

@GitNzino
Copy link
Author

Sure, understand thank you!

Do you prefer that I close the issue and if in few day I have new similar question I will open another issue or is better that i continue writing there?

@MartyG-RealSense
Copy link
Collaborator

If the new question is similar to this one then it's fine to keep this case open and comment here. If the question is a different subject then you can create a new issue for it. Thanks!

@GitNzino
Copy link
Author

GitNzino commented Sep 22, 2021

Hi
I have just do the system wipe, but a similar error still occurs.
The error reported by terminal is the following:

image

After the system wipe I have installed relasense2 package and ddyanmic_recofigure package via sudo apt install, because on my application is only needed to obtain the image and the depth info and you confirmed me that is possible to obtain this listening the node output.

What do you suggest to do now?
Thank you for help

@MartyG-RealSense
Copy link
Collaborator

It looks as though it is now a different error to the one at the start of this case (which was ZN20ddynamic_reconfigure and is now _ZN2cv3MatC1Ev). My research indicates that it seems to be particularly related to OpenCV. Are you making use of OpenCV in your application, please?

@GitNzino
Copy link
Author

I'm really pleased that now ddynamic_reconfigure works!

Now I'm trying to execute roslaunch realsense2_camera rs_camera.launch that is the script produced by you.

If is required to install OpenCV can you tell me what is the required package?
Thank you

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Sep 22, 2021

OpenCV is not part of the installation process for the RealSense ROS wrapper, so I'm not sure why an error typically associated with OpenCV would occur if you have done a wipe and just installed Ubuntu, librealsense, ROS and the ROS wrapper.

When OpenCV is used with librealsense, a minimum of OpenCV 3.4 is recommended.

https://github.com/IntelRealSense/librealsense/tree/master/wrappers/opencv#opencv-samples-for-intel-realsense-cameras

All the guides that I have seen for installing OpenCV on Ubuntu involve a requirement for Python.

https://docs.opencv.org/master/d2/de6/tutorial_py_setup_in_ubuntu.html

@GitNzino
Copy link
Author

GitNzino commented Sep 22, 2021

Thank you for good answer, but there is already installed OpenCV in this PC as you can see in the picture below:

image

Maybe is necessary to declare some export PATH in the bash or something else?

@MartyG-RealSense
Copy link
Collaborator

Could you describe the installation steps that you took after wiping your computer's drive, please? For example:

  1. Installed Ubuntu
  2. Installed librealsense
  3. Installed ROS
  4. Installed the RealSense ROS wrapper

@GitNzino
Copy link
Author

GitNzino commented Sep 23, 2021

Yes sure:

  1. Installed Ubuntu
  2. Installed librealsense (via apt)
  3. Installed ROS
  4. Installed the RealSense ROS wrapper (via apt)
  5. Installed ddynamic_reconfigure (via apt)
  6. Installed OpenCV (via apt)
  7. installed OpenCV from source, but not works neither

@MartyG-RealSense
Copy link
Collaborator

Is OpenCV a required component of the project that you are working on, please?

Have you tested the RealSense ROS wrapper after completing stage 5, before adding OpenCV?

@GitNzino
Copy link
Author

If I'm not in wrong i have understand that for obtain the node from the realsense camera for is to launch the roslaunch realsense2_camera rs_camera.launch and if i digit on the terminal sudo apt install ros-melodic-realsense2-camera appears the following result.

lorenzo@ubuntu-18-04:~$ sudo apt install ros-melodic-realsense2-camera-*
[sudo] password for lorenzo: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'ros-melodic-realsense2-camera-dbgsym' for glob 'ros-melodic-realsense2-camera-*'
The following additional packages will be installed:
  python-opencv ros-melodic-cv-bridge ros-melodic-realsense2-camera
The following NEW packages will be installed:
  python-opencv ros-melodic-cv-bridge ros-melodic-realsense2-camera
  ros-melodic-realsense2-camera-dbgsym
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 4.462 kB of archives.
After this operation, 8.363 kB of additional disk space will be used.
Do you want to continue? [Y/n] 

So i suppose that OpenCV is needed by realsense package to works properly.

For these reason it is impossible to test Realsense ROS packages without OpenCV.

Thank you for help.

@MartyG-RealSense
Copy link
Collaborator

Do you get the same set of messages if you use the installation instruction below:

sudo apt-get install ros-melodic-realsense2-camera

@GitNzino
Copy link
Author

Thank you now works!

I think that sudo apt-get install ros-melodic-realsense2-camera + a clean catkin_make of all the workspace fixed the previous bug.

Thank you for your kindness, hope you a nice day!
Lorenzo

@MartyG-RealSense
Copy link
Collaborator

You are very welcome, Lorenzo. That's great to hear that you were successful. :)

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

No branches or pull requests

2 participants