dVRK setup (SurGLab) - gkgkgk1215/else GitHub Wiki

Reference

System Version

  • Original version: da Vinci S full system (clinical)
  • We replaced the existing arms with 1 PSM and 1 ECM provided by IS, ensuring compatibility with the dVRK system.
  • Current configuration: Si ver. for PSM&ECM, Classic ver. for MTM

Hardware Setup for Patient Cart

  1. Clean-up: Remove all electronic components in the base of the patient cart, including battery, power supply, FPGA circuit etc

2-1. Controller: Place the 4 DVRK controllers in this space. Open the housing of each controller and set the board ID.

2-2. dSIB board: Connect the controller’s dSIB board, safety chain, FireWire (or Ethernet) cable, and power cable. (Refer to the dVRK Wiki for details.) Use #4-40x3/8inch (L=9.5mm) screw to tighten dSIB board to the back of the controller.

  1. (IMPORTANT) ESPM setting: Check the number of custom ESPM boards you have:
  • You will need: 1 ESPM board per SUJ and 1 ESPM board per PSM(or ECM). The ESPM boards are provided by JHU.
  • In our case, we have 8 ESPM board in total for 4 SUJ and 3 PSM with 1 ECM.
  • These boards are responsible for updating the firmware of each arm at every boot.
  • You must ensure that the appropriate version of the firmware is correctly copied to the Micro SD card inserted in each ESPM board.
  • For the boards attached to PSM/ECM, copy the firmware from the following link:

https://github.com/jhu-cisst/mechatronics-embedded/releases/latest/download/fpgav3-micro-sd.zip

  • For the boards attached to the SUJ, use the firmware provided by JHU.
  • Each controller also has a Micro SD card, and the same firmware as PSM/ECM should be copied onto it.
  1. Remove the plastic cover on the PSM/ECM and connect the ESPM board. Make sure the cable with the yellow marking must be oriented toward the board.
  2. Remove the platic cover on the SUJ and connect the ESPM board. With the internal board of the SUJ facing you, plug the ESPM board into the connector located on the left side. Make sure the cable with the yellow marking must be oriented toward the board.
  3. Turn on the power of the controller. Each ESPM board's LED will briefly turn on (approximately 1 second) and then turn off. In our configuration, PSM/ECM boards showed a white LED, and SUJ boards showed a blue LED.

Hardware Setup for Surgeon's Console

  1. Cover: Remove the plastic covers on the side/back of the master console.

  2. Clean-up: Remove all electric components at the back, including battery, power supply, PCB boards, etc. Please refer to the document, S_Console_Disassembly from dVRK community. We only need large cables connected to MTM. But NEVER CUT electrical wires.

  3. Connect the thick cables that comes from the MTM to the controller.

  4. Update the micro-SD card in the MTM controller. (one card for each controller)

  5. Check connection of the safety chain, firewire, etc.

Install dVRK Software

  1. Python setting:
sudo apt install python-is-python3
  1. Install ROS
  2. Install dependencies

For Ubuntu 20.04 with ROS Noetic,

sudo apt install libxml2-dev libraw1394-dev libncurses5-dev qtcreator swig sox espeak cmake-curses-gui cmake-qt-gui git subversion gfortran libcppunit-dev libqt5xmlpatterns5-dev libbluetooth-dev libhidapi-dev python3-pyudev python3-vcstool python3-catkin-tools python3-osrf-pycommon

For Ubuntu 22.04 with ROS Humble,

sudo apt install python-is-python3 python3-vcstool python3-colcon-common-extensions python3-pykdl libxml2-dev libraw1394-dev libncurses5-dev qtcreator swig sox espeak cmake-curses-gui cmake-qt-gui git subversion libcppunit-dev libqt5xmlpatterns5-dev libbluetooth-dev libhidapi-dev python3-pyudev ros-humble-joint-state-publisher* ros-humble-xacro
  1. Install dvrk packages

For Ubuntu 20.04,

# this depends on the ROS version you're using
source /opt/ros/noetic/setup.bash
mkdir -p ~/catkin_ws/src           # create the catkin workspace
cd ~/catkin_ws                     # go in the workspace
catkin init                        # create files for catkin build tool
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release # all code should be compiled in release mode
cd src

# go in source directory to pull code
# make sure you use the correct vcs file
vcs import --input https://raw.githubusercontent.com/jhu-saw/vcs/main/ros1-dvrk-2.3.1.vcs --recursive
catkin build --summary             # ... and finally compile everything
source ~/catkin_ws/devel/setup.bash

For Ubuntu 22.04,

# this depends on the ROS version you're using
source /opt/ros/humble/setup.bash
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
# make sure you use the correct vcs file
vcs import --input https://raw.githubusercontent.com/jhu-saw/vcs/main/ros2-dvrk-2.3.1.vcs --recursive

cd ~/ros2_ws
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
source ~/ros2_ws/install/setup.bash
  1. Install config files
cd ~/catkin_ws/src
git clone https://github.com/gkgkgk1215/dvrk_config_dgist.git
  1. Add the following lines at the end of your ~/.bashrc file:

For Ubuntu 20.04,

# for ROS
if [ -f ~/catkin_ws/devel/setup.bash ]; then
  . ~/catkin_ws/devel/setup.bash
fi
# for cisst (optional)
if [ -f ~/catkin_ws/devel/cisstvars.sh ]; then
  . ~/catkin_ws/devel/cisstvars.sh
fi

For Ubuntu 22.04,

# for ROS
if [ -f ~/ros2_ws/install/setup.bash ]; then
  . ~/ros2_ws/install/setup.bash
fi
  1. Use a ROS launch file to start the dVRK in simulated mode with the patient cart only:

For Ubuntu 20.04,

source ~/catkin_ws/devel/setup.bash
roslaunch dvrk_model patient_cart.launch generation:=Classic

For Ubuntu 22.04,

source ~/ros2_ws/install/setup.bash
ros2 launch dvrk_model patient_cart.launch.py generation:=Classic
  1. In a second terminal, use a Python test script to make an arm move For Ubuntu 20.04,
source ~/catkin_ws/devel/setup.bash
rosrun dvrk_python dvrk_arm_test.py -a PSM1

For Ubuntu 22.04,

source ~/ros2_ws/install/setup.bash
ros2 run dvrk_python dvrk_arm_test.py -a PSM1

PSM/ECM Calibration

  1. Generate config files and copy the output files to the config folder:
rosrun saw_intuitive_research_kit_applications dvrk-config-generator.py -a PSM1 -g Si -H dRA1 -s 615178

rosrun saw_intuitive_research_kit_applications dvrk-config-generator.py -a PSM2 -g Si -H dRA1 -s 432789

rosrun saw_intuitive_research_kit_applications dvrk-config-generator.py -a PSM3 -g Si -H dRA1 -s 640216

rosrun saw_intuitive_research_kit_applications dvrk-config-generator.py -a ECM -g Si -H dRA1 -s 342471
  • We need to modify the file. In 'PSM(x)-(serial_number).json', uncomment the following line and change underscore to hipen:
Before:  // , "mounting_pitch": -0.78540 // -45 for Si PSM1 on SUJ
After:   , "mounting-pitch": -0.78540 // -45 for Si PSM1 on SUJ
  1. Check connection to the QLA board: qladisp
  2. Close relay:
qlacommand -c close-relays
  1. Potentiometer Calibration:
sawIntuitiveResearchKitSiPotentiometersCalibration -c sawRobotIO1394-PSM1-615178.xml

sawIntuitiveResearchKitSiPotentiometersCalibration -c sawRobotIO1394-PSM2-432789.xml

sawIntuitiveResearchKitSiPotentiometersCalibration -c sawRobotIO1394-PSM3-640216.xml

sawIntuitiveResearchKitSiPotentiometersCalibration -c sawRobotIO1394-ECM-342471.xml
  1. Follow the guideline provided in the dVRK Wiki.

MTM Calibration

  1. Generate config files and copy the output files to the config folder:
rosrun saw_intuitive_research_kit_applications dvrk-config-generator.py -a MTML -g Classic -H DQLA -c m060581.cal -s 60581

rosrun saw_intuitive_research_kit_applications dvrk-config-generator.py -a MTMR -g Classic -H DQLA -c m046927.cal -s 46927
  1. Calibrate motor current:
sawRobotIO1394CurrentCalibration -c sawRobotIO1394-MTML-60581.xml

sawRobotIO1394CurrentCalibration -c sawRobotIO1394-MTMR-46927.xml
  1. Calibrate potentiometer scale:
rosrun dvrk_robot dvrk_console_json -j console-MTML.json -K -C

rosrun dvrk_python dvrk_calibrate_potentiometers.py -t scales -a MTML -c sawRobotIO1394-MTML-60581.xml (in another terminal)

rosrun dvrk_robot dvrk_console_json -j console-MTMR.json -K -C

rosrun dvrk_python dvrk_calibrate_potentiometers.py -t scales -a MTMR -c sawRobotIO1394-MTMR-46927.xml (in another terminal)
  1. Calibrate potentiometer offset:
rosrun dvrk_robot dvrk_console_json -j console-MTML.json -K -C

rosrun dvrk_python dvrk_calibrate_potentiometers.py -t offsets -a MTML -c sawRobotIO1394-MTML-60581.xml (in another terminal)

rosrun dvrk_robot dvrk_console_json -j console-MTMR.json -K -C

rosrun dvrk_python dvrk_calibrate_potentiometers.py -t offsets -a MTMR -c sawRobotIO1394-MTMR-46927.xml (in another terminal)
  1. Calibrate grippers:
sawIntuitiveResearchKitGripperCalibration -c sawRobotIO1394-MTML-gripper-60581.xml

sawIntuitiveResearchKitGripperCalibration -c sawRobotIO1394-MTMR-gripper-46927.xml
  1. Run console to test signals from MTMs:
rosrun dvrk_robot dvrk_console_json -j console-MTML.json

rosrun dvrk_robot dvrk_console_json -j console-MTMR.json

References

  • To run console:
rosrun dvrk_robot dvrk_console_json -j console-PSM2.json
rosrun dvrk_robot dvrk_console_json -j console-SUJ-ECM-MTML-PSM2-MTMR-PSM1-PSM3-Teleop.json
...
rosrun dvrk_python dvrk_arm_test.py -a PSM2
  • To test IO(not tested yet):
rosrun saw_robot_io_1394_ros robot_io_console -c sawRobotIO1394-PSM2-432789.xml