jhu-dvrk / dvrk-ros

daVinci Research Kit ROS stack. See dVRK wiki to get started: https://github.com/jhu-dvrk/sawIntuitiveResearchKit/wiki
https://github.com/jhu-dvrk/sawIntuitiveResearchKit/wiki
Other
100 stars 80 forks source link

dvrk_ros/dvrk_python README page needs update #48

Closed jkim447 closed 9 months ago

jkim447 commented 9 months ago

Hello, amazing work as always. The example in the README of "dvrk_ros/dvrk_python" folder does not work.

It is currently written as the below:

import dvrk
# Create a Python proxy for PSM1, name must match ros namespace
p = dvrk.psm('PSM1')

It should be updated to something like the following:

import dvrk
import crtk
import time

# Create a Python proxy for PSM1, name must match ros namespace
ral = crtk.ral('testNode')
p = dvrk.psm(ral, 'PSM1')

p.enable()
p.home()
time.sleep(0.2) # need to sleep, otherwise the following code involving motion may not work. In an interactive setting like ipython, this is not needed

Note that I've also added a time.sleep(0.2) otherwise the following code that involves motion may not work. Sleep is not required in an interactive setting like ipython.

adeguet1 commented 9 months ago

I ported the README documentation to the wiki to avoid having duplicates for the ROS 1 and ROS 2 packages: https://github.com/jhu-dvrk/sawIntuitiveResearchKit/wiki/PythonOverROS

adeguet1 commented 9 months ago

Note that we added crtk.ral.check_connections() that should solve the sleep issue you ran into. Let me know if that doesn't work on your end.