locusrobotics / qgis_ros

ROS QGIS Plugin prototype
MIT License
45 stars 9 forks source link

Unavailable layer on QGIS #15

Open antoinepiedfert opened 3 years ago

antoinepiedfert commented 3 years ago

Hi @ablakey,

I've been trying to make your plugin work with my project. It looks like everything works fine until the QgsVectorLayer command is called in translator.py: layer = QgsVectorLayer(uri, topicName, 'rosvectorprovider'). The following lines: if not layer.isValid(): print("Layer failed to load!") I implemented immediately after said command does return an error.

To be more specific, all of my topics are detected and appear correctly in the available topics table from your plugin GUI. But whenever I select any of them and ask to create a layer, an empty layer is created with the expected name and source uri, but an error appears that says "Unavailable layer! Layer data source could not be found".

It seems like the problem comes from the provider. Have you encountered this issue before?

ablakey commented 3 years ago

Hello,

I haven't run into that before and am not immediately sure what to suggest. I would probably try to bifurcate the problem a little and see where you get. Can you load any other layer? What is the topic type for the layer(s) you're trying to load? Live or from a bag? Can you see the data from rostopic echo?

If you're comfortable, maybe try to remove the layer.isValid() test and see if it crashes and if the crash gives you a better error. Admittedly that's a pretty bad error message I provide.

antoinepiedfert commented 3 years ago

Thank you for your answer. I am not sure I understand correctly all of your questions so apologies if my answers are a bit confusing.

I tried with several topic types : sensor_msgs/NavSatFix or nav_msgs/Odometry and many others but all get the same error. QGIS works fine with .shp layers without using the plugin. I can see all the messages in those topics from rostopic echo so I know they exist. But if you mean can I see the json-like data generated by your plugin with rostopic echo - which I am not sure I'm supposed to be able to do - then no I can't. It looks like a uri is generated but no file or message is written there. What confuses me is that there is no crash or error related to a failure of QgsVectorLayer - which is why I added that layer .isValid() test in the first place. I haven't tried working with bags yet, so I don't know if the problem would be the same.

ablakey commented 3 years ago

Try to record some of your topic data into a bagfile and replay it that way. If it fails, and the bagged data is not sensitive, maybe you can send it to me and I can try doing some debugging.

Apologies, it's difficult to provide help without being able to reproduce the problem on my end.

antoinepiedfert commented 3 years ago

I will try that and get back to you whatever the outcome is. Thank you so much for your help!

antoinepiedfert commented 3 years ago

Hi @ablakey, After working a bit more on this issue, I can say that interestingly the "read from bag" option and creates a valid layer at the expected GPS coordinates.

I may have found the origin of the issue. When compiling, I get the following error message: [ 2%] Install requirements to /home/user/ros_project/myros_ws/build/venv ERROR: rosdep-modules 0.20.0 has requirement rospkg>=1.2.7, but you'll have rospkg 1.2.6 which is incompatible. ERROR: rosdep 0.20.0 has requirement rospkg>=1.2.7, but you'll have rospkg 1.2.6 which is incompatible. [ 2%] Prepare relocated virtualenvs for develspace and installspace [ 3%] Per-package virtualenv target [ 3%] Built target json_transport_generate_virtualenv Makefile:140: recipe for target 'all' failed make: *** [all] Error 2 Invoking "make -j8 -l8" failed.

I assume the issue comes from json_transport and not from the QGIS plugin.

ablakey commented 3 years ago

Thanks for digging. It might be. My colleague manages json_transport so he might have a comment on how to manage requirements.

@paulbovbel if you've got a moment.

paulbovbel commented 3 years ago

Please use catkin build instead of catkin_make to ensure isolated package builds, and post your build log

antoinepiedfert commented 3 years ago

I was able to fix this error by changing "rospkg=1.2.6" into "rospkg" in requirements.txt for ros-melodic-catkin-virtualenv. Unfortunately this did not fix the issue I have with the qgis-ros plugin.

mvancleaver commented 1 year ago

Is there any update on this issue? I'm encountering the same error while using the provided Docker container