dVRK setup (ROS2, SurGLab) - gkgkgk1215/else GitHub Wiki

  • Tested on Ubuntu 24.04

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 # set Python 3 as default Python
sudo apt install python3-vcstool python3-colcon-common-extensions # for colcon
sudo apt install python3-pykdl # for the CRTK Python client library
  1. Install ROS
  2. Install dependencies
sudo apt update
sudo apt install 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 # dVRK
sudo apt install ros-jazzy-joint-state-publisher* ros-jazzy-xacro # ROS
  1. Install dvrk packages
# this depends on the ROS version you're using
source /opt/ros/jazzy/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 --symlink-install
source ~/ros2_ws/install/setup.bash
  1. Install config files
cd ~/catkin_ws/src/dvrk
git clone https://github.com/gkgkgk1215/dvrk_config_dgist.git
  1. Add the following lines at the end of your ~/.bashrc file:
# 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:
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
source ~/ros2_ws/install/setup.bash
ros2 run dvrk_python dvrk_arm_test.py -a PSM1

Troubleshooting: ROS 2 Jazzy PathJoinSubstitution์—์„œ trailing slash๊ฐ€ ์ œ๊ฑฐ๋˜๋Š” ๋ฌธ์ œ

๋ฌธ์ œ ํ˜„์ƒ

Ubuntu 24.04 + ROS 2 Jazzy ํ™˜๊ฒฝ์—์„œ dVRK model launch ์‹คํ–‰ ์‹œ, xacro ํŒŒ์ผ์„ ์ฐพ์ง€ ๋ชปํ•˜๋Š” ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ด์ „ ๋ฒ„์ ผ์˜ ROS launch ์—์„œ๋Š” ๋™์ž‘ํ•˜์ง€๋งŒ, ์ƒˆ๋กœ์šด ๋ฒ„์ „์—์„œ๋Š” ๊ฒฝ๋กœ ์„ค์ •์‹œ ์Šฌ๋ž˜์‰ฌ๋ฅผ ๋ˆ„๋ฝํ•จ.

launch ๋ฒ„์ „์„ ๋‹ค์šด๊ทธ๋ ˆ์ด๋“œ

apt-cache madison ros-jazzy-launch
apt-cache madison ros-jazzy-launch-ros
apt-cache madison ros-jazzy-ament-index-python
sudo apt install \
  ros-jazzy-launch=3.4.9-* \
  ros-jazzy-launch-ros=0.26.10-* \
  ros-jazzy-ament-index-python=1.8.1-*

or launch.py์—์„œ pathjointsubstitution ๋ถ€๋ถ„์„ ์ˆ˜์ •

Firewire

  • Install driver
sudo apt-get install libraw1394-dev
  • Set permissions
sudo mkdir -p /etc/udev/rules.d # create a directory if needed
cd
echo 'KERNEL=="fw*", GROUP="fpgaqla", MODE="0666"' > ~/80-firewire-all.rules # create the rule
sudo mv ~/80-firewire-all.rules /etc/udev/rules.d/80-firewire-all.rules  # move the rule in the proper directory
sudo addgroup fpgaqla          # create the group with read-write access to /dev/fw*
sudo udevadm control --reload-rules # apply new rules
  • Check the connection after reboot
qladisp

PSM/ECM Calibration

  • Skip this part if you already have calibration files.
  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

  • Skip this part if you already have calibration files.
  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