Training a Robot Arm to Pour Water from Three Cameras

What I learned across 17 training runs teaching a simulated robot arm to pick up a watering can and pour water into a plant pot using only camera images and joint angles.

Code: github.com/vssinghh/floraflow ↗

I have been learning robotics from the ground up, starting in physics simulation before moving to a physical robot arm on my desk.

To see how vision-based robot control works beyond basic pick-and-place demos, I built FloraFlow: a PyTorch and MuJoCo project where a 7-joint Franka robot arm grabs a watering can by its narrow 8 mm handle, carries it across a desk, and tilts it to pour water into a plant pot.

My first model worked 75% of the time when the watering can and pot started near their training positions, but dropped to 30% as soon as I placed them 5 to 10 cm outside the training area. This note covers what actually fixed that across 17 training runs, and what showed up when I built a visualizer to see what the network was looking at.

FloraFlow 4-Layer Multi-Camera Telemetry Rollout
A 20 Hz rollout driven from three camera feeds, showing live 2D tracking points, the predicted 3D path of the hand, and which camera the model relies on at each step.

How the Control Loop Works

The MuJoCo physics engine steps at 500 Hz while the neural network makes a control decision at 20 Hz (once every 50 milliseconds). At each step, the model receives only two things:

  • Three 128×128128 \times 128 RGB camera images: a side camera (third_person_cam), an overhead camera (overhead_cam), and a camera mounted on the robot’s wrist (wrist_cam).
  • Eight numbers describing the arm’s current posture: 7 joint angles and how wide the gripper fingers are open.

If a model predicts only one motor step at a time, small errors add up and the arm shakes while carrying or tilting the can. Instead, this model predicts the next 16 steps (0.8 seconds0.8\text{ seconds} of future motion) all at once. It starts from random noise and refines that noise into a smooth 16-step trajectory over 10 quick update steps (Flow Matching), which takes about 5.2 milliseconds on my Mac. 1 1. Standard MSE loss averages multiple valid paths together, which can steer the arm straight into obstacles. Flow Matching learns a velocity field that pushes random noise x0\mathbf{x}_0 toward a clean trajectory x1\mathbf{x}_1 along a straight path in 10 fast steps.

@torch.no_grad()
def sample_action_chunk(model, obs_embedding, num_steps: int = 10):
    x = torch.randn((obs_embedding.shape[0], 16, 8), device=obs_embedding.device)
    dt = 1.0 / num_steps
    for step in range(num_steps):
        t = torch.full((obs_embedding.shape[0], 1), step * dt, device=x.device)
        v = model.predict_velocity(x, t, obs_embedding)
        x = x + v * dt
    return x

What Worked and What Failed

Rather than guessing at settings, I ran 17 experiments testing dataset size, image shifts, bottleneck size, and state inputs. Here are the runs that mattered most when tested on normal training positions versus shifted positions (5 to 10 cm outside the training box):

RunWhat ChangedNormal Positions (20 Trials)Shifted Positions (50 Trials)Spout Error (Normal / Shifted)
Run 5Baseline (100 demos, no image shifts)75% (15/20)30% (6/20)16.3 cm / 31.5 cm
Run 7300 demos + random ±4 px\pm 4\text{ px} image shifts90% (18/20)80% (40/50)10.0 cm / 12.0 cm
Run 93 cameras + wide bottleneck (320 numbers)100% (20/20)72% (36/50)7.7 cm / 15.1 cm
Run 12Cut bottleneck in half (16 points/cam, 192 numbers)95% (19/20)100% (50/50)8.7 cm / 8.5 cm
Run 15aRemove episode timer (8D joints only, raw data)35% (7/20)-28.5 cm / -
Run 15cRemove episode timer + trim stationary pauses100% (20/20)96% (48/50)8.0 cm / 9.9 cm

1. Why a Smaller Vision Bottleneck Worked Better

Between Run 9 and Run 12, shrinking the vision layer made the robot much better at handling new object positions.

Instead of flattening camera images into a huge array, each camera network extracts 2D (x,y)(x, y) points of interest (SpatialSoftmax) so the policy receives pixel coordinates. 2 2. Spatial Softmax converts each feature map into an average 2D pixel location (u,v)(u, v), giving the control network explicit 2D points on the image rather than raw textures. In Run 9, I gave each camera 32 points and combined all three views into a 320-number vector. It hit 100% on normal positions, but dropped from 80% down to 72% when objects were placed in shifted positions.

With a wide 320-number vector, the network had enough room to memorize background pixels on the desk. When the watering can moved outside the training box, those memorized shortcuts failed. In Run 12, I cut the points per camera from 32 down to 16 and shrank the combined vector from 320 down to 192 numbers. That tighter bottleneck forced the model to pass only the positions of the gripper, handle, and pot, bringing shifted-position success to 100%.

2. Removing the Episode Timer

Up through Run 14, I passed an episode timer (0.0 at the start, 1.0 at the end) alongside the joint angles. When I tested the robot on harder misses, I noticed a flaw: if the gripper missed the handle, the arm still moved to the pot and tilted its empty hand right on schedule when the timer reached 0.7. It was using the clock as a cheat sheet instead of watching the cameras.

When I removed the timer in Run 15a, success crashed from 100% to 35%. The culprit was brief stationary pauses in the expert demonstrations (for example, pausing for a few frames right after closing the gripper). Without a clock, those paused frames had the exact same camera images and joint angles as the frame before, so the network predicted zero movement and froze in place.

In Run 15c, I filtered out those stationary pause frames during data loading. That single data fix brought the clock-free policy back to 100% on normal spawns and 96% on shifted spawns.

Closed Loop Pour Third Person ViewClosed Loop Pour Closeup View
Side view (left) and close-up view (right) during closed-loop pouring evaluation.

Seeing What the Network Looks At

Debugging a vision policy by only watching whether the robot succeeds or fails tells you very little. I wrote a visualizer (VisionRolloutVisualizer) that draws four internal signals on every frame:

  1. Tracking Crosshairs (+): The top 2D points from the vision layer, which lock onto the plant leaves, can handle, spout, and gripper without any bounding-box labels during training.
  2. Future Path Ribbon (Cyan to Amber): The 16 predicted joint steps converted into a 3D hand path and drawn onto each camera view.
  3. Camera Attention Bars: A live bar chart showing how much weight the model gives each camera at that moment.
  4. Task Plots: Spout-to-pot distance, tilt angle, gripper status, and water drops in the pot.
6-Phase VLA Telemetry Contact Sheet
Six frames from a single rollout showing how the tracking points and camera weights shift from reaching to pouring.

Watching the camera weight bars during a rollout showed that the network learned to switch cameras on its own depending on what was visible:

  • Reaching (Step 1): The model puts 62.5% of its weight on overhead_cam to find where the watering can and pot sit on the desk.
  • Grasping (Step 39): As the fingers close around the 8 mm handle, wrist_cam jumps to 51.8% for close-up alignment.
  • Pouring (Steps 116 to 196): When the arm tilts the watering can to 85 degrees, the body of the can blocks the wrist camera. The model shifts 85% to 97% of its weight back to third_person_cam and overhead_cam to hold the spout steady over the pot rim.

What’s Next

In Run 17c, I pushed the simulation further by randomizing lighting, table colors, camera mount positions (±1.2 cm\pm 1.2\text{ cm}), and watering can weight (0.7× to 2.0×0.7\times\text{ to }2.0\times), reaching 72.9% success across 140 randomized trials. Next, I am moving this multi-camera Flow Matching pipeline onto a physical 6-joint tabletop robot arm on my desk to train a single policy across multiple manipulation tasks and compare sim-only, real-only, finetuning, and sim-plus-real co-training.