Giter Site home page Giter Site logo

surgical-robotics-ai / surgical_robotics_challenge Goto Github PK

View Code? Open in Web Editor NEW
52.0 8.0 42.0 177.13 MB

Interactive Robot Assisted Suturing Simulation

Python 92.11% GLSL 7.64% Shell 0.25%
robotic-suturing-simulation ros surgical-robotics machine-learning-environment reinforcement-learning-environment

surgical_robotics_challenge's Introduction

Surgical Robotics Challenge

For more information regarding the challenge, please visit Surgical Robotics Challenge 2021-2022 or Surgical Robotics Challenge 2023-2024.

Discussions Forum

Please checkout the Discussions Tab for asking questions, posting suggestions, connecting with the community and for keeping up to date with the challenge.

1. Install AMBF and ROS Prerequisites

Make sure that the correct version of ROS is installed and sourced on your system. For streaming the image and depth data out of AMBF, please also install the following ROS packages

  • cv_bridge
  • image_transport
apt-get install ros-<version>-cv-bridge ros-<version>-image-transport

Then, clone, build and source AMBF's ambf-2.0 branch.

https://github.com/WPI-AIM/ambf/tree/ambf-2.0

First time cloning:

git clone https://github.com/WPI-AIM/ambf.git
cd ambf
git checkout -b ambf-2.0 origin/ambf-2.0

In case there are updates to AMBF, you can simply update your local copy by:

git pull

Don't forget to build the repo using the instructions on AMBF's Readme

2. Clone this repo to your local machine OR use a Dockerfile

Option 1: (Clone repo to your local machine)

Please refer to README in the scripts folder for instructions on installing the Python package for system-wide access.

Option 2: (Use Dockerfile)

You can alternatively use Dockerfiles to create Docker images by following the instructions here:

https://github.com/surgical-robotics-ai/docker_surgical_robotics_challenge

3. Running the simulation

The simulation is spawned in AMBF with the launch file and AMBF Description Format (ADF) files from this repo: The ambf_simulator binary resides in ambf/bin/lin-x86_64. You should be in that directory before running the commands below. Alternatively, you can create a symlink to this binary.

./ambf_simulator --launch_file <surgical_robotics_challenge>/launch.yaml -l 0,1,3,4,14,15 -p 120 -t 1 --override_max_comm_freq 120

This is an example of what the scene should look like (minus the motions of the PSM, Needle etc.):

To launch a different scene with just the needle (without any thread), you can run:

./ambf_simulator --launch_file <surgical_robotics_challenge>/launch.yaml -l 0,1,3,4,13,14 -p 200 -t 1 --override_max_comm_freq 120

And this is what the scene should now look like:

3a. The launch file:

To understand the launch file, visit the following link:

https://github.com/WPI-AIM/ambf/wiki/Selecting-Robots

3b. Simulated Cameras

The simulated camera(s) is defined in the World file (world_stereo.yaml) which is set in the launch.yaml file. To enable the camera(s) to publish the scene image or depth data, follow the instructions on this page:

https://github.com/WPI-AIM/ambf/wiki/Camera-feed-and-depth-camera

3c. Camera Coordinate frames

To better understand the different camera coordinate frames and the difference between the AMBF and the Opencv camera convention, please refer to camera_convention.md

3c. Resetting the Simulation

You can press CTRL+R to reset the rigid bodies in simulation, and CTRL+V to reset the camera pose if you changed it with the mouse.

3d. Launch Arguments:

The launch arguments provided above e.g. (-l 0,1,3,4,14,15 -p 200 -t 1) define the launch file, the list of ADF files to load, simulation frequency and time-stepping technique. For a full list of arguments, please refer to this link:

https://github.com/WPI-AIM/ambf/wiki/Command-Line-Arguments

4. Interacting with Simulated Robots using Python Scripts:

Please take a look at the scripts in the scripts folder:

5. Controlling via Input Devices

The code in the scripts folder allows the dVRK MTMs or Geomagic Touch / Phantom Omni to control the simulated PSMs.

With the simulation already running, run the dvrk-ros application for the dVRK MTMs or the ROS application for the Geomagic Touch/Phantom Omni. You can find the relevant code for them here:

a. https://github.com/jhu-dvrk/dvrk-ros (dvrk-ros)

b. https://github.com/WPI-AIM/ros_geomagic (geomagic_touch/phantom_omni)

Then run one of the corresponding python scripts:

a. scripts/surgical_robotics_challenge/teleoperation/mtm_multi_psm_control.py (For MTMs)

b. scripts/surgical_robotics_challenge/geomagic_multi_psm_control.py (For Geomagic Touch/Phantom Omni)

Refer to the README in the scripts folder for further information

6. Citation

If you find this work useful, please cite it as:

@article{munawar2022open,
  title={Open Simulation Environment for Learning and Practice of Robot-Assisted Surgical Suturing},
  author={Munawar, Adnan and Wu, Jie Ying and Fischer, Gregory S and Taylor, Russell H and Kazanzides, Peter},
  journal={IEEE Robotics and Automation Letters},
  volume={7},
  number={2},
  pages={3843--3850},
  year={2022},
  publisher={IEEE}
}

surgical_robotics_challenge's People

Contributors

adnanmunawar avatar alexander-thiesen avatar hisashiishida avatar jabarragann avatar jackhaoyingzhou avatar jieyingwu avatar jtzhanglogan avatar kschwan avatar pkazanzides avatar ruiruihuangannie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

surgical_robotics_challenge's Issues

Instruction on running simulation with ROS topic wrappers

For running teleoperation, we usually follow this pipeline:

  1. Run the AMBF simulator.
  2. Run the roslaunch for the devices
  3. Run the bash files, such as https://github.com/collaborative-robotics/surgical_robotics_challenge/blob/master/scripts/surgical_robotics_challenge/teleoperation/mtml_psm1_teleop.sh

Nevertheless, as mentioned in #73 (comment), we probably also need to run launch_crtk_interface.py to "wrap" the AMBF ROS topics.

I would like to suggest that we may add some comments or pipeline in the README.md (https://github.com/collaborative-robotics/surgical_robotics_challenge/blob/master/scripts/README.md) on how to run CRTK-wrapped teleoperation since it is not very clear.

In addition, I believe there is some existed issue as discussed in #30. A potential conflict may turn out when using AMBF topics. Would you mind providing some instructions on which topics I should avoid?

AMBF client not updating the pose of cameras and Camera frame

Hi Adnan,

To automatically collect data for a machine learning algorithm I was trying to use the AMBF clients to query the position of the cameras and camera frames while moving the virtual ECM with the GUI scripts. In this script, I am just instantiating the clients and then querying the camera's position every 1 second.

From the script, I was expecting to see changes in the cameraFrame's pose when moving the ECM sliders. Also, I was expecting to see changes in the cameraL/R when using my mouse to manually move them around. But, neither of these two things are happening. The 4x4 transformation matrices I get from the clients are always the same no matter how I interface with the simulator and they will only change every time I restart the script.

Could you advise me on how to get the correct poses from the clients?

from surgical_robotics_challenge.scene import Scene
from surgical_robotics_challenge.camera import Camera
from ambf_client import Client
import rospy
import time
import numpy as np
import tf_conversions.posemath as pm

np.set_printoptions(precision=3, suppress=True, sign=" ")

rospy.init_node("dataset_collection")
c = Client("juanclient")
c.connect()

# Create clients
scene = Scene(c)
ambf_cam_l = Camera(c, "cameraL")
ambf_cam_r = Camera(c, "cameraR")
ambf_cam_frame = Camera(c, "CameraFrame")

#Query camera pose.
counter = 0
flag = True
try:
    while flag:
        T_FC = pm.toMatrix(ambf_cam_l.get_T_c_w())
        T_WF = pm.toMatrix(ambf_cam_frame.get_T_c_w())
        print(f"pose at step {counter}")
        print(f"camera to frame\n {T_FC}")
        print(f"frame to world\n {T_WF}")
        print("\n\n\n")
        counter += 1
        time.sleep(1.5)
        if counter > 20:
            break

except Exception as e:
    print("Exit code")

Non blocking move_jp command for PSM arm

The move_jp command in the dVRK's crtk python API returns an object that has a wait() method. This object can be used to block the execution of the program until the move has finished. The AMBF psm class could be modified to implement this same behavior. Currently, move_jp in ambf are non-blocking.

Python can't find installed PyKDL

I'm trying to run the example gui controller to move the simulator robot arms.
I could not get my python to find PyKDL. I am using anaconda python.

Traceback (most recent call last):
  File "gui_based_control.py", line 45, in <module>
    from surgical_robotics_challenge.kinematics.psmIK import *
  File "/home/mr3albert/Documents/UCSD/SRIP_UCSD/surgical_robotics_challenge/scripts/surgical_robotics_challenge/kinematics/psmIK.py", line 46, in <module>
    from PyKDL import Vector, Rotation, Frame, dot
ModuleNotFoundError: No module named 'PyKDL'

I have already installed PyKDL using sudo apt install python3-PyKDL

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-pykdl is already the newest version (1.4.0-7ubuntu1).
The following packages were automatically installed and are no longer required:
  libassimp-dev libassimp5 libcurl4-openssl-dev libeigen3-dev libfreeimage3 libjxr0 libogre-1.9-dev
  libogre-1.9.0v5 liborocos-kdl-dev libtinyxml-dev libtinyxml2.6.2v5 liburdfdom-dev
  liburdfdom-headers-dev liburdfdom-model liburdfdom-model-state liburdfdom-sensor liburdfdom-world
  libzzip-0-13 linux-headers-5.4.0-91 linux-headers-5.4.0-91-generic linux-image-5.4.0-91-generic
  linux-modules-5.4.0-91-generic linux-modules-extra-5.4.0-91-generic ros-noetic-angles
  ros-noetic-laser-geometry ros-noetic-map-msgs ros-noetic-media-export ros-noetic-nav-msgs
  ros-noetic-resource-retriever ros-noetic-rosconsole-bridge ros-noetic-roswtf ros-noetic-tf
  ros-noetic-turtle-tf ros-noetic-urdf ros-noetic-visualization-msgs
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

I have downloaded pykdl from its anaconda page: https://anaconda.org/jf/pykdl
Then used conda install ~/Downloads/pykdl-1.4.0.pybind11-py38_1.tar.bz2
It shows it was installed and anaconda python still doesn't see it.

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

pip install pykdl says the package doesn't exist

Collecting pykdl
  Using cached PyKDL-1.4.0.tar.gz (1.5 kB)
    ERROR: Command errored out with exit status 1:
     command: /home/mr3albert/anaconda3/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-yyms9z4z/pykdl_8b1026bd22be46799ba5082b4126f8ff/setup.py'"'"'; __file__='"'"'/tmp/pip-install-yyms9z4z/pykdl_8b1026bd22be46799ba5082b4126f8ff/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-vefupkbi
         cwd: /tmp/pip-install-yyms9z4z/pykdl_8b1026bd22be46799ba5082b4126f8ff/
    Complete output (7 lines):
    running egg_info
    creating /tmp/pip-pip-egg-info-vefupkbi/PyKDL.egg-info
    writing /tmp/pip-pip-egg-info-vefupkbi/PyKDL.egg-info/PKG-INFO
    writing dependency_links to /tmp/pip-pip-egg-info-vefupkbi/PyKDL.egg-info/dependency_links.txt
    writing top-level names to /tmp/pip-pip-egg-info-vefupkbi/PyKDL.egg-info/top_level.txt
    writing manifest file '/tmp/pip-pip-egg-info-vefupkbi/PyKDL.egg-info/SOURCES.txt'
    error: package directory 'PyKDL' does not exist
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/48/1a/aa37dbcc769a54da4579ae1be049ddf445f6973455eadd05972163666219/PyKDL-1.4.0.tar.gz#sha256=a63eeb3f91d26e72cf369fa3f76d034f513f9d65d47d1de68fc3e783db6223d0 (from https://pypi.org/simple/pykdl/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement pykdl (from versions: 1.4.0)
ERROR: No matching distribution found for pykdl

Unable to simulate properly the first simulation example

Hi Surgical Robotics Challenge Team,
I am trying to run the first simulation by running the command ./ambf_simulator --launch_file <surgical_robotics_challenge>/launch.yaml -l 0,1,3,4,14,15 -p 120 -t 1 --override_max_comm_freq 120

I get
image

rather than
image

The output from ./ambf_simulator command is:
INFO! USING SIMULATION SPEED FACTOR OF: 1
WARNING! For File "/home/robot/surgical_robotics_challenge/launch.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/robot/surgical_robotics_challenge/ADF/world/world_stereo.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/robot/surgical_robotics_challenge/ADF/input_devices/input_devices.yaml", ADF version not defined thus assuming VERSION_1_0
INFO! INITIALIZING ROS NODE HANDLE
INFO! Thread Joined: Plane
INFO! Thread Joined: light2
INFO! CAMERA "cameraL" MONITOR NUMBER "1" IS NOT IN RANGE OF AVAILABLE MONITORS "1", USING DEFAULT
INFO! Thread Joined: cameraL
INFO! CAMERA "cameraR" MONITOR NUMBER "2" IS NOT IN RANGE OF AVAILABLE MONITORS "1", USING DEFAULT
INFO! Thread Joined: cameraR
WARNING! MULTIPLE OBJECTS WITH SUB-STRING: "BODY CameraFrame" FOUND. PLEASE SPECIFY FURTHER
WARNING! MULTIPLE OBJECTS WITH SUB-STRING: "BODY CameraFrame" FOUND. PLEASE SPECIFY FURTHER
WARNING! MULTIPLE OBJECTS WITH SUB-STRING: "BODY CameraFrame" FOUND. PLEASE SPECIFY FURTHER
INFO! Thread Joined: World
WARNING! For File "/home/robot/surgical_robotics_challenge/ADF/psm1.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/robot/surgical_robotics_challenge/ADF/sensors_actuators_psm1.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/robot/surgical_robotics_challenge/ADF/psm2.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/robot/surgical_robotics_challenge/ADF/sensors_actuators_psm2.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/robot/surgical_robotics_challenge/ADF/ghosts.yaml", ADF version not defined thus assuming VERSION_1_0
WARNING! For File "/home/robot/surgical_robotics_challenge/ADF/phantom_with_thread.yaml", ADF version not defined thus assuming VERSION_1_0
ERROR! COLLISION MESH TYPE "" NOT UNDERSTOOD
INFO! Thread Joined: baselink
INFO! Thread Joined: toolyawlink
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED baselink-yawlink OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED yawlink-pitchbacklink OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED pitchendlink-maininsertionlink OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED maininsertionlink-toolrolllink OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED toolrolllink-toolpitchlink OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED toolpitchlink-toolyawlink OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED toolyawlink-toolgripper1link OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED toolyawlink-toolgripper2link OF TYPE: JOINT NOT IMPLEMENTED YET
INFO! Thread Joined: Sensor0
INFO! Thread Joined: Actuator0
INFO! Thread Joined: baselink
INFO! Thread Joined: toolyawlink
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED baselink-yawlink OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED yawlink-pitchbacklink OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED pitchendlink-maininsertionlink OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED maininsertionlink-toolrolllink OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED toolrolllink-toolpitchlink OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED toolpitchlink-toolyawlink OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED toolyawlink-toolgripper1link OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED toolyawlink-toolgripper2link OF TYPE: JOINT NOT IMPLEMENTED YET
INFO! Thread Joined: Sensor0
INFO! Thread Joined: Actuator0
WARNING! MULTIPLE OBJECTS WITH SUB-STRING: "BODY Entry1" FOUND. PLEASE SPECIFY FURTHER
WARNING! MULTIPLE OBJECTS WITH SUB-STRING: "BODY Entry2" FOUND. PLEASE SPECIFY FURTHER
WARNING! MULTIPLE OBJECTS WITH SUB-STRING: "BODY Entry3" FOUND. PLEASE SPECIFY FURTHER
WARNING! MULTIPLE OBJECTS WITH SUB-STRING: "BODY Entry4" FOUND. PLEASE SPECIFY FURTHER
WARNING! MULTIPLE OBJECTS WITH SUB-STRING: "BODY Exit1" FOUND. PLEASE SPECIFY FURTHER
WARNING! MULTIPLE OBJECTS WITH SUB-STRING: "BODY Exit2" FOUND. PLEASE SPECIFY FURTHER
WARNING! MULTIPLE OBJECTS WITH SUB-STRING: "BODY Exit3" FOUND. PLEASE SPECIFY FURTHER
WARNING! MULTIPLE OBJECTS WITH SUB-STRING: "BODY Exit4" FOUND. PLEASE SPECIFY FURTHER
INFO! Thread Joined: BlackGround
ERROR! CameraFrame COLLISION TYPE NOT UNDERSTOOD
INFO! Thread Joined: CameraFrame
INFO! Thread Joined: Ledge
INFO! Thread Joined: Needle
INFO! Thread Joined: Phantom
INFO! Thread Joined: Barrier
INFO! Thread Joined: Entry1
INFO! Thread Joined: Entry2
INFO! Thread Joined: Entry3
INFO! Thread Joined: Entry4
INFO! Thread Joined: Exit1
INFO! Thread Joined: Exit2
INFO! Thread Joined: Exit3
INFO! Thread Joined: Exit4
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Phantom-Entry2 OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Phantom-Exit2 OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Phantom-Exit1 OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Phantom-Exit3 OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Phantom-Exit4 OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Phantom-Entry1 OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Phantom-Entry3 OF TYPE: JOINT NOT IMPLEMENTED YET
ERROR! COMMUNICATION TYPE FOR OBJECT NAMED Phantom-Entry4 OF TYPE: JOINT NOT IMPLEMENTED YET
WARNING! Required parent name of /ambf/env/lights/light2 set as BODY CameraFrame. Parenting to closest match /ambf/env/BODY CameraFrame
WARNING! Required parent name of /ambf/env/cameras/cameraL set as BODY CameraFrame. Parenting to closest match /ambf/env/BODY CameraFrame
WARNING! Required parent name of /ambf/env/cameras/cameraR set as BODY CameraFrame. Parenting to closest match /ambf/env/BODY CameraFrame
WARNING! Required parent name of /ambf/env/psm/ghostEntry1 set as BODY Entry1. Parenting to closest match /ambf/env/BODY Entry1
WARNING! Required parent name of /ambf/env/psm/ghostEntry2 set as BODY Entry2. Parenting to closest match /ambf/env/BODY Entry2
WARNING! Required parent name of /ambf/env/psm/ghostEntry3 set as BODY Entry3. Parenting to closest match /ambf/env/BODY Entry3
WARNING! Required parent name of /ambf/env/psm/ghostEntry4 set as BODY Entry4. Parenting to closest match /ambf/env/BODY Entry4
WARNING! Required parent name of /ambf/env/psm/ghostExit1 set as BODY Exit1. Parenting to closest match /ambf/env/BODY Exit1
WARNING! Required parent name of /ambf/env/psm/ghostExit2 set as BODY Exit2. Parenting to closest match /ambf/env/BODY Exit2
WARNING! Required parent name of /ambf/env/psm/ghostExit3 set as BODY Exit3. Parenting to closest match /ambf/env/BODY Exit3
WARNING! Required parent name of /ambf/env/psm/ghostExit4 set as BODY Exit4. Parenting to closest match /ambf/env/BODY Exit

PSMs don't reach commanded set-points

Hi @adnanmunawar,
I'm revisiting Task 2 (needle grasping and driving) as we have some students wanting to use the simulated environment in a project. I'm experiencing some issues however:

It doesn't seem like the PSM's are able to reach the commanded joint space set-points. Are they not supposed to, can it be improved, or is it an error on my part?

I attach an example where I command the robot to move to a Needle/Grasp frame. The joint space set-point is computed through surgical_robotics_challenge.kinematics.psmIK.compute_IK and published on the /CRTK/psm2/servo_jp topic (interpolating a trajectory in joint space).

The images below show the simulator view, and the commanded Needle/Grasp frame and current /CRTK/psm2/measured_cp pose.

psm2.txt has rostopic output corresponding to the state shown in the images.

I interface with the simulator via launch_crtk_interface.py and I have set add_joint_errors=False.

I use 314a4ba and WPI-AIM/ambf@18637b4.

PS. I have the same issue using velocity control.

Screenshot from 2023-03-01 10-27-20

Screenshot from 2023-03-01 10-27-38

The Python control/examples scripts do not terminate cleanly

The following scripts do not terminate on Ctrl-C or closing the TKinter GUI.

teleoperation/mtm_multi_psm_control.py

teleoperation/geomagic_multi_psm_contro.py

examples/gui_based_control.py

examples/ecm_control.py

The culprit is the background thread in the utilities/cartesian_interpolate_step method.

Unable to grasp needle, proximity not detected

Hi @adnanmunawar,
I'm revisiting Task 2 (needle grasping and driving) as we have some students wanting to use the simulated environment in a project. I'm experiencing some issues however:

Even though the tool is placed in a "good" pose, I'm unable to grasp the needle (it is not detected by the "proximity sensor" and thus not attached to the tool). I notice that only one object is listed in /ambf/env/psm2/Sensor0/State/sensed_objects at any one time. Almost always it's Phantom when close to the needle (lying on the phantom).

Below is a small video to help show the problem (motions look jerky but that's because of poor video recording).

I interface with the simulator via launch_crtk_interface.py and I have set add_joint_errors=False.

I use 314a4ba and WPI-AIM/ambf@18637b4.

Screencast.from.2023-03-01.15.56.40.webm

Error running gui_based_control.py

Hi - I am trying to run gui_based_control.py but am receiving the error:

$ python3 gui_based_control.py 
Traceback (most recent call last):
  File "surgical_robotics_challenge/scripts/surgical_robotics_challenge/examples/gui_based_control.py", line 45, in <module>
    from surgical_robotics_challenge.kinematics.psmIK import *
  File "surgical_robotics_challenge/scripts/surgical_robotics_challenge/kinematics/psmIK.py", line 46, in <module>
    from PyKDL import Vector, Rotation, Frame, dot
ModuleNotFoundError: No module named 'PyKDL'

The AMBF simulator is running fine with the suture challenge launch file. But when I try to run gui_based_control.py, I receive that error.

I tried installing to the system:

$ sudo apt-get install python3-pykdl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-pykdl is already the newest version (1.4.0-7ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.

I also re-installed the modules:

$ pip3 install -e .
Obtaining file:///surgical_robotics_challenge/scripts
  Preparing metadata (setup.py) ... done
Installing collected packages: surgical-robotics-challenge
  Attempting uninstall: surgical-robotics-challenge
    Found existing installation: surgical-robotics-challenge 1.0
    Uninstalling surgical-robotics-challenge-1.0:
      Successfully uninstalled surgical-robotics-challenge-1.0
  Running setup.py develop for surgical-robotics-challenge
Successfully installed surgical-robotics-challenge-1.0

And I located the PyKDL shared object file:

/usr/lib/python3/dist-packages$ find -type f -name "PyKDL*.so"
./PyKDL.cpython-38-x86_64-linux-gnu.so

So it exists, but:

$ python3 -c "import PyKDL"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'PyKDL'

Any thoughts would be appreciated, thanks!

project_needle_pts.py script not working and throwing error

Hi Everyone,
When I try to run the project_needle_pts.py script, it throws an error:

OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/highgui/src/window.cpp, line 304
Traceback (most recent call last):
File "project_needle_pts.py", line 125, in
cv2.imshow("img", img)
cv2.error: /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/highgui/src/window.cpp:304: error: (-215) size.width>0 && size.height>0 in function imshow

The script seems to not be able to get images from ROS node. Thank you for your time.

Incorrect joint angles being set

Hi,

I am trying to send IK solutions for simple 1D sinusoidal motion of the end effector as in the example script (crtk_ros_based_control.py). The correct IK solutions are being published. However, the joint angles being set on the simulation are incorrect, i.e. the robot does not move in a simple sinusoidal manner in the given direction. I think this could be an issue with the ambf server side, I'm not sure.

Can you please suggest what could be the issue? I could provide any additional details required as well as any images etc.

Geomagic teleoperation control not working

When I set up everything and tried to run the Geomagic teleoperation control, I came across the following error:

Traceback (most recent call last):
File "geomagic_multi_psm_control.py", line 194, in
psm = PSM(simulation_manager, arm_name, add_joint_errors=False)
File "/home/zhyjack/daVinci_simulation/scripts/surgical_robotics_challenge/psm_arm.py", line 83, in init
self.base.set_joint_types([JointType.REVOLUTE, JointType.REVOLUTE, JointType.PRISMATIC, JointType.REVOLUTE,
AttributeError: 'NoneType' object has no attribute 'set_joint_types'

It seems like that it has some "name" inconsistency in simulation_manager.py . Would you mind double checking it? Thank you!

How to enable gravity compensation for MTM teleoperation control

Hi Adnan,

Hope all is well!

I would like to ask about the instruction or hints about how to enable gravity compensation for MTM teleoperation control. Is there any method that we can use to enable gravity compensation for teleoperation control in AMBF?

Thank you and look forward to hearing from you!

No force feedback using Geomagic & PHANToM Omni (Single Device Configuration)

Hi all,

I've been trying to troubleshoot an issue I had due to the lack of information when I run:

rostopic echo /Geomagic/force_feedback
The topic seems to be published, yet not showing anything I can work with. My PHANToMConfiguration and PHANToMTest run just like they are supposed to, that is to say, I do receive force feedback when testing the haptic device. So I don't think it is a HW problem.

AMBF Simulator runs with the -e 1 flag to activate force feedback as follows:

ambf_simulator --launch_file surgical_robotics_challenge/launch.yaml -l 0,1,3,4,14,17 -p 120 -e 1 -t 1 --override_max_comm_freq 120
roslaunch geomagic_control geomagic_headless.launch runs without any kind of problems as well. However, I've encountered something that I think could be related to this issue when the geomagic_multi_psm_control.py code is running (either using rosrun on my own package or independently with python3). Here I attach a screenshot of the output, where you may see that some important objects were not found:

image

The rest of the topics work just fine, and I can control the robot arms using the same haptic device. I just don't receive any force feedback as a ROS topic or, even physically, throughout the PHANToM Omni.

Hope you can help me sort this out, I've been stuck for almost two weeks.

Thanks,
Nezih N

Error on loading the surgical robotics challenger simulator

When use the command "./ambf_simulator --launch_file ~/ Desktop/surgical_robotics_challenge/launch.yaml -l 0,1,3,4,13,14 -p 200 -t 1", the program will give an error that is "terminate called after throwing an instance of 'YAML::TypedBadConversion'
what(): yaml-cpp: error at line 0, column 0: bad conversion
Aborted (core dumped)"
Could you please help me solve this issue?

Screenshot from 2021-10-21 23-46-12

Screenshot from 2021-10-21 23-46-42

ROS package source conflict

AMBF and rog_Geomagic are both required to be complied and please check the following figure of the error in the terminal. You can see that it will raise an error of not finding corresponding modules firstly. Nevertheless, when I source the AMBF package, the geomagic control package cannot be found.

I can solve it by temporarily adding the directory to sys.path, but probably you may have some better solutions. Therefore, would you mind letting me know your thoughts about how to solve it? Thanks!

Selection_003

Weird oscillations in simulator

I have a issue with the ambf simulator oscillating. I'm trying to control psm2 through the /CRTK/psm2/servo_cp topic. After settling on a point, it starts oscillating like crazy. Here is a video:

video

Any ideas whats going on?

Extra offset at PSM Tip for FK and IK compared to the dVRK

The dVRK manual specifies an extra offset between the last joint (wrist yaw joint) and the tip of the jaws (along the center line). This is called yaw to control point (abbreviated as Yaw2Ctrlpnt) as shown in the figure below.

Screenshot from 2023-10-10 16-19-14

The sawIntuitiveResearchKit sets this value to 0.0 while this repo does not. For consistency, there are two options.

  1. Add the Yaw2Ctrlpnt offset in the sawIntuitiveResearchKit.
  2. Remove the Yaw2Ctrlpnt offset in this repo (SRC).

While 1. seems more logical, we analyzed a clinical da Vinic (SI model) and discovered that it does not consider the Yaw2Ctrlpnt' offset. We tested this via teleoperating using an MTM and holding all the MTM joints fixed except the 3rdlast and2ndlast joint independently. The SI PSM tool (Large Needle Driver) rotated around thewrist yaw jointrather than at some point further along between the jaws. Had theYaw2Ctrlpnt` offset been considered, the SI PSM tool would indeed have rotated at some other point.

Thus we should also ignore the Yaw2Ctrlpnt offset for consistency and mark it as such in the dVRK manual.

Cannot import surgical robotics challenge modules

After installing the simulator and start the surgical simulator, I try to run the demo codes in the example folder.
Before the operation, I also follow the instruction in the Script folder and run "pip install -e .", which shows: Successfully installed surgical-robotics-challenge-1.0.

However, it outputs: ImportErrpr: No module named surgical_robotics.challenge when we run the example code, e.g., project_needle_pts.py.
I used the Ubuntu 18.04 system, with row melodic. When running the simulator, we used: python2 + .

Is there anything I need to pay attention to or any mistake I made?

Camera frames do not correspond to the docs

Hi,

I believe the CameraL and CameraR frames do not correspond to what's in the docs -- they are rotated 180 degrees about their Z axis (which is pointing upward correctly).

I have visualized the frames in RViz to confirm my suspicion:
image

Joint errors model

I noticed that in line 72 file joint_errors_model.py for initializing joint error models

rand_val = 2. * random() - 1. 

will always give positive value for rand_val and therefore for the joint errors. I think you might want to flip the sign there.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.