SAN DIEGO -- It's a dirty job, but somebody's got to do it.

And when it comes to the expensive, claustrophobic and sometimes dangerous work of inspecting natural gas and oil pipelines, that somebody might be a robot.

"We can make sure that these critical elements of energy infrastructure operate more safely, more reliably, more economically," said Edward Petit de Mange, managing director at the San Diego hub of Diakont, an international high-tech engineering and manufacturing company with offices in Russia, Italy and North America.

According to the federal government, more than 2.6 million miles of pipelines supply the nation's energy needs. But aging and deteriorating pipelines pose substantial risks.

In Northern California, a natural gas pipeline explosion killed eight people in San Bruno in September 2010.

Data from the Pipeline and Hazardous Materials Safety Administration reports that since 2010, an average of about 200 crude oil spills a year are reported. While most of the leaks are small, it's been estimated that 8.9 million gallons have been spilled during that time.

"When a natural gas pipeline fails, it's usually much more violent, but when a hazardous liquid pipeline fails, it's a lot messier from an environmental standpoint," Petit de Mange said.

For years, energy companies and utilities inspected their pipelines by using techniques such as sending pressurized water to test a line's strength, inserting barrel-shaped devices called "pigs" that travel inside operating pipes or simply digging into the ground and performing spot inspections.

But pipeline owners often did not have a good idea how sturdy a pipeline was or how close it teetered toward failure.

From its location in an unassuming San Diego office park, Diakont is one of the few companies that use robots that actually enter natural gas and liquid fuel pipelines to inspect for wear, tear and corrosion.

Called the Remotely Operated Diagnostic Inspection System, or RODIS, the contraption resembles the robot from the movie "Wall-E."

Crawling through the pipeline via a horizontal set of traction wheels, the RODIS makes its way past any bumps or bends in the line.

At the same time, two arms trace the circumference of the pipeline, measuring its thickness and structural integrity by using ultrasonic sensors that act like sonar devices that bounce high-frequency signals through the line.

A cable connects the robot to an operator, commonly stationed in a truck a safe distance from the pipeline, who monitors the sensor data. The pipeline's integrity is determined by sound pulses, lasers and video that check for defects such as cracking.

A typical inspection covers about a quarter of a mile in one day.

"It doesn't go really fast," Petit de Mange said. "Our key is we get very accurate, very complete data."

How much does a typical robot pipeline project cost?

Citing contractual provisions, Petit de Mange would not offer specifics.

"We're in the hundreds of thousands (of dollars), usually for a project," he said.

Essentially, companies are paying for the certainty that a robot-inspected pipeline provides.

"Pipelines are assets that operators keep in the ground for a long time, and they make money when the product is flowing through them," Petit de Mange said. "So when you have downtime, or worse yet, a failure of that pipeline ... that can be in the tens to hundreds of millions of dollars. So being able to perform inspections and get really valid data to ensure the pipeline is in good condition, that can save utility companies a lot of money."

Diakont's work extends beyond California. In 2015, Diakont inspected two natural gas pipelines that run underneath the Hudson River, between New Jersey and New York City.

Petit de Mange said although the Hudson River project was completed in about a week, the planning process took close to two years. The inspection showed the lines were in excellent shape.

In April, Diakont was one of 114 companies that received a California Competes Tax Credit, created by Gov. Jerry Brown's office, aimed at helping businesses grow and stay in the Golden State.

Diakont's award came to $250,000; the company, whose San Diego home for the last six years employs 33 people, will use the tax credit to bolster its efforts to nearly double its workforce and invest $6.8 million in the next four years.

And the company is poised to move robot inspections into the fuel tank storage area.

Like pipelines, large fuel storage tanks containing products such as gasoline, diesel fuel and jet fuel require inspections. But the floors of the tanks are hard to access, and operators often have no choice but to drain them, taking them out of service for six to eight weeks.

"It's a very complex process to clean out all that flammable sludge out of the tank," Petit de Mange said about the process that can range "from hundreds of thousands to low millions of dollars," not to mention the inherent danger of putting inspectors into potentially volatile areas.

Diakont recently developed a robot it calls the Stingray that works on the same principle that the RODIS tool uses in pipelines.

Without having to take out any fuel, the Stingray is placed in the tank and conducts its inspection as it moves along the floor, with sensors sending signals back to an operator. Data are collected to determine the integrity of the fuel tank.

"This is super exciting for us because this is a brand-new kind of market we're breaking into," Petit de Mange said.

Diakont is seeking regulatory certification for the Stingray equipment and hopes to launch its robotic fuel tank inspections this fall.