Robots that trundle along sidewalks R2D2-style to deliver takeout food or packages are still in early test phases. Few even exist.

But San Francisco is cracking down on them, and that may stem from mounting concerns about automation gobbling up jobs. On Tuesday night, San Francisco’s Board of Supervisors unanimously passed tough new regulations that will limit companies to three robots each; limit the city to nine robots total; and confine robots to industrial areas where almost no one lives — all of which makes it hard to test their basic function of delivering goods to consumers. The robots can’t go faster than 3 mph and must have a human monitor, the new law says.

Still, the regulations were more liberal than an original proposal by Supervisor Norman Yee to outright ban the robots. He and supporters, which included pedestrian advocacy groups, said they want to prevent sidewalk crowding and protect seniors, children and disabled people. San Francisco already has banned Segways and bicycles from sidewalk use.

San Francisco’s ordinance resembles laws enacted in the early days of “horseless carriages” that required a person to walk in front of a car waving a red flag, said Bob Doyle, spokesman for the Association for Advancing Automation Association, an industry organization that represents U.S. robotics and automation companies.

“To put such a strict limit on these types of autonomous delivery vehicles drastically slows down the process of testing and the potential for these being put into (use before) the general public,” he said.

He hopes San Francisco’s action isn’t the beginning of a wave of neo-Luddite regulations.

In fact, San Francisco is bucking a trend, as several states and cities have gone the other way to legalize robots. In the Bay Area, Redwood City, San Carlos, Sunnyvale and Concord have OK’d various robot pilot programs. States including Idaho, Wisconsin, Virginia, Florida and Ohio also have given green lights to the robots.

The threat of automation replacing numerous jobs looms large, said Douglas Schmidt, a professor of computer science at Vanderbilt. “It’s definitely a sociological trend, and can become a political issue,” he said. “You’ve got to figure as more and more people start to lose jobs to automation you’ll see this kind of response.”

And robots are a highly visible target.

San Francisco startup Marble has been testing a few in the Potrero Hill and Mission neighborhoods to deliver Eat24 food orders. It has also been doing tests in other Bay Area cities.

Marble’s statement on the San Francisco action was diplomatic.

“We're happy for the productive relationship that we've built with the Board of Supervisors, and we agree that this is a promising first step in crafting a regulatory system that will help San Francisco lead the way in robotics innovation and creating well-paid manufacturing jobs,” said CEO and co-founder Matt Delaney.

Dispatch, a South San Francisco robot startup, did not respond to requests for comment.

Starship Technologies, the largest robot maker with hundreds of models being tested in Europe and America, works with several food-delivery services, including Postmates and Doordash in the U.S. It did not immediately provide comment.

The Advancing Automation trade group fought a robot tax proposed by Supervisor Jane Kim earlier this year to help offset the economic impacts of jobs displaced by robots.

The robot backlash could also spring from city leaders’ vexation with some consequences of the rapid growth of hometown startups Airbnb, Uber and Lyft. Yee previously said he was concerned that Uber and Lyft vehicles were overwhelming city streets, while many lawmakers worry that Airbnb’s rapid proliferation hurt affordable housing.

The supervisors are also considering “guiding principles” proposed by Yee on how to regulate future emerging technology businesses. The criteria include making sure that they provide a net common good, don’t divert resources or infrastructure from people, give equal access to vulnerable populations, share data about their operations, and give preference to technologies that “grow rather than reduce the labor force.”

Carolyn Said and Benny Evangelista are San Francisco Chronicle staff writers. Email: csaid@sfchronicle.com bevangelista@sfchronicle.com Twitter: @csaid @ChronicleBenny