Making a "Smart" Self-Balancing Robot | Training a Neural Network to Replicate a PID Controller

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ต.ค. 2024

ความคิดเห็น • 18

  • @felixgallo5132
    @felixgallo5132 2 ปีที่แล้ว +1

    Pretty Cool, it's the first time I found a comparison between PID and NN.
    Congrats!

  • @bofloa
    @bofloa ปีที่แล้ว +1

    You can also train this robot without actually collecting data first, what I will do is to create a routine clasical PID agent function that generate target value and use that value to backpropagate if the output of the neural network is not the same as expected PID output so the PID become supervisory agent until the neural network converge , with minimal code you can actually train the network on the robot microcontroller

  • @geekmystique
    @geekmystique 3 ปีที่แล้ว

    Subscribed, really cool how you went to your process and kept it in such a condensed format!

  • @TheThemmmma
    @TheThemmmma 3 ปีที่แล้ว +2

    Would be cool if you would replicate kalman filter with NN next :D stepping up the game

    • @jankstation1190
      @jankstation1190  3 ปีที่แล้ว

      This is a dope idea, will definitely look into this! I imagine it could be done with some sort of RNN but if you have any references on how to go about this please send them my way :D

  • @aboudezoa
    @aboudezoa 3 ปีที่แล้ว +1

    Very cool like the idea

  • @wathoocheminiak3025
    @wathoocheminiak3025 3 ปีที่แล้ว +1

    Great editing for

  • @shubham5528
    @shubham5528 ปีที่แล้ว

    Bro can you make a toutrial for this

  • @harshadgunjikar1595
    @harshadgunjikar1595 3 ปีที่แล้ว

    Can you make it with stepper motors

    • @jonathanschwartz7256
      @jonathanschwartz7256 3 ปีที่แล้ว +1

      You could certainly try! Although the fact that steppers you control how many steps it takes (as opposed to driving current in a DC motor) would probably make it a good deal trickier to create an effective control law.

  • @nandabagussaputra2980
    @nandabagussaputra2980 3 ปีที่แล้ว

    Hi.. Could you show how to training this robot with neural network?

    • @jankstation1190
      @jankstation1190  3 ปีที่แล้ว

      Hey! So I trained this offline, which is to say I logged data of the PID controller running for a while and then used this logged data to train a neural network. The network itself is a simple Multi-Layer Perceptron with 3 hidden layers of 4 neurons each, and PReLu as the activation function of each layer. I trained it using pytorch with mean squared error as my loss function. The code can be found here: github.com/SchwartzCode/Neural_Net_Balance_Bot

  • @alimahmoud8708
    @alimahmoud8708 2 ปีที่แล้ว

    Hi,
    How did you tune the PID gains to achieve a better outcome?

    • @jankstation1190
      @jankstation1190  2 ปีที่แล้ว +2

      Hey, if you look at the description of this video I included a few links to videos detailing the gain tuning process, but in essence I did this:
      1. Tune P until the robot can almost balance on its own (I kept a finger on the top of the robot to prevent it from falling, but could still get an idea of how close to balancing it was based on how much of a correction force I needed to apply)
      2. Tune D until the robot can more or less balance on its own (it will not get the right setpoint, but should be able to stay balanced for a decent amount of time without needing correction)
      3. Tune I until the robot returns to straight up and down (i.e. balanced) given a push

    • @alimahmoud8708
      @alimahmoud8708 2 ปีที่แล้ว

      @@jankstation1190 Thanks so much, one more question please, What were the criteria used in evaluating the control algorithm?

    • @jankstation1190
      @jankstation1190  2 ปีที่แล้ว

      @@alimahmoud8708 I didn't have a very concrete evaluation approach, I would just push the robot with my hand and see roughly how large of a disturbance it could recover from. I suppose I could have recorded this process, and then paused at the largest angle that it recovered from to measure it concretely.

  • @TheGamigG3neral
    @TheGamigG3neral 3 ปีที่แล้ว

    Hi, could you please post the code you used for the Neural Network? For the Micro controller and training.

    • @jankstation1190
      @jankstation1190  3 ปีที่แล้ว +1

      Sure thing! One note though - I currently have a transpose step on the arduino side because I was too lazy to write a python script to transpose the data on my own. I may eventually do that, but for now it just takes up a bunch of memory for no reason other than to compensate for my laziness. Code can be found here: github.com/SchwartzCode/Neural_Net_Balance_Bot