# Teaching a Robot to Find Its Own Path
> Drift builds an A planner that helps the Unitree Go2 find a path around obstacles and reach its destination in MuJoCo.*
**Author:** Drift Team
**Published:** 2026-09-19
**Tag:** Product
**Reading time:** 4 min
**Canonical URL:** https://godrift.ai/blogs/teaching-a-robot-to-find-its-own-path
---*The Unitree Go2 can navigate challenging environments, but getting from one point to another means figuring out which path is actually worth taking. Drift builds an A planner and connects it to the Go2 in MuJoCo.*

&nbsp;

&nbsp;

For this demo, the Go2 starts in an environment filled with obstacles and has one simple objective: reach a marked destination.

&nbsp;

The robot isn't given a fixed trajectory to follow. Instead, Drift creates a 2D grid-based **A**\* planner that searches the environment for a route, visualizes the resulting path, and then makes the Go2 follow it.

### **Turning the Environment Into a Path**

A\* works by breaking the environment into a grid. Each cell represents a possible position the robot can occupy, while cells containing obstacles are treated as unavailable.

&nbsp;

The planner then searches from the robot's starting cell toward the goal. At each step, it considers the cost of reaching a position and an estimate of how far that position is from the destination.

&nbsp;

This is what allows A\* to do more than simply move toward the goal.

A direct route might be shorter geometrically, but if an obstacle blocks it, that route isn't useful. The planner has to consider the available space and find a route that reaches the destination without passing through blocked cells.

### **Why the Go2 Takes the Outside Route**

Once the A\* planner finds a path, the resulting route is visualized in the simulation. The Go2 can then use those waypoints to move through the environment toward its destination.

&nbsp;

In this example, the shortest-looking route appears to go between the obstacles. But that space is blocked, so A\* searches for another option and sends the Go2 around the outside.

&nbsp;

The distinction is important: *A is not looking for the shortest straight line to the goal. It is looking for the lowest-cost path through the available space.*

&nbsp;

That same idea appears in other navigation problems, whether the robot is moving through a maze or navigating a larger environment. In our [MuJoCo maze navigation demo](https://www.godrift.ai/blogs/maze-navigation-mujoco), the robot similarly has to find a route around obstacles instead of simply moving directly toward its destination.

### **From a Path to Robot Motion**

Finding a path is only one part of navigation.

&nbsp;

The planner produces a sequence of positions, but the Go2 still needs to turn those positions into movement. The generated path therefore becomes a set of waypoints that the robot follows as it travels toward the goal.

&nbsp;

This creates a simple pipeline:

**Environment → A\* planner → Path → Go2 → Goal**

Because the path is visible in the simulation, it is also easier to inspect what the planner decided to do. You can see where the route changes direction, how it moves around obstacles, and whether it actually reaches the intended destination.

&nbsp;

This is one reason [robot simulation](https://www.godrift.ai/blogs/why-robots-train-in-simulation) is useful for navigation development. Different obstacle layouts and starting positions can be tested without repeatedly putting a physical robot through the same experiments.

### **From Simple Paths to More Complex Navigation**

The setup here uses a 2D grid and a relatively simple environment, but the same concept can be extended.

&nbsp;

The planner could account for more complicated obstacle layouts, different movement costs, or changing environments. A more advanced navigation stack could also combine global path planning with local obstacle avoidance so the robot can react when something changes after the original path has been calculated.

For this demo, the objective stays straightforward: give the Go2 a destination, let A\* find a viable route, and have the robot follow it.

&nbsp;

The result is a small example of how a robot can move from **being given a destination to figuring out its own path there.**

## FAQ

### **What is A\* path planning?**

A\* is a pathfinding algorithm that searches for a low-cost route between a starting point and a goal while using a heuristic to guide the search.

### **Why does the Go2 take the longer-looking route?**

The direct route is blocked by obstacles. A\* therefore searches through the available cells and selects a route that can actually reach the goal.

### **What does the 2D grid represent?**

The environment is divided into cells. Free cells can be included in the path, while cells occupied by obstacles are treated as blocked.

### **Does A\* control the Go2 directly?**

The A\* planner generates the path. The robot's movement system then uses the resulting path or waypoints to guide the Go2 toward the destination.

## Related reading

- **[Watch a Robot Solve a Maze on Its Own in MuJoCo](https://www.godrift.ai/blogs/maze-navigation-mujoco)**
- **[Build a Quadruped Simulation in MuJoCo in One Prompt](https://www.godrift.ai/blogs/quadruped-simulation-mujoco)**
- **[Why Robots Train in Simulation Before the Real World?](https://www.godrift.ai/blogs/why-robots-train-in-simulation)**
- **[MuJoCo: The Physics Engine Robotics Research Quietly Runs On](https://www.godrift.ai/blogs/what-is-mujoco)**
