July 17, 2024
Today, I mainly worked on implementing a derivative controller to my ROSBot. Yesterday, my robot could track the AprilTag relatively well, other than when the tag went out of the field of view of the camera. Using a derivative controller as well would help with this issue.
I first watched Professor Tron's lectures on derivative controllers to get an idea of the theory behind derivative controllers. However, real life is a bit different from theory, so instead of taking the derivative of the error function like in theory, I made some code that would calculate the difference between the current error and the previous timestamp's error, and then divide that all by the interval of time between the two error values. Then, I multiplied this value by K_d, and then added it onto my proportional error value.
When trying my new controller with an AprilTag, it was definitely much smoother than just using a proportional controller. Below is a short video showing my testing.
After, I planned to move around one ROSBot and have the other one follow. I first attached an AprilTag onto the back of my other ROSBot using tape and some screws to hold it up. Then, I ran the key_op node so I could control the robot with the AprilTag. Despite my poor driving, the other robot was able to follow the robot I was controlling relatively well, which is exciting. Below is a video of this demonstration.
Although there are some minor tweaks I can make, such as tuning the controller so that there is less oscillations or using more launch files rather than running individual nodes, I have basically completed my initial project goal of following one robot with another. I really enjoy this project, so I want to continue by exploring different, more complex aspects of this project.
Comments
Post a Comment