ROBOTIS-GIT / turtlebot3_applications

Applications for TurtleBot3
http://turtlebot3.robotis.com
Apache License 2.0
84 stars 47 forks source link

TurtleBot Waffle PI not moving #20

Closed florianspy closed 6 years ago

florianspy commented 6 years ago

After starting the commands: roslaunch turtlebot3_bringup turtlebot3_rpicamera.launch [Turtlebot]

roslaunch turtlebot3_panorama panorama.launch [Remote] rosservice call turtlebot3_panorama/take_pano 0 360.0 30.0 0.3 [Remote] Only the following commands are shown in terminal: [ INFO] [1528113614.391267503]: Degrees to go: 360

but turtlebot3 Waffle PI is not moving at all.

Even after sending rosservice call turtlebot3_panorama/take_pano 2 360.0 30.0 0.3 [Remote] I cannot see any camera picture as shown in the below screenshot. grafik

When i click on Camera/rgb/image_raw in rqt_image_view i get the images of the camera, so the pi camera should work.

Edit: i guess the command roslaunch turtlebot3_bringup turtlebot3_robot.launch [Turtlebot] has to be launched in advance as well after that the robot starts spinning when rosservice call turtlebot3_panorama/take_pano 0 360.0 30.0 0.3 [Remote] gets called

Now the turtlebot is spinning around but after it finished one round it get the following error in the terminal which runs roslaunch turtlebot3_panorama panorama.launch:

[ INFO] [1528123709.812693421]: Stiching 2 images [ INFO] [1528123709.891097584]: Finished Stiching [ERROR] [1528123709.891145396]: Compressed Depth Image Transport - Compression requires single-channel 32bit-floating point or 16bit raw depth images (input format is: bgr8). OpenCV Error: Unknown error code -10 (Raw image encoder error: Empty JPEG image (DNL not supported)) in throwOnEror, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgcodecs/src/grfmt_base.cpp, line 140 [ERROR] [1528123709.891331341]: /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgcodecs/src/grfmt_base.cpp:140: error: (-10) Raw image encoder error: Empty JPEG image (DNL not supported) in function throwOnEror [ERROR] [1528123709.891373088]: [theora] Failed to create encoding context

This error seems to occur when the following command is run during image acquisition rqt_image_view image:=/turtlebot3_panorama/panorama and seems to be related to the issue of two instances accessing the same jpeg file

In all cases the panorama image remains grey (see below) when looking at it via rqt_image_view image:=/turtlebot3_panorama/panorama grafik

even so i get the message in the terminal which runs roslaunch turtlebot3_panorama panorama.launch [ INFO] [1528123914.836793089]: Stiching 7 images [ INFO:0] Initialize OpenCL runtime... [ INFO] [1528123915.545787520]: Finished Stiching [ INFO] [1528123915.546026709]: Publishing Completed Panorama

routiful commented 6 years ago

Hi :)

I tested it and get below information in terminal and image

[ INFO] [1528186673.507284245]: Stiching 12 images
[ INFO:0] Initialize OpenCL runtime...
[ INFO:0] Successfully initialized OpenCL cache directory: /home/darby/.cache/opencv/3.3.1-dev/opencl_cache/
[ INFO:0] Preparing OpenCL cache configuration for context: NVIDIA_Corporation--GeForce_GTX_970M--375_66
[ INFO] [1528186674.486975693]: Finished Stiching
[ INFO] [1528186674.487486044]: Publishing Completed Panorama
[ INFO] [1528186674.487518750]: Angle: 6.291084
[ INFO] [1528186674.487536742]: Last Angle: 5.920647

Have you installed graphic driver properly? if not, please check it.

And try to use rqt_image_view not rqt_image_view image:=/turtlebot3_panorama/panorama

Thanks Darby

florianspy commented 6 years ago

My terminal generates the following output encoding: bgr8 is_bigendian: [ INFO] [1528203564.997826581]: Stiching 12 images [ INFO:0] Initialize OpenCL runtime... [ INFO] [1528203567.362583864]: Finished Stiching [ INFO] [1528203567.362639221]: Publishing Completed Panorama [ INFO] [1528203567.362655736]: Angle: 6.317739 [ INFO] [1528203567.362664930]: Last Angle: 5.889652

And starting rqt_image_view i get the picture as shown below (for the camera) and the error does not occur (OpenCV Error: Unknown error code -10 (Raw image encoder error: Empty JPEG image (DNL not supported)) in throwOnEror, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgcodecs/src/grfmt_base.cpp, line 140) grafik

Nevertheless when i select /turtlebot3_panorama/panorama still i get the grey image as shown below grafik

routiful commented 6 years ago

The panorama msg is goint to publish when it is finished stiching.

For example,

encoding: bgr8
is_bigendian:
[ INFO] [1528203564.997826581]: Stiching 12 images
[ INFO:0] Initialize OpenCL runtime...
[ INFO] [1528203567.362583864]: Finished Stiching
[ INFO] [1528203567.362639221]: Publishing Completed Panorama **HERE!**
[ INFO] [1528203567.362655736]: Angle: 6.317739
[ INFO] [1528203567.362664930]: Last Angle: 5.889652

So, you are supposed to open rqt_image_view before it is finished

florianspy commented 6 years ago

Great now it works as expected thank you alot for your help and at least a picture is shown. But it looks like that only about 45 degree of the panorama picture so the last part of the pictures get published. Here are the commands i used rosservice call turtlebot3_panorama/take_pano 0 360.0 45.0 0.3 And the output of panorama terminal [ INFO] [1528357470.118679294]: Stiching 7 images [ INFO:0] Initialize OpenCL runtime... [ INFO] [1528357470.660252892]: Finished Stiching [ INFO] [1528357470.660438282]: Publishing Completed Panorama [ INFO] [1528357470.660458469]: Angle: 6.310041 [ INFO] [1528357470.660470675]: Last Angle: 6.006015

and the image produced: image

Furthermore if via rqt_image_view the panorama image is selected during the snapshot period it seems to crash the process and i get an empty picture again. The same happens if i looked at the panorama picture and later on want to take a new one with rqt_image_view still open. Furthermore when i look at compressed and panorama i sometimes get two totally different views panorama compressed

In all cases /turtlebot3_panorama/panorama/compressedDepth and /turtlebot3_panorama/panorama/theora remain grey in rqt_image_view

routiful commented 6 years ago

Yes, It's weird. I will debug and test it. If you find what is wrong, please let me know what was problem.

Thanks

routiful commented 6 years ago

Hi :)

Panorama example is depend on OpenCV library. I debugged turtlebot3_panorama node. But I couldn't find any problems.

So I tried more bigger angle to get stitched pano img. Then, I got almost 360 degree image. For example,

$ rosservice call turtlebot3_panorama/take_pano 0 420.0 30.0 0.3

I assume this is caused by algorithm in OpenCV. I will look into this later.

Thanks

florianspy commented 6 years ago

I tried your command but now i get a blank picture in rqt_image_view again and the following output in the terminal where i am running rqt_imageview: [ERROR] [1528965654.481582318]: /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgcodecs/src/loadsave.cpp:711: error: (-215) !buf.empty() && buf.isContinuous() in function imdecode

[ERROR] [1528965657.476861379]: Tried to advertise a service that is already advertised in this node [/rqt_gui_cpp_node_7366/compressed/setparameters] OpenCV Error: Assertion failed (!buf.empty() && buf.isContinuous()) in imdecode, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgcodecs/src/loadsave.cpp, line 711 [ERROR] [1528965661.494552942]: /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgcodecs/src/loadsave.cpp:711: error: (-215) !buf.empty() && buf.isContinuous() in function imdecode_

Also i get this output in the panorama terminal: OpenCV Error: Unknown error code -10 (Raw image encoder error: Empty JPEG image (DNL not supported)) in throwOnEror, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgcodecs/src/grfmt_base.cpp, line 140 [ERROR] [1528965659.286818488]: /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgcodecs/src/grfmt_base.cpp:140: error: (-10) Raw image encoder error: Empty JPEG image (DNL not supported) in function throwOnEror [ERROR] [1528965659.286990502]: [theora] Failed to create encoding context

When i run the command rosservice call turtlebot3_panorama/take_pano 0 180.0 30.0 0.3 status: 0 i get no error in the panorama terminal but in the rqt_view terminal i get the following output rqt_imageview OpenCV Error: Assertion failed (!buf.empty() && buf.isContinuous()) in imdecode, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgcodecs/src/loadsave.cpp, line 711 [ERROR] [1528966062.759299492]: /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgcodecs/src/loadsave.cpp:711: error: (-215) !buf.empty() && buf.isContinuous() in function imdecode_ and in rqt_image_view the panorama picture remains blank

When i then restart rqt_image_view and run the command turtlebot3_panorama/take_pano 0 180.0 30.0 0.3 again i get no errors in either of the windows and the picture of 180 degree is shown.

When i then restart rqt_image_view and run the command rosservice call turtlebot3_panorama/take_pano 0 420.0 30.0 0.3 i get no errors in either of the windows but the picture is still not 360 degree

It seems like everything only works smoothly when you quit
roslaunch turtlebot3_panorama panorama.launch after each run and launch it again and start rqt_image_view afterwards rosservice call turtlebot3_panorama/take_pano 0 420.0 30.0 0.3 Also i think rqt_view has to be open before rosservice call turtlebot3_panorama/take_pano 0 420.0 30.0 0.3 gets send on another terminal but roslaunch turtlebot3_panorama panorama.launch has to be launched before. But even then i sometimes just get grey images in rqt_image_view even so no error is show in any terminal when i then run rosservice call turtlebot3_panorama/take_pano 0 360.0 30.0 0.3 again with camera/rgb/image_raw selected it works But when i run another round with rosservice call turtlebot3_panorama/take_pano 0 360.0 30.0 0.3 i never get a new picture of the panorama also no errors are shown in any terminal Further remark: when selecting the panorama picture in rqt_image_view during the process of snapshot taking it seems to crash the process resulting in: at the end of panorama programm [ INFO] [1528970263.286862092]: Stiching 12 images [ INFO] [1528970269.967378861]: Finished Stiching [ERROR] [1528970269.967413585]: Compressed Depth Image Transport - Compression requires single-channel 32bit-floating point or 16bit raw depth images (input format is: bgr8). OpenCV Error: Unknown error code -10 (Raw image encoder error: Empty JPEG image (DNL not supported)) in throwOnEror, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgcodecs/src/grfmt_base.cpp, line 140 [ERROR] [1528970269.967481032]: /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgcodecs/src/grfmt_base.cpp:140: error: (-10) Raw image encoder error: Empty JPEG image (DNL not supported) in function throwOnEror [ERROR] [1528970269.968408150]: [theora] Failed to create encoding context

The error in the rqtview terminal: OpenCV Error: Assertion failed (!buf.empty() && buf.isContinuous()) in imdecode, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgcodecs/src/loadsave.cpp, line 711 [ERROR] [1528970593.464889213]: /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgcodecs/src/loadsave.cpp:711: error: (-215) !buf.empty() && buf.isContinuous() in function imdecode_

Seems to occure when i try to access an not available image

Further remark it also seems to help if in rqt_view no image is selected during the capture process but even this does not slove the problem that sometimes no picture gets published even so no error occured

routiful commented 6 years ago

Thank you for your digging stuff :)

I tested panorama node following you commented.

First, the stitched image is published after last snap. You can check it in panorama.cpp Second, Therefore, You have to open rqt_image_view before last snap. Third, Although I didn't re-open panorama launch file, I can start another process using rosservice Fourth, I can get a 360 degree image to use below commands

$ rosservice call turtlebot3_panorama/take_pano 0 420.0 30.0 0.3 

The OpenCV Error as you shown is caused by different development environments between you and me. Which do you used graphic card in your PC?

florianspy commented 6 years ago

Thank you alot for your reply. This is the graphic card i use: lspci | grep VGA 01:00.0 VGA compatible controller: NVIDIA Corporation GM107 [GeForce GTX 745] (rev a2) And this is the opencv version i use: libopencv-video2.4v5:amd64 2.4.9.1+dfsg-1.5ubuntu1 amd64 computer vision Video analysis library

One additional remark:even so turtlebot3_panorama/take_pano 0 360.0 30.0 0.3 was run sometimes only 6 pictures get stiched shouldn't it always be 12?

routiful commented 6 years ago

Thanks you for your information. I will search similar problems and how to work panorama library in OpenCV. Moreover, how about ask your question to ROS Answer? It might be get more quickly responses what you want.

robotpilot commented 6 years ago

This issue has been closed as there weren't recent activities. Please feel free to reopen this thread if there's any opinion to throw. Thanks.