Down the road, diabetes patients might do away with regular injections or infection-prone insulin pumps and might instead supply a robotic docking station in their guts with regular shipments of insulin pills.

A team of engineers developed a small robot that can be implanted into the small intestine that pulls magnetic pills full of insulin toward them, extracts the medicine, and distributes it throughout the body — a process that IEEE Spectrum compared to docking at a space station.

The system was able to control the blood sugar levels of three diabetic pigs — chosen because their anatomy is shockingly similar to a human's — for hours at a time, according to research published in the journal Science Robotics on Wednesday. Implanting a robot inside your body might make you feel a little squeamish, but the scientists behind the system say it could be a huge help for type 1 diabetes patients who need to inject insulin several times a day as it is.

"Maybe it's scary to think about a docking station inside the body, but it worked." Study coauthor and Sant'Anna School of Advanced Studies biomedical roboticist Arianna Menciassi told IEEE Spectrum.

To get more specific, the flip phone-sized robot is implanted into the intestine. When a diabetes patient needs more insulin, they swallow a metallic capsule that the robot then traps with a magnetic field. That robot then pierces a small needle — through the intestine and into the capsule — that draws out all of the medication, and the pill is released to complete its journey while the robot administers the drug. Down the road, the scientists told IEEE Spectrum, the system might also be used to deliver chemotherapy or other medications.

Of course, some more tinkering is necessary before any human patients will be able to implant their own robotic docking stations. Some of the pigs' robots got waterlogged with bodily fluids, Menciassi told IEEE Spectrum, likely when the needle was retracting — so it'll take some reconfiguring to actually get all of the moving parts working right.