auctus-team / pycapacity

An efficient task-space capacity calculation package for robotics and biomechanics
https://auctus-team.github.io/pycapacity/
MIT License
26 stars 2 forks source link

[JOSS Review] Issues with Doc Examples #5

Closed sea-bass closed 1 year ago

sea-bass commented 1 year ago

In addition to https://github.com/auctus-team/pycapacity/issues/4, I have some feedback on the examples themselves:

Robotics Toolbox Example

I can't get the Swift example working in my Python 3.10 environment -- I keep getting this error when visualizing

Traceback (most recent call last):
  File "/home/sebastian/Workspace/pycapacity/.virtualenvs/pycapacity/lib/python3.10/site-packages/websockets/legacy/server.py", line 240, in handler
    await self.ws_handler(self)
  File "/home/sebastian/Workspace/pycapacity/.virtualenvs/pycapacity/lib/python3.10/site-packages/websockets/legacy/server.py", line 1186, in _ws_handler
    return await cast(
  File "/home/sebastian/Workspace/pycapacity/.virtualenvs/pycapacity/lib/python3.10/site-packages/swift/SwiftRoute.py", line 320, in serve
    await self.expect_message(websocket, expected)
  File "/home/sebastian/Workspace/pycapacity/.virtualenvs/pycapacity/lib/python3.10/site-packages/swift/SwiftRoute.py", line 325, in expect_message
    recieved = await websocket.recv()
  File "/home/sebastian/Workspace/pycapacity/.virtualenvs/pycapacity/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 568, in recv
    await self.ensure_open()
  File "/home/sebastian/Workspace/pycapacity/.virtualenvs/pycapacity/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 935, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedOK: received 1001 (going away); then sent 1001 (going away)

Also, I had to additionally pip install networkx because it was another missing dependency not listed anywhere.


Pinocchio Example

The pip instructions just say pip install pin, but actually you need other things like example-robot-data, meshcat, etc. Make sure this is consistent.

Also, the first (static) Meshcat example works for me but it's all blank... any ideas? image

The animation one works fine... image

Actually, if in the first example I stick these lines at the end, the robot ends up rendering fine.

while True:
    viz.display(q0)

Four Link Planar Robot

If running from the top of the module, this import fails:

from four_link_utils import *

The doc says to copy files to a four_link_utils.py, but maybe worth having an easier way to just use the one that already exists in the examples folder? Or tell people to just define the necessary utils in the same example file?

https://github.com/openjournals/joss-reviews/issues/5670

askuric commented 1 year ago

Hey @sea-bass,

Thanks for the feedback.

robotics toolbox

So first of all the Swift one is a tricky one, I am not sure what is going on. However, there seems to be an issue related to it: https://github.com/jhavl/swift/issues/47

It seems to be something related to the new swig version. However, I think I was able to find the issue. It seems that the local path to the generated stl file was not properly found. So it needs to be set to the absolute path. I've updated the docs to include the absolute path.

Also, I had to additionally pip install networkx because it was another missing dependency not listed anywhere.

Thanks, I've updated the docs to include all the missing packages.

pinocchio

The pip instructions just say pip install pin, but actually you need other things like example-robot-data, meshcat, etc. Make sure this is consistent.

Thanks, I've updated the docs to take this in consideration. I was completely concentrated on anaconda install that I've forgot to write the steps for the pip version.

Also, the first (static) Meshcat example works for me but it's all blank... any ideas?

Here I think the issue is the PC speed, sometimes the pc does the rest of the program faster than the visualisation is opened and then some strange stuff can happen. Could you please try adding a timeout after viz.initViewer(open=True) and viz.display(q0) something like this:

time.sleep(0.5)

Also you'll gona have to import the time module

import time

If this works I'll add it directly to the library docs.

four link robot

Four link robot is convenient for testing so I've put it into a module called examples. Maybe we're gonna have some more toy systems inside at some point. So with this in mind the code in the docs is much simpler and no need to create additionally files. Here is the module and here are the updated docs .

sea-bass commented 1 year ago

Thanks for tackling this!

Robotics Toolbox

Swift example works for me now!

Pinocchio

Confirming that adding a 0.5 sec timeout makes the Meshcat visualization render for me!

Four link robot

Works great with the new module -- thanks!

Unsure if you should do this, but fixing the random seed will ensure that the output shown in the doc is identical to that the users will see. Then, users can opt to either leave out the seed or change it.

askuric commented 1 year ago

Awesome,

I've added a delay in the pinocchio example, as well as a short comment saying why its there and what to do if the model still does not show.

Unsure if you should do this, but fixing the random seed will ensure that the output shown in the doc is identical to that the users will see. Then, users can opt to either leave out the seed or change it.

Makes perfect sense, I've added a seed for all the randomly generated examples so that they initially correspond to the images in the docs. For example in the case of 4 link here and random human here.

sea-bass commented 1 year ago

Fantastic -- thank you!