self balancing robot | Simulink basics series

  Рет қаралды 59,949

Mouad Boumediene - Hobby Coding

Mouad Boumediene - Hobby Coding

Күн бұрын

in this practical tutorial 🔥 you will learn how to build and control a self-balancing robot in Simulink.
in this first video from the Simulink basics series we will build and control a 3d model of a two-wheeled self-balancing robot.
we used a PID controller to achieve an upright pose for the robot and used two approaches for tuning the PID controller which are: manual and auto-tuning.
🔥 IMPORTANT :
1. the value of the gain block is : -180 / 3.14
🔗links :
1. Get the project files from : ko-fi.com/s/716bba8384
⏱️Timestamps:
0:00 intro
0:56 what is a self-balancing robot?
1:56 making the wheels
5:00 making the upper body
9:23 the wheel's shaft and some rotations
11:32 working with joints
12:45 building the control system
15:17 tuning the PID controller
17:48 outro
🏷️Hashtags:
#simulink #SelfBalancingRobot #matlab

Пікірлер: 112
@marianaurel
@marianaurel 2 жыл бұрын
2 things for those interested: 1) It is moving because for some reason of that force applied on the Y+ on the 3rd plate, together with the main step input of the system. This is looping through again and again making a set reference point of let's say "+X degrees" hence it moves in a direction. Tuning it manually I found that if you keep that force on the top plate let's say +1, then you should have a step input with an initial value of +4, and that should make sure that the robot stabilizes using perfect PID values automically tuned and realistic environment. With this logic if you want to let's say simulate your own different setpoint remember that if you want to have a 10 degrees setpoint add +4 to it to make it appropriate and realistic, so put into the step an initial value of +14, and so on. In short, that constant movement of the robot is due to that initial force given to the top plate. 2) for those maniacs out there like myself, if you want to keep Z+ axis as your "UP" then just add a rigid transform right before the prismatic joint and set it as follows: Method: Standard axis > Axis: -Y > Angle:90. then go to the Mechanism Configuration and have gravity as: [0 0 -9.80665] this way gravity is kept as a force towards your relative "DOWN". Click ok, then hit Ctrl+D and enjoy your Z as "UP/Down" and X as "Forward/Backward" and Y as "Sideways".
@EdwinFairchild
@EdwinFairchild 3 жыл бұрын
This is an amazing video I always wondered how this was done. Thank you very much hope to see more videos! Subscribed!!
@HuongHoang-ez9si
@HuongHoang-ez9si 3 жыл бұрын
i as well
@merondesta3895
@merondesta3895 3 жыл бұрын
that was so helpful thankyou
@li-pingho1441
@li-pingho1441 2 жыл бұрын
thank u soooo much. this video saves my life
@hobby_coding
@hobby_coding 2 жыл бұрын
you're welcome :)
@YasirAmirKhanOffcial
@YasirAmirKhanOffcial 2 жыл бұрын
Remarkable! Wonderful I am speechless..
@hobby_coding
@hobby_coding 2 жыл бұрын
Glad you enjoyed it!
@wfpnknw32
@wfpnknw32 20 күн бұрын
interesting video although just doing a standard screen cast even if it's longer would be much more useful. I feel like i have to debug this tutorial. You add in blocks and components offscreen and use keyboard short cuts without explaining how to search for components. Also things like at 12:12 where you say it's really crucial to set a value and then cover the actual screen with a blown up screen shot of a properties window (but is it the one you're talking about, is it a bug and which one is it for), below the screenshot you can see the bottom of the actual window you're editing.. Great topic but honestly just a screen share of the whole process (sped up for bits if needed) would be much more useful. Nothing fancy just what you did is best.
@hobby_coding
@hobby_coding 17 күн бұрын
thanks for the valuable remark.
@Bianchi77
@Bianchi77 2 жыл бұрын
Nice video, thanks for sharing :)
@hobby_coding
@hobby_coding 2 жыл бұрын
you're welcome ;)
@hobby_coding
@hobby_coding 3 жыл бұрын
This simulation is available at : ko-fi.com/s/716bba8384
@wenhaoli6218
@wenhaoli6218 3 жыл бұрын
thinks
@wenhaoli6218
@wenhaoli6218 3 жыл бұрын
I was actually the first one to download it. Very
@hobby_coding
@hobby_coding 3 жыл бұрын
@@wenhaoli6218 I'm glad you liked it
@wenhaoli6218
@wenhaoli6218 3 жыл бұрын
@@hobby_coding Looking forward to your update, I will always pay attention
@josephj5864
@josephj5864 3 жыл бұрын
How selfless of you. Most people would charge for something like this, but you actually help learners learn-by-project approach by making it available to other users. I subbed. Looking forward to your content.
@mahmoudmohamed7065
@mahmoudmohamed7065 2 жыл бұрын
what is a gravity? why the robot is running very quickly when i run it
@engineering_design
@engineering_design 2 жыл бұрын
I love ❤️ and subscribe your channel. Thanks very much bro and continue more deep video
@engineering_design
@engineering_design 2 жыл бұрын
And contact me I will help you with everything I can.
@engineering_design
@engineering_design 2 жыл бұрын
Let's be friends
@technopeace4077
@technopeace4077 3 жыл бұрын
Increasing integral gain has steady state error almost zero. But when I autotune it. Increasing integral gain doesnt effect steady state error. Why?
@callmeyourmum
@callmeyourmum 7 ай бұрын
guys can someone help me out? everything has been working until i tried to implement the PID. the robot keeps falling down in the Y axis, has anyone had that issue before?
@mohameddiab8950
@mohameddiab8950 2 жыл бұрын
how can i get the transfer function of the system from this simulation?
@sreeharib9359
@sreeharib9359 5 ай бұрын
I am having an issue, at the mid of the video, the bot is oscillating while give a +y force at p3, but mine is not oscillating, but moving and rotating at a faster pace(increasing), yes, i set the damping coeff at rotating joint. Anyway its moving but not oscillating. Can anyone help me with this?
@hamedshamsikhani3345
@hamedshamsikhani3345 Жыл бұрын
Thank you. could you explain how to communicate with a real 2 wheel robot and how we apply this tutorial on that?
@jonesdella5651
@jonesdella5651 2 жыл бұрын
Sir, on which version is math lab simulink is 2013/2017/2020 etc... We can do this as a project
@YoyoYoyo-gh2dp
@YoyoYoyo-gh2dp Жыл бұрын
If l have the mathmatical model ..how to use it in the simulink ..plz answer me
@tutrinhngoc4389
@tutrinhngoc4389 2 жыл бұрын
but i can't find cylindrical solid in simscape
@Aakash3101
@Aakash3101 3 жыл бұрын
Great work!! I was impressed by this and wanted to implement LQR controller instead of PID. Can you implement LQR controller on the body, I am having some issues doing that. I dont know how to apply the state space model to the simscape simulations.
@hobby_coding
@hobby_coding 3 жыл бұрын
sure, great idea.
@hobby_coding
@hobby_coding 3 жыл бұрын
i made the LQR implementation you can check it out
@Aakash3101
@Aakash3101 3 жыл бұрын
@@hobby_coding Thank you soo much.
@hobby_coding
@hobby_coding 3 жыл бұрын
@@Aakash3101 you'r most welcome
@ChaitanyaKrishnabodduluri
@ChaitanyaKrishnabodduluri 3 жыл бұрын
Nice work I'm naive in matlab. I'm just wondering what advantages do you see in simulink over ROS+Gazebo for simulation of this robot model..?
@hobby_coding
@hobby_coding 3 жыл бұрын
Simulink is an educational tool and many students use it for their final year projects,so I thought i'd make a mini project in Simulink before the second semester arrives.
@technopeace4077
@technopeace4077 3 жыл бұрын
How can I keep robot from going?
@bosunwo
@bosunwo 2 жыл бұрын
Hello, I enjoyed the video. We are currently working on a project to produce segway. I succeeded in copying the video with my modeling. The question is, is the p,i,d value tuned in this multibody reliable? I mean, does it automatically calculate the transfer function? Thank you for the video. Thank you.
@muhammadmubashir4682
@muhammadmubashir4682 Ай бұрын
did you findout your question answer i'm facing same problem
@SciHeartJourney
@SciHeartJourney Жыл бұрын
Thank you, this was excellent. I don't think the student license let's us do the animation though.
@SonNguyen-km6qd
@SonNguyen-km6qd 2 жыл бұрын
Someone tell me about mathematical equation this video, please ?
@khiyanatdeori5957
@khiyanatdeori5957 3 жыл бұрын
Which block or component in the simulation is responsible for giving the force for the robot to move ?
@hobby_coding
@hobby_coding 3 жыл бұрын
the pid controller gives the control signal which is then fed to the prismatic joint
@zahraabedinzadeh9116
@zahraabedinzadeh9116 Жыл бұрын
how do you see all components at 8:19?
@khiyanatdeori5957
@khiyanatdeori5957 3 жыл бұрын
What sensor to be used in the actual project ?
@hobby_coding
@hobby_coding 3 жыл бұрын
MPU 6050 is what i use
@erickjoelgutierrezsanchez3625
@erickjoelgutierrezsanchez3625 3 жыл бұрын
Could you help me with the programming in simulink?
@superdogmeatmeat
@superdogmeatmeat 3 жыл бұрын
Do you know how you would go about adding two DC motors connected to the frame, which in turn are connected to the wheel? I'm trying to translate this to my real world cart.
@hobby_coding
@hobby_coding 3 жыл бұрын
1 - other than the appearance the dynamics will remain the same so I dont see the logic behind adding motors to the model behind other than the appearance
@hobby_coding
@hobby_coding 3 жыл бұрын
2 - if you want to do it then instead of the shaft you will build your motors and connect them together using rigid transform and then you take this model and connect it the same way to the chassis as we did in the video
@hobby_coding
@hobby_coding 3 жыл бұрын
i think this will work
@superdogmeatmeat
@superdogmeatmeat 3 жыл бұрын
@@hobby_coding Because I want to model my physical system? I don't have a perfect force input, I have two DC motors with gearboxes I can apply a voltage to; so I get a certain output torque.
@hobby_coding
@hobby_coding 3 жыл бұрын
@@superdogmeatmeat try setting a maximum output for the pid bloc proportional to your dc motors max delivered force combined and then retune your pid gains
@ilefmghirbi1653
@ilefmghirbi1653 3 жыл бұрын
Thanks for the video, I'm facing a problem and I wanted to ask here: the mechanic explorer doesn't show any of the parts that I created it only shows a grey screen. Does anyone know how to solve that?
@hobby_coding
@hobby_coding 3 жыл бұрын
1 - make sure you connect the model to the world frame 2 - make sure you update the model using CTRL- D
@ilefmghirbi1653
@ilefmghirbi1653 3 жыл бұрын
@@hobby_coding did both still no result
@gagankabadi299
@gagankabadi299 3 жыл бұрын
Hello, facing the same issue.. And if I select auto tuning method. The dialogue box opens and it shows plant cannot be linearized. And also my model is not seen only grey screen is visible. Can you please tell me what to do?
@khiyanatdeori5957
@khiyanatdeori5957 3 жыл бұрын
Can we control the positon of the Robot like you have done in the lqr video in this simulation
@hobby_coding
@hobby_coding 3 жыл бұрын
Do you mean adding another PID controller ? maybe , but you need another sensor which is the motor encoders
@technopeace4077
@technopeace4077 3 жыл бұрын
I have own Solidworks design parts and apply PID same way. But increasing integral gain doesnt have steady state error less.
@hobby_coding
@hobby_coding 3 жыл бұрын
check your COG, it has to be somewhere in the center of the robot and not biased (to the left or the right )
@technopeace4077
@technopeace4077 3 жыл бұрын
@@hobby_coding Thanks for reply. I understood mostly. But what does it mean as biased?
@hobby_coding
@hobby_coding 3 жыл бұрын
@@technopeace4077 it means that the COG is centered regarding the x and y axis
@ben.langlois121
@ben.langlois121 7 ай бұрын
why is the force in the y direction when the plane of movement is the xz? Why isn't it the z?
@hobby_coding
@hobby_coding Ай бұрын
in this simulation i only consider movement in one axis
@thaoton5623
@thaoton5623 2 жыл бұрын
Can you make a video talking about used PID+Neural Network to control self-balancing robot in Simulink?
@hobby_coding
@hobby_coding 2 жыл бұрын
you mean tuning pid params using a nn ?
@thaoton5623
@thaoton5623 2 жыл бұрын
@@hobby_coding yep, I hope you will
@merondesta3895
@merondesta3895 3 жыл бұрын
hello and please,in the library i cant find cylindrical solid option why is that
@hobby_coding
@hobby_coding 3 жыл бұрын
make sure simscape is installed
@merondesta3895
@merondesta3895 3 жыл бұрын
@@hobby_coding i have gone same steps wt the vedio simscape then multibody elements but there is only 4 options they are variable mass ,inertia ,solid, graphic where could i find the cylinderical solid option?please
@hobby_coding
@hobby_coding 3 жыл бұрын
@@merondesta3895 i have matlab 2019b so maybe you have a different version than me
@merondesta3895
@merondesta3895 3 жыл бұрын
@@hobby_coding yes so do i have to install that one or i can replace by other like from variable mass option lists thankyou
@ccpjcrew
@ccpjcrew 3 жыл бұрын
Can you make a video talking about a spherical robot?
@hobby_coding
@hobby_coding 3 жыл бұрын
That sounds like a nice idea
@k1s1t7
@k1s1t7 2 жыл бұрын
Why I can't use outotune?
@hobby_coding
@hobby_coding 2 жыл бұрын
yes you can, just be careful with the output limits.
@k1s1t7
@k1s1t7 2 жыл бұрын
@@hobby_coding Also, do we need to include the weight of battery and microcontroller in the simulation?
@hobby_coding
@hobby_coding 2 жыл бұрын
@@k1s1t7 yes absolutely
@muhammadmubashir4682
@muhammadmubashir4682 Ай бұрын
in this simulation you are just calculation vertical angle?
@hobby_coding
@hobby_coding Ай бұрын
i'm calculating the tilt angle with respect to the vertical axis.
@HuongHoang-ez9si
@HuongHoang-ez9si 3 жыл бұрын
what is 12:10
@AbhinavSingh-ji2bg
@AbhinavSingh-ji2bg 3 жыл бұрын
I'm facing a problem with my Simuscape model , I've mailed you my .slx file can you please have a look and help me in rectifying the errors
@hobby_coding
@hobby_coding 3 жыл бұрын
please read the description first .
@AbhinavSingh-fq9ek
@AbhinavSingh-fq9ek 3 жыл бұрын
@@hobby_coding my model is related to this only , I have made a self balancing robot in simuscape , I didn't get The correct output that's why i asked for help
@hobby_coding
@hobby_coding 3 жыл бұрын
@@AbhinavSingh-fq9ek ok, i will take a look into it later , I'll send you the answer via mail . 🔥 IMPORTANT : the value of the gain block is : -180 / 3.14
@AbhinavSingh-fq9ek
@AbhinavSingh-fq9ek 3 жыл бұрын
@@hobby_coding yes sir I did put the same value of gain
@efarhanarif
@efarhanarif 2 жыл бұрын
At 14:01 what is value of gain ? kindly Answer me
@marianaurel
@marianaurel 2 жыл бұрын
he put it in the video description -----> gain block is : -180 / 3.14
@khiyanatdeori5957
@khiyanatdeori5957 2 жыл бұрын
Why have you taken positive feedback loop instead of negative feedback loop?
@hobby_coding
@hobby_coding 2 жыл бұрын
it's negative just look at the negative gain , also read the description of the video for more information about this
@khiyanatdeori5957
@khiyanatdeori5957 2 жыл бұрын
Okay why is the initial perturbation made negative?
@hobby_coding
@hobby_coding 2 жыл бұрын
@@khiyanatdeori5957 well , you can set it to positive if you want it doesn't matter which side you push the robot from, the result should be the same.
@khiyanatdeori5957
@khiyanatdeori5957 2 жыл бұрын
Thanks a lot ❤️
@hobby_coding
@hobby_coding 2 жыл бұрын
@@khiyanatdeori5957 you are welcome :)
@wenhaoli6218
@wenhaoli6218 3 жыл бұрын
Is this video back on the shelves
@hobby_coding
@hobby_coding 3 жыл бұрын
i made a remastered version
@oktaysaglam2372
@oktaysaglam2372 3 жыл бұрын
How can I make a contact definition on the model?
@hobby_coding
@hobby_coding 3 жыл бұрын
you mean the robot contacting the ground? i believe there is an unofficial library made by one of the Simulink employees, I didn't have the time to implement this idea thou, maybe in the future.
@oktaysaglam2372
@oktaysaglam2372 3 жыл бұрын
@@hobby_coding "Spatial The Contact Force "block creates a contact between two definitions. I'm surprised you don't know :/
@hobby_coding
@hobby_coding 3 жыл бұрын
@@oktaysaglam2372 i think this block was introduced lately to simscape , however a couple of years ago when you wanted to achieve such a thing you had to download a library from file exchange, anyways I'm grateful to you for telling me about it , I'm definitely gonna explore this further.
@hobby_coding
@hobby_coding 3 жыл бұрын
@@oktaysaglam2372 this i what i was talking about link : kzfaq.info/get/bejne/btR0pK1n2NHPXWw.html
@oktaysaglam2372
@oktaysaglam2372 3 жыл бұрын
@@hobby_coding thank you brother success :D
I Built a Ball Balancing Robot
8:55
Aaed Musa
Рет қаралды 1 МЛН
applying an LQR command on a self-balancing robot in Simulink |2021|
7:01
Mouad Boumediene - Hobby Coding
Рет қаралды 17 М.
THEY WANTED TO TAKE ALL HIS GOODIES 🍫🥤🍟😂
00:17
OKUNJATA
Рет қаралды 20 МЛН
БОЛЬШОЙ ПЕТУШОК #shorts
00:21
Паша Осадчий
Рет қаралды 9 МЛН
BUILDING a Self-Balancing Robot | PART 3 - Remote & Code!
18:15
Noah Zipin
Рет қаралды 22 М.
Self Balancing Robot Tips that will Save your project
5:36
Mouad Boumediene - Hobby Coding
Рет қаралды 26 М.
PID Balance+Ball | full explanation & tuning
13:13
Electronoobs
Рет қаралды 731 М.
How to control a DC motor with an encoder
9:30
Curio Res
Рет қаралды 423 М.
Mô phỏng động học robot trên Matlab Simulink
31:07
Dương Trần Đình
Рет қаралды 9 М.
Robot Modeling and Simulation with MATLAB and Simulink
57:51
Presentation Ascento
9:32
D-MAVT, ETH Zurich
Рет қаралды 31 М.
Developing a Pick-and-Place Robotic Arm
6:35
Kai Nakamura
Рет қаралды 8 М.
Rasterizer Algorithm Explanation
5:18
HuCE - cpvrLab
Рет қаралды 75 М.
تجربة أغرب توصيلة شحن ضد القطع تماما
0:56
صدام العزي
Рет қаралды 6 МЛН
Как слушать музыку с помощью чека?
0:36
Здесь упор в процессор
18:02
Рома, Просто Рома
Рет қаралды 162 М.
1$ vs 500$ ВИРТУАЛЬНАЯ РЕАЛЬНОСТЬ !
23:20
GoldenBurst
Рет қаралды 1,6 МЛН
Опять съемные крышки в смартфонах? #cmf
0:50
PART 52 || DIY Wireless Switch forElectronic Lights - Easy Guide!
1:01
HUBAB__OFFICIAL
Рет қаралды 34 МЛН