← Back

Learning Bimanual Needle Manipulation from Demonstrations

September 10, 2024

At Virtual Incision, I developed machine-learning components for MIRA, a compact dual-arm surgical robot. The main project was a visuomotor imitation-learning policy for needle pickup and hand-off. The objective was deliberately narrow: test whether a policy trained from teleoperation data could close the loop on real hardware and produce coordinated bimanual motion.

MIRA dual-arm robot positioned above a surgical training model
MIRA setup used for collecting demonstrations and evaluating the learned policy.

Supporting vision work

Before the control project, I worked on two components of the imaging stack:

Control as sequence prediction

The manipulation task consisted of locating a surgical needle, grasping it, and transferring it between the two instruments. Rather than predicting Cartesian end-effector commands or solving inverse kinematics, the policy directly predicted joint-space targets.

Each action contained seven values per arm, including the gripper:

a_t = [q_t^left, g_t^left, q_t^right, g_t^right] ∈ R^14

Given the current RGB observation, the policy predicted a chunk of future targets:

π_θ(I_t) → Â_t:t+K ∈ R^(K×14)

Predicting one action at a time gives behavioral cloning a long effective horizon: small errors alter the next observation, and the policy can progressively leave the demonstration distribution. ACT instead predicts a coherent local trajectory of length K. This reduces the number of high-level decisions and captures short-range temporal structure such as coordinated approach, grasp, and transfer motions.

ACT architecture

I implemented an Action Chunking Transformer-style conditional variational autoencoder:

  1. During training, a transformer encoder receives the current joint state and demonstrated future action chunk. Its [CLS] representation parameterizes a latent variable z, intended to capture variation between valid demonstrations.
  2. A ResNet-18 converts the RGB frame into spatial visual tokens. These tokens are projected to the transformer dimension and combined with positional information.
  3. A transformer encoder fuses the visual representation, robot state, and latent style.
  4. A transformer decoder uses one learned query per future timestep and cross-attends to the encoded observation. A linear head maps the resulting sequence to K × 14 joint and gripper targets.

The objective combines action reconstruction with KL regularization of the latent posterior. At inference time, the CVAE encoder is removed and z is fixed to the prior mean, producing deterministic action chunks.

Architecture of the Action Chunking Transformer conditional variational autoencoder
Original ACT architecture from Zhao et al. The paper uses four camera views; my MIRA adaptation used the endoscopic RGB stream and a 14-dimensional bimanual action.

The generative formulation matters because demonstrations are not deterministic. Similar visual states can admit different approach trajectories or timing. A deterministic regressor trained across incompatible modes can average them into an action sequence that belongs to none of the demonstrations. The latent variable gives the training objective a mechanism for representing this variation, while fixing z = 0 provides a stable inference policy.

Demonstration pipeline

I collected approximately 100 teleoperated needle-manipulation trajectories. The dataset pipeline synchronized the camera stream with robot logs, extracted task-relevant trajectory segments, preserved demonstration boundaries, padded terminal chunks, and normalized each action dimension using training-set statistics.

Keeping trajectory boundaries intact was essential: an action chunk must never cross from the end of one demonstration into the beginning of another. Validation data was separated by demonstration rather than by individual frames to avoid measuring memorization of adjacent observations.

Teleoperation interface used to collect bimanual surgical robot demonstrations
Teleoperation interface used to collect synchronized visual and joint-space demonstrations.

Closed-loop deployment

I integrated the trained policy as an operator in the Holoscan video pipeline. Each incoming frame was preprocessed on the GPU, passed through the policy, and converted back from normalized model outputs to robot joint targets. Re-querying the policy as new images arrived turned the action-chunk predictor into a receding-horizon visual controller rather than a single open-loop trajectory.

Autonomous needle pickup and hand-off demonstration
Autonomous needle pickup and hand-off on MIRA. Click the image to watch the rollout.

The resulting system completed autonomous needle pickup and hand-off on the physical robot. This was a feasibility result, not a claim of surgical autonomy: the dataset covered a narrow task distribution, recovery behavior was limited, and no formal safety or robustness study was performed. The useful result was demonstrating the complete path from teleoperated data collection to a learned bimanual policy running inside the robot’s real-time perception stack.

Source code · ACT paper

← Back