Minghan Wei sat in a red Toro lawn tractor and typed a few commands into a laptop computer as a handful of engineers looked on.

The tractor didn’t move.

Then, a moment later, it lurched forward, traveling in a smooth line across a freshly mowed lawn at the Toro Co.’s headquarters in Bloomington. It turned left, then right, and circled back to where it began, navigating the yard on its own. Wei, a researcher and Ph.D. student at the University of Minnesota, rode along more as a passenger than a driver.

Minnesota’s latest contribution to farming innovation — the “cowbot” — is nearing completion.

U scientists and Toro researchers have been working on the robotic mower for about a year and expect it to be ready for a cattle pasture by the end of next summer.

When fully operational, the self-driving machine could automate one of the more tedious chores for farmers — mowing down weeds in pastures after cows have grazed — while also cutting the use of fossil fuels and the release of climate-change gases.

“You can think of it as a Roomba for a cornfield, but a much smarter one, and bit more complex because it’s not just blindly going down a row, but can actually stop and identify the weeds,” said Eric Buchanan, one of the leaders of the project and a scientist at the U’s West Central Research and Outreach Center in Morris, Minn.

The cowbot marks the U’s first major step in developing robots for farm work. The state Legislature has given the school two grants, totaling $1.65 million, over the past few years to create the solar-charged machines in hopes of reducing agriculture’s large carbon footprint across the state. Crop and animal farms emitted more than 37 million tons of carbon dioxide equivalents in 2016, according to the Minnesota Pollution Control Agency. That’s more than all the cars, SUVs, trucks and airplanes in Minnesota that year combined.

While most of farming’s greenhouse gas emissions were driven by the use of fertilizers and manure, scientists believe more efficient equipment could make a dent by drastically cutting the use of diesel fuel and reducing the need for pesticides.

The cowbot is essentially the U’s first phase — to create a machine that can maneuver across a relatively simple and square pasture. Next up is to build smaller bots that can drive themselves up and down rows of cornstalks and soybeans, spot the weeds as they form and literally nip them in the bud.

“There are a lot of potential applications that could come out of this,” Buchanan said. “But the first thing is we have to prove the robots can do it.”

Work on the smaller, weed-nipping machines began in July and will probably take about three years before researchers know how effective they are, Buchanan said. Much of their success may depend on what engineers are able to learn from the performance of automated mowers in pastures.

Wei and a group of researchers are designing and testing the cowbot’s guidance system on the flat lawns of Toro’s headquarters.

“An actual pasture is going to be much rougher, so first we’re trying to get it right in a flat environment,” Wei said.

The robot will learn to drive itself across 2-acre increments, using some combination of pre-designed routes, GPS and its own sensors to know when to turn, when to move forward and when to stop. Then it will go home, much like a Roomba vacuum cleaner, and park itself in its solar-powered shed to recharge its batteries to mow again.

The goal is to have it mowing tall grass in rough terrain this fall so engineers will know what to work on over the winter, said Jack Gust, chief engineer at Toro.

“You learn by doing,” Gust said. “When you have a real problem to solve you can figure out the answer and apply it to other applications.”

One of those problems is working out “a handshake agreement” between the robot’s sensors and its guidance command over who is the boss and when, Gust said. If, for instance, the mower is told move in a straight line, but it spots a cow, a rock or a tree stump in its way, the sensors need to temporarily take over navigation to avoid the obstacle, and then turn command back over to the original routing system.

The mower will probably work best for organic farmers, who aren’t using chemicals for weed control but still need to cut down thistles, which cows generally won’t eat, to keep them from strangling the pastures as the animals move on.

Toro engineers are hoping to learn about the viability and the energy needs of such a large battery-powered mower. Automation may prove to be key, because these mowers can be energy hogs, Gust said.

“Being autonomous helps solve that [energy] problem,” he said.

Farmers who do the mowing themselves, or pay a hired hand to mow per hour, would expect to get quite a lot mowed over, say, an eight-hour sift, Gust said. But an automated mower would require a great deal of battery to run steadily for that long. A robot would be able to work with a much smaller battery because, rather than working a regular shift, it could work at anytime of day for a few hours at a time. When it ran out of battery it would simply recharge itself and then resume.

“It basically extends the time to do the work,” he said.