Site Search

It's been a while, I'm Ozu, a 2025 new graduate FAE!

 

In the first episode we looked at power supply design, and in the second episode we looked at car body assembly, but this is the final episode and we'll be looking at driving.

Last time, they finally managed to complete the machine... How will this machine actually run? It's a must-see!

Concept: Aiming for the fastest goal

Now, the development of this maze escape machine. Because it is a time attack, it is not enough to just reach the goal, but it is necessary to reach the goal even one second faster.

Possible strategies include strengthening the machine to increase its speed, or devising an algorithm to overcome the maze.

  

So the strategy I chose was...

 

"The first time is exploration, the second time is capture"

 

is!

 

In this production workshop, you can try the same course twice.

So, for the first run, you steadily make your way to the finish line, including any dead-ends, and record the route. For the second run, you use that record to determine the shortest route by eliminating the dead-ends, and aim to reach the finish line in the fastest time possible!

FAE Ozu Maze Escape Machine Strategy Concept
Figure 1: Strategy concept

Lack of time and skills

Even if the concept is good, the problem is implementation ability and time.

There are only about two weeks left between the completion of the car body and the actual race.

The savior here was...

 

It is a generative AI.

 

Macnica also encourages the use of AI, and has already used it for component selection, but this time we are venturing into the unknown territory of generating embedded program code.

How far can we go? This is where the real challenge begins.

Using AI to achieve the fastest speed

First, we need to clarify what we want to do. It's not just about making the motor rotate forward and aiming for the goal.

There are many elements involved, from strategies for navigating mazes to acquiring sensor data and other driving assistance functions.

  

I explained that the second run was the shortest route, avoiding dead ends, but there's no point in not reaching the goal at least once.

 

So for the first run we adopted the "left-hand method."

This is a common technique for Micromouse, and by always following the left wall, you will eventually reach the goal square. This choice also determines the conditional branching of rotation depending on whether there are walls on the left and right in front of you (Figure 2).

 

The basic operation is simple.

"Move forward one square (18cm) → Check for wall → Rotate → Move forward one square"

During this repetition, the following three auxiliary functions are called:

 

- Central maintenance control

The distance to the left and right walls is measured using an infrared ranging sensor, and the deviation is calculated as "4cm - actual distance" based on the 4cm distance between the two walls when the vehicle is centered.

PID control keeps the vehicle in the center of the lane (Figure 3).

 

・Move one space

To record the course traveled, you must move exactly one square (18cm).
The motor's encoder measures the number of pulses corresponding to the rotation speed of the tire, allowing it to move forward an accurate 18cm.

 

- Precise 90 degree rotation

The rotation angle around the Z axis (vertical direction) is calculated using a 3-axis gyro and 3-axis acceleration sensor.

FAE Ozu Maze Escape Machine: The concept of branching movement direction depending on whether or not there is a wall
Figure 2: Direction of movement changes depending on whether or not there is a wall
FAE Ozu Maze Escape Machine Central Maintenance Control Concept
Figure 3: Central maintenance control

There are also various other steps involved, such as calibrating the sensor data.

Implementation Process

At first, I was a bit greedy and sent out a prompt with all the specifications in bullet points, but...

As expected, when I pressed the start button, nothing happened.

  

We pull ourselves together and switch to a strategy of steadily dividing up functions using "human power x AI" and integrating them while checking their operation.

 

Each feature implementation must include:

 

①Pin assignment

Uses over 20 pins of Arduino. Passes pin assignments for GPIO and I2C connections.

②Sensor information

Calibration value information and installation location of each sensor

③Motor rotation speed

Rotation speed taking into account vehicle weight, torque, etc.

 

This is where the implementation of each feature begins.

  

This is where AI really comes into its own.

 

First, I tried sending out this rough prompt:
"Centering control is implemented using PID control. Control begins if the right wall is less than 4cm high."

Amazingly, even with such rough instructions, the AI was able to generate code that worked.

I was impressed when the car, which had been scraping against the wall until then, started running smoothly down the center of the road.

 

However, here's an important point: even if you write the code generated by the AI verbatim, it won't run 100 % perfectly.

In terms of central maintenance control, it is necessary to fine-tune the parameters while actually running, such as adjusting the P, I, and D constants in PID control, and setting the braking start distance when moving one square.

In the code initially created by the AI, parameters were embedded as numbers in conditional statements, which meant that the code had to be revised retroactively every time an adjustment was made.

This is inefficient, so I instructed them to make all parameters variables and group them at the top of the code.

 

This makes debugging much easier, and allows us to optimize by changing the values little by little.

By adding each function in this way, we were able to create a machine that could consistently reach its goal.

Run through the shortest route!

This is where the real challenge begins.

 

In the second run, we will implement a mechanism to reach the goal via the shortest route. The method is simple, but the concept is important.

 

First, record the map on your first run.

The starting point is (0,0), and the coordinates are recorded as you move forward. If you reach a dead end, the same coordinates will appear again.

In other words, by detecting overlapping coordinates, dead-end routes can be eliminated.

Specifically, the source is fixed and the destination is shifted one position at a time while comparing coordinates. If there are overlapping parts, they are deleted. The source is also shifted one position at a time and the comparison is repeated in the same way.

By performing this process, the shortest route is completed by removing unnecessary branches from the search route (Figure 4).

 

Then, on your second run, simply follow this shortest route map.

As a result, you will reach your goal in a much shorter time than the first time!

FAE Ozu Maze Escape Machine Dead End Removal Mechanism

Figure 4: Mechanism of dead end removal

Example: The first process fixes A and compares it with B, C, etc.

The second process fixes B and compares it with C, D, etc.

Actual driving

The real thing is finally here.

 

The machine, which has been perfected through trial and error and collaboration with AI, will now be thrown into the maze.

On the first run, I steadily explored using the left-hand method. Although I was a little awkward, I reached the goal safely and recorded the route.

 

Based on the data obtained here, a shortest route map is generated.

And then the second run arrived...

By tracing the shortest route, you can reach your goal smoothly.

 

The result was... somehow I got first place!

 

To be honest, the other participants' machines had good parts selection and body designs, and were fast, so it was a really close race.

Amid the tense atmosphere of "not knowing who would win" until the very end, it was a major point that the AI-powered algorithm was able to take the lead.

"Rather than using AI to make things easier, we use it to take on more advanced challenges."

I realized that it's important to approach things with this mindset.

Summary

What did you think?

A trilogy of struggle stories!!

I gave a candid introduction to everything from my first power supply design to the completion of the Moja Moja Machine and software development using AI.

  

Everything was a first for me, and as I worked on everything from considering specifications to selecting parts, designing and implementing the power supply circuit, assembling the case, and creating the software, I learned not only about electricity, but also the importance of determining specifications and scheduling.

I also realized the high level of knowledge and technical skills that my seniors possessed, and the level I should aim for.

  

I will continue to learn and strive to become an FAE that customers can trust!

  

Thank you for reading to the end!

Move, Run, My Machine Article List

Power supply design edition

Car body production

・Driving