jupyter-robotics / jupyterlab-urdf

A URDF viewer and editor extension for JupyterLab.
https://jupyterlab-urdf.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
97 stars 9 forks source link

404 errors trying to load examples. #4

Closed jetdillo closed 2 years ago

jetdillo commented 2 years ago

I'm seeing lots of errors when trying to load the example URDFs:


[W 2022-07-07 23:29:41.496 ServerApp] 404 GET /ros/pkgs/spot_description/meshes/base.stl (127.0.0.1) 15.71ms referer=http://localhost:8888/lab/workspaces/auto-G/tree/examples/spot.urdf
[W 2022-07-07 23:29:41.498 ServerApp] 404 GET /ros/pkgs/spot_description/meshes/fr.lleg.stl (127.0.0.1) 1.09ms referer=http://localhost:8888/lab/workspaces/auto-G/tree/examples/spot.urdf
[W 2022-07-07 23:29:41.501 ServerApp] 404 GET /ros/pkgs/spot_description/meshes/fl.hip.stl (127.0.0.1) 2.34ms referer=http://localhost:8888/lab/workspaces/auto-G/tree/examples/spot.urdf
[W 2022-07-07 23:29:41.502 ServerApp] 404 GET /ros/pkgs/spot_description/meshes/fl.uleg.stl (127.0.0.1) 2.77ms referer=http://localhost:8888/lab/workspaces/auto-G/tree/examples/spot.urdf

This happens whether I source my ~/catkin_ws/devel/setup.bash script or not. 

I don't have any directories named /ros/pkgs, nor do there appear to be any in the repo. 

It would be helpful if there were some additional hints about startup, whether we should be setting any environment variables or passing additional arguments to jupyterlab-urdf from the command-line. 
Thanks!
IsabelParedes commented 2 years ago

This should be resolved by installing jupyterlab-ros in your environment

conda install jupyterlab-ros -c robostack

I need to add this detail to the documentation, but let me know if that still doesn't work.

jetdillo commented 2 years ago

Cool. Thanks. I'll try that. I figured it had to be something like that because the Niryo model mostly loads and the Tenacity Rover URDF partially loads as well, but can't find all the meshes.

I'll let you know what happens.

jetdillo commented 2 years ago

I have a new, fresh conda environment I'm running jupyterlab-ros in and still seeing these errors. It looks like the Jupyter server is pre-pending some sort of path to the request:

[W 2022-07-10 16:16:00.966 ServerApp] 404 GET /ros/pkgs/urdf_tutorial/meshes/l_finger.dae (127.0.0.1) 1.33ms referer=http://localhost:8888/lab/tree/jupyterlab-urdf/examples/niryo.urdf

Because that file exists in the robostack repo:

(ros_env):~/miniconda3/envs/ros_env$ find . -name "l_finger.dae"
./pkgs/urdf_tutorial/meshes/l_finger.dae
./pkgs/ros-noetic-urdf-tutorial-0.5.0-py39h6fdeb60_13/share/urdf_tutorial/meshes/l_finger.dae
./share/urdf_tutorial/meshes/l_finger.dae
(ros_env):~/miniconda3/envs/ros_env

I tried setting the ROS_PACKAGE_PATH to include the urdf_tutorial package, but that didn't help. (The Foxglove-Studio app also has a bug with its ROS_PACKAGE_PATH expansion when trying to load URDFs)

I'm not a total expert with Jupyter, so it's possible I'm missing something fundamental here.

IsabelParedes commented 2 years ago

This sounds more like a ROS configuration issue than a problem with the extension itself to be honest. These are the steps I would follow to set it up, could you verify this is what you did as well?

  1. Create a new conda environment, you only need these 4 packages to display niryo.urdf
    conda create -n ros_env jupyterlab jupyterlab-ros jupyterlab-urdf ros-noetic-urdf-tutorial -c conda-forge -c robostack
  2. Activate the environment
    conda activate ros_env
  3. Check the ROS package path
    echo $ROS_PACKAGE_PATH

    it should return something like

    ~/miniconda3/envs/ros_env/share
  4. Check that you can run roscore in that environment
  5. Check that urdf_tutorial is in the ROS path with roscd urdf_tutorial for example
  6. Launch JupyterLab from the activated environment
    jupyter lab
  7. Check that the rosmaster is running (green circle, bottom left of JupyterLab)
  8. If everything checks out, the niryo.urdf should display

Hope this helps!

jetdillo commented 2 years ago

I had a chance to get back to this and re-install from scratch and got it working. The key steps I did in addition to the above was to

This might be obvious to some, but not being overly familiar with jupyter, it took a bit for me to figure out. Typically, for a binary-only install in a native ROS environment, you can launch nodes without need to setup and build a catkin env.