Skip to content

Mahdi-Rahmani/Self-Driving-Motorcycle

Repository files navigation

Self Driving Motorcycle

Mech-AUT Motorcycle

  • By: Mahdi Rahmani

  • Supervisor: Dr. Ali Azimi


n this project, we aim to simulate a self-balancing motorcycle. To achieve this, we have several solutions at our disposal. First, we need to select the appropriate balancer mass and then choose a suitable controller to maintain the motorcycle's balance.

As you may be aware, experimental work can incur significant costs, such as being time-consuming and requiring financial resources, since our motorcycle may fall to the ground and get damaged during testing. Therefore, we utilize Vortex Studio, which helps us simulate our environment and the vehicle we are working on.

I will start by providing a brief introduction to the software, and then you can review the results.

Vortex Studio

Vortex Studio is a platform for creating and deploying real-time, interactive simulations of mechanical systems. Vortex Studio is a key component of all of CM Labs’ industry-leading equipment simulators and it is available for you to design, build and develop your own real-time, interactive simulation products.

Why use Vortex Studio?

  • Build and deploy real-time, interactive simulations of mechanisms, vehicles, and vessels.
  • Validate design through virtual prototyping.
  • Solve training needs for complex equipment with a high-fidelity experience.

In our project, we use this software in two modes:

  1. When we want to design a PID controller, we can use Python code. Our Python code can interact with the simulator in real-time, receive feedback from sensors, and then apply an appropriate reaction to the actuator.

  2. For reinforcement learning, we require an environment that we can run multiple times. This can be achieved by creating an application from our modeled environment and motorcycle with the assistance of Vortex Studio's features.

You can buy a license and download this software from the CM-Labs website.

Results

No controller

First of all, we should check what our motorcycle's behavior is if we don't use any controller. You can see the results in the GIF below.

no_control

PID and Reaction wheel

We use a flywheel as a reaction wheel and a PID controller to calculate the desired torque for the motorcycle to maintain its balance. As you can observe in the GIF below, our motorcycle successfully navigates all obstacles.

fly_wheel_pid

RL and Reaction wheel

We use a flywheel as a reaction wheel and reinforcement learning (RL) as our controller to calculate the desired torque for the motorcycle to maintain its balance. In this phase, we need to train our model first. The training process is visible in the GIF below.

fly_wheel_RL_train

You can also view the training plot in the image below.

fly_wheel_RL_train

After training, we can test our model. As demonstrated in the GIF below, our motorcycle successfully navigates all obstacles.

fly_wheel_RL_test

Other methods like using gyroscope

While we have explored different methods for controlling the motorcycle's balance, using a flywheel has proven to be the most effective. You can find details about the other methods we have investigated in the "Future Works_Gyro_Steering" directory.

For example, by utilizing a gyroscope, we achieved the results shown below:

gyro

Discussion

These three methods each perform better in specific simulation situations. We collect data from the simulations to verify this, and additional explanations are provided in my final report.

My presentation file can also be accessed at this link.

About

Bachelor's project in mechanical engineering at AUT

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published