We investigate the use of SlicerROS2 to simulate robotic catheter in the heart anatomy for cardiac ablation.
A Python script to generate a XACRO file (which can be converted to URDF) for a flexible catheter has been prototyped. The script models a flexible catheter as serial links connected via universal joints and rotary springs. The user can provide parameters to define the serial links, including N, D, L1, L2, L3, K, and M to mimic the mechanical behavior of the flexible catheter with N links and N-1 universal joints. The serial link consists of the first and the last links representing the tip and the base links, and the bending section consisting of the remaining (N-2) links. Each joint has rotary springs with a spring constant of K that generate torques to bring it back to the straight position when the joint is rotated by the external force. D is the outer diameter of the catheter. L1, L2, and L3 are the lengths of the tip link, the bending section, and the base link. The total weight of the catheter is M.
The script generate a ROS package including a XACRO file.
$ cd ~/ros2_ws/src
$ python3 <path to the script>/catheter_urdf_generator.py --N 12 --D 0.003 --L1 0.20 --L2 0.5 --L3 0.05 --K 0.2 --M 0.5 --output my_catheter
The URDF can be published in the ROS network using the following command:
$ ros2 run robot_state_publisher robot_state_publisher --ros-args -p robot_description:="$( xacro /home/junichi/ros2_ws/src/my_catheter/urdf/my_catheter.xacro )"
To visualize using RViz and control the joint angles with the joint_state_publisher_gui, open a new terminal and use the following commands:
$ source /opt/ros/jazzy/setup.bash
$ ros2 run joint_state_publisher_gui joint_state_publisher_gui
Open another terminal and launch RViz:
$ source /opt/ros/jazzy/setup.bash
$ ros2 run rviz2 rviz2
The launch file generated by the script can run dynamic simulation on Gazebo and visualize it on RViz and 3D Slicer. Assuming that the script has already generated the package under ~/ros2_ws/src
(see the previous section).
$ cd ~/ros2_ws
$ source /opt/ros/jazzy/setup.bash
$ colcon build
$ ros2 launch my_catheter my_catheter_launch.py
The last command launches both Gazebo and RViz.
On RViz, open the Displays
frame (should be on the left panel of the window if Rviz is opened for the first time) and configure it as follows:
Add
button at the bottom. A dialog box should show up.Create visualization
, click Robot Model
under rviz_default_plugins
OK
to close the dialog box.Robot Model
, click the right column for Description Topic
and choose /robot_description
.Global Options
, click the right column for Fixed Frame
and choose base_link
.3D Slicer with SlicerROS2 can import the robot description from the ROS network and display the catheter model with the following steps:
Add new robot
.Load robot
(use default parameters).
(NOTE: The screen video is slow because of the recording, but it was smooth when running without screen recording)
This work is supported in part by NIH (R01EB020667, R01EB034359, R01EB036015, R01CA235134, P41EB028741).