DC Motors: A Practical Guide  | INTRO
1:45
Пікірлер
@buseo5936
@buseo5936 6 күн бұрын
Hello. I implemented a state feedback control using the state-space model with the provided A, B, C, and D matrices in Simulink, but I noticed that the state variables are diverging. When I checked the poles using the eig function, I found that there is a positive real number included. Why does the regulator work correctly in the Simscape model, but when I create a separate state feedback model, it produces diverging values? Also, when designing a state feedback model in Simulink, should the initial value of the integrator be set to the same value as the step input in Simscape?
@raginigupta4857
@raginigupta4857 6 күн бұрын
ROBOT.py----> import pygame import math import numpy as np def distance(point1,point2): point1 = np.array(point1) point2 = np.array(point2) return np.linalg.norm(point1- point2) class Robot: def __init__(self, startpos,width): self.m2p= 3779.52 #from meters to pixels #robot dims self.w = width self.x= startpos[0] self.y = startpos[1] self.heading =0 self.vl = 0.01*self.m2p #meters/s self.vr = 0.01*self.m2p self.maxspeed = 0.02*self.m2p self.minspeed = 0.01*self.m2p self.min_obs_dist = 100 self.count_down = 5 #seconds def avoid_obstacle(self,point_cloud,dt): closest_obs = None dist = np.inf if len(point_cloud) > 1: for point in point_cloud: if dist > distance([self.x, self.y], point): dist = distance([self.x,self.y], point) closest_obs = (point,dist) if closest_obs[1] < self.min_obs_dist and self.count_down > 0: self.count_down -= dt self.move_backward() else: #reset count down self.count_down = 5 #move forward self.move_forward() def move_backward(self): self.vr = - self.minspeed self.vl = - self.minspeed/2 def move_forward(self): self.vr = self.minspeed self.vl = self.minspeed def kinematics(self, dt): self.x += ((self.vl+self.vr)/2) * math.cos(self.heading) * dt self.y -= ((self.vl+self.vr)/2) * math.sin(self.heading) * dt self.heading += (self.vr - self.vl) / self.w * dt if self.heading>2*math.pi or self.heading<-2*math.pi: self.heading = 0 self.vr = max(min(self.maxspeed, self.vr), self.minspeed) self.vl = max(min(self.maxspeed, self.vr), self.minspeed) class Graphics: def __init__(self, dimentions, robot_img_path, map_img_path): pygame.init() #COLORS self.black = (0, 0, 0) self.white =(255, 255, 255) self.green =(0, 255, 0) self.blue =(0, 0, 255) self.red = (255, 0, 0) self.yel = (255, 255, 0) #----MAP---- #load imgs self.robot = pygame.image.load(robot_img_path) self.map_img = pygame.image.load(map_img_path) #dimentions self.height, self.width = dimentions #window settings pygame.display.set_caption("Obstacle Avoidance") self.map = pygame.display.set_mode((self.width, self.height)) self.map.blit(self.map_img, (0,0)) def draw_robot(self,x,y, heading): rotated = pygame.transform.rotozoom(self.robot, math.degrees(heading), 1) rect = rotated.get_rect(center=(x, y)) self.map.blit(rotated, rect) def draw_sensor_data(self, point_cloud): for point in point_cloud: pygame.draw.circle(self.map, self.red, point, 3, 0) class Ultrasonic: def __init__(self, sensor_range, map): self.sensor_range = sensor_range self.map_width, self.map_height = pygame.display.get_surface().get_size() self.map = map def sense_obstacles(self, x, y, heading): obstacles = [] x1, y1 = x, y start_angle = heading - self.sensor_range[1] finish_angle = heading + self.sensor_range[1] for angle in np.linspace(start_angle, finish_angle , 10, False): x2 = x1 + self.sensor_range[0] * math.cos(angle) y2 = y1 - self.sensor_range[0] * math.sin(angle) for i in range(0, 100): u = i / 100 x= int(x2 * u + x1 * (1-u )) y= int(y2 * u + y1 * (1-u )) if 0 < x < self.map_width and 0 < y < self.map_height: color = self.map.get_at((x,y)) self.map.set_at((x,y), (0, 208,255)) if (color[0], color[1], color[2]) == (0,0,0): obstacles.append([x,y]) break return obstacles main.py --> import math import pygame from ROBOT import Graphics, Robot, Ultrasonic MAP_DIMENSIONS = (600, 1200) #the environment graphics gfx = Graphics(MAP_DIMENSIONS, 'D:\college\internship\INTERNSHIP TASK\obstacle detection\images\DDR.png', 'D:\college\internship\INTERNSHIP TASK\obstacle detection\images\Obstacle.png') #the robot start = (200, 200) robot = Robot(start, 0.01*3779.52) #the sensor sensor_range = 250, math.radians(40) ultra_sonic = Ultrasonic(sensor_range, gfx.map) dt=0 last_time = pygame.time.get_ticks() running = True #simulation loop while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False dt= (pygame.time.get_ticks()-last_time)/1000 last_time = pygame.time.get_ticks() gfx.map.blit(gfx.map_img, (0,0)) robot.kinematics(dt) gfx.draw_robot(robot.x, robot.y, robot.heading) point_cloud = ultra_sonic.sense_obstacles(robot.x, robot.y, robot.heading) robot.avoid_obstacles(point_cloud, dt) gfx.draw_sensor_data(point_cloud) pygame.display.update THANK ME LATER😌
@munadarweesh6511
@munadarweesh6511 10 күн бұрын
Thank you Sir for the video. I tried to run the code in the video install scipy version does not work
@antonwezels9403
@antonwezels9403 16 күн бұрын
Hello, are your services still available on fiverr?
@hobby_coding
@hobby_coding 16 күн бұрын
Unfortunately not, i did Fiverr to support myself during my PhD years. but now i have too much work on my hands. All i can do now is to answer your questions in the comments section.
@antonwezels9403
@antonwezels9403 14 күн бұрын
@hobby_coding But thank you very much for your valuable content, it helps me a lot. Do you have any tip on how I can apply your simulation approach in a real environment by using RP Lidar and Rasphberry Pi as a device for mapping a space?
@hobby_coding
@hobby_coding 22 күн бұрын
🔗Source Code: Rubik's Cube simulation: ko-fi.com/s/8558c6b0a0 Rubik's Cube simulation (machine learning solver) : Coming soon
@ossamadraoui9845
@ossamadraoui9845 26 күн бұрын
That's cool bro but you mispositioned the colors of the Rubik cube
@hobby_coding
@hobby_coding 26 күн бұрын
which faces ? i believe everything is correct.
@EdRlld98
@EdRlld98 23 күн бұрын
@@hobby_coding Yes they are! Impressive Mouad! Happy to see that you're finally working on that project :)
@hobby_coding
@hobby_coding 23 күн бұрын
@@EdRlld98 Thanks Edouard for introducing me to RayLib. It's really powerful and user-friendly.
@Astro_Jaw
@Astro_Jaw 26 күн бұрын
That's a really nice project and your explanation was easy to follow keep up the good work 👍
@hobby_coding
@hobby_coding 26 күн бұрын
Glad you liked it!
@syedsajjadali4220
@syedsajjadali4220 26 күн бұрын
That's cool❤
@hobby_coding
@hobby_coding 26 күн бұрын
Thanks !
@hobby_coding
@hobby_coding 27 күн бұрын
How did you like this second part Rubik's Cube simulation: ko-fi.com/s/8558c6b0a0 Rubik's Cube simulation (machine learning solver) : Coming soon
@Noone-lw6ge
@Noone-lw6ge Ай бұрын
I really liked this tutorial, I’m looking forward for part 2
@hobby_coding
@hobby_coding 29 күн бұрын
Glad you liked it, i'm making part 2 right now.
@dnmsgogo
@dnmsgogo Ай бұрын
que genio
@hobby_coding
@hobby_coding Ай бұрын
very much apreciated. I'm glad you enjoyed it.
@user-in3ex3rd1y
@user-in3ex3rd1y Ай бұрын
I just took a look into your older videos - you do have a good narrating voice, please use it instead of this annoying TTS/AI voice
@hobby_coding
@hobby_coding Ай бұрын
Thanks for the suggestion, i'll surely consider doing that for the rest of the series.
@mohamedfarrag3869
@mohamedfarrag3869 Ай бұрын
Impressive as usual Thank you for sharing your work with us
@hobby_coding
@hobby_coding Ай бұрын
My pleasure!
@hobby_coding
@hobby_coding Ай бұрын
Hello i'm back 🔗Source Code: Rubik's Cube simulation: ko-fi.com/s/8558c6b0a0 Rubik's Cube simulation (machine learning solver) : Coming soon
@ankita5470
@ankita5470 Ай бұрын
the code executed fine and the output video file was generated. but when i played the video the lanes weren't marked with green color, or highlighted in anyway. It looked same as the input video. where could i be missed something ? i followed your code line by line . please help
@renzsuarez4027
@renzsuarez4027 Ай бұрын
can this be use in Lightbulbs?
@hobby_coding
@hobby_coding Ай бұрын
you need a couple more components but, yes this will work on a light bulb.
@wfpnknw32
@wfpnknw32 Ай бұрын
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 Ай бұрын
thanks for the valuable remark.
@hassansakeef5838
@hassansakeef5838 Ай бұрын
Hello great video sir, i was wondering how do you suppose is it possible using the same model for the robot to make turns to reach a certain target rather than just move forward and backward? An idea or resource would be highly appreciated. Thank you.
@hobby_coding
@hobby_coding Ай бұрын
you can use another 3D robotics simulation environment like gazebo + ros.
@renzsuarez4027
@renzsuarez4027 Ай бұрын
can i ask is this work in light bulb?
@hobby_coding
@hobby_coding Ай бұрын
you can use a relay to easily turn the light bulb on and off using the project presented in this video. however if you wanted to dimm the light than you'll need an AC dimmer module and a dimmable light bulb.
@khemisakram
@khemisakram 2 ай бұрын
i have a drim to be a youtuber like you keep going bro
@hobby_coding
@hobby_coding Ай бұрын
Thanks for encouragement. my goal was not to be a youtube, it was always to be a scientists and an educator, and youtube provided a platform for me to deliver my content to people. just make a youtube channel and share the projects that create even if they are simple, there is always people who can find your ideas useful.
@muhammadmubashir4682
@muhammadmubashir4682 2 ай бұрын
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.
@haihuynh8337
@haihuynh8337 3 ай бұрын
Is it more performant to find the intersection between (x1,y1),(x2,y2) and the four sides of the rectangle instead of splitting it to 100 points?
@hobby_coding
@hobby_coding Ай бұрын
yes, it could be . but you are assuming that the obstacle is a rectangle. it might not be .
@maurya_1
@maurya_1 3 ай бұрын
Great videos loving it please keep making these videos
@hobby_coding
@hobby_coding Ай бұрын
Thank you! Will do!
@kadaliakshay6770
@kadaliakshay6770 3 ай бұрын
hey is there any way of doing this with camera but without a LIDAR? because I've done some research and it kinda looks like it's possible...
@hobby_coding
@hobby_coding Ай бұрын
Yes, autonomous driving can be done with a camera. Tesla for example uses cameras, radar and ultrasonic sensors.
@hobby_coding
@hobby_coding 3 ай бұрын
📁 source code: ko-fi.com/s/b0f376134e
@amr.a-m8350
@amr.a-m8350 3 ай бұрын
Good video .How to convert signal position of revolute to voltage to be inserted to the pid to get a force acting on prismatic
@terrybates8407
@terrybates8407 3 ай бұрын
So one good collie 👍
@hobby_coding
@hobby_coding 3 ай бұрын
Thank you
@hobby_coding
@hobby_coding 3 ай бұрын
Python Sheep Herding Simulation 🗃️ source code: ko-fi.com/s/f5c64c0476
@ShaikMohinuddin
@ShaikMohinuddin 3 ай бұрын
Hello, can you upload a video of adding a PID controller to the robot you imported from onshape. Like a walking robot.. thank you
@hobby_coding
@hobby_coding Ай бұрын
could be done, thanks for the idea.
@hamedshamsikhani3345
@hamedshamsikhani3345 3 ай бұрын
Thank you very much dear sir. You teach excellent but please describe more about something like 100 signals or sample time! I exactly make your model . My motor turns about 3200 rpm but the result is not acceptable.
@hobby_coding
@hobby_coding 3 ай бұрын
🗃️ source code : ko-fi.com/s/1a38e1563b
@Hanan-qz8ms
@Hanan-qz8ms 3 ай бұрын
I use rplidar c1.. when i run it apper a black window and the lidar doesn't connect or even work!😢 please help me
@hobby_coding
@hobby_coding 4 ай бұрын
🏷️ Download the files: ko-fi.com/s/716bba8384
@hobby_coding
@hobby_coding 4 ай бұрын
code: ko-fi.com/s/86d7053723
@alanperez7551
@alanperez7551 4 ай бұрын
If you did all right and still having and error try this: "File" -> "Invalidate Caches / Restart" -> "Invalidate and Restart". This restart the old cache and validates the added modules like: import pygame etc...
@user-vn1ix3ji3t
@user-vn1ix3ji3t 4 ай бұрын
Hello! I wrote all the code like yours, but it doesn't display, scan, or display an image.
@outer1269
@outer1269 4 ай бұрын
most part of the main.py code didnt show in the later part of the video
@antonwezels9403
@antonwezels9403 4 ай бұрын
Hey are you still on fiverr available?
@DANCEmaster7339
@DANCEmaster7339 4 ай бұрын
I still didn't understand the purpose of adding delay blocks. Z-1 and Z-100
@mgbezechike23
@mgbezechike23 4 ай бұрын
How can i get the circuit diagram for this please. And also what DC motor and encoder did you use
@kidtimusprime
@kidtimusprime 4 ай бұрын
Hi you mentioned in the video that you will make a video on how to manually control the robot in gazebo. Can I know how to do that? thank you
@HeavenlyDemon_
@HeavenlyDemon_ 5 ай бұрын
This guy just ditched everyone in this comment section 😂😅 not gonna use this vid then .shameful
@hobby_coding
@hobby_coding Ай бұрын
Sorry i have been working on some very time-consuming projects. i'm here now :) what was your question ?
@user-ou8zh3dv4e
@user-ou8zh3dv4e 5 ай бұрын
Thanks for sharing such an Awesome project . Can you please share Arduino code & MIT App Inventor .aia file for this project
@swasthikk3655
@swasthikk3655 5 ай бұрын
Can we use it for alphabet recognition?
@hobby_coding
@hobby_coding Ай бұрын
i think you can use this model's architecture for spoken letter recongnition as well yes.
@babihalal2553
@babihalal2553 5 ай бұрын
Hi, would like to know will it be possible to implement this lane detection algorithm on a real time live stream using a esp32 cam?
@aisharawat9102
@aisharawat9102 4 ай бұрын
Hey is it working in real time or not??
@vedmaheshkale5943
@vedmaheshkale5943 5 ай бұрын
Life saving......😊
@user-ww1rd7xe1u
@user-ww1rd7xe1u 5 ай бұрын
you are really stpd or what is sh*t
@sreeharib9359
@sreeharib9359 6 ай бұрын
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?