The boring talk
On summer 2018, The University of Adelaide was nice enough to offer me a position to be a research assistant. I took the job because I need it, I leave the job wanting to stay for longer (and I did, unofficially).
I’m not good with words, so here’s the email Dr. Hong Gunn Chew sent me (an overview of the project):
Autonomous systems and multi-agent systems are broadly researched and applied in both academic and commercial fields. To test these systems and evaluate the performance, Unmanned Ground Vehicles (UGV) are commonly used as the experimental platform because it is easy to be operated and with fewer restrictions. UGVs is capable of being used for a variety of researches and applications, such as robotic systems, formation control algorithms and commercialise applications. However, most of the commercial products are limited by the diversity of motion types and the accuracy of movements while are used for academic experiments. Therefore, to research on developing new and improving existing autonomous systems, a suitable UGV platform is demanded, which should provide various freedom of movement being commanded by the system and detecting environmental data accurately.
This summer, we are introducing a project to develop a physical UGV platform for research purposes. The platform will be with three degrees of freedom, which means it is free to change position as surge (motion along y-axis), sway (motion along x-axis) and yaw (rotation on z-axis). The platform will also be implemented with sensors, which can detect information for navigation and feedback control. It will also be interfaced with popular modelling software tools, such as Matlab, Simulink and Labview.
on behalf of
Hong Gunn Chew
He didn’t write [something something], but you probably already knew.
Here’s what I and my supervisor planned:
- 3 degree of freedom movement, include: surge (motion along y-axis), sway (motion along x-axis) and yaw (rotation on z-axis).
- feedback system to track the position of the rover.
- couple of distance sensors (IR sensor, laser sensor etc.) and cameras for object avoidance and mapping.
- 6 degree of freedom robotic arms attached on top of the rover
I only managed to complete the first half of the initial plan (3 DOF movement and feedback system). In my defense, I only have 3 months to complete it and it was my first project. Also, I won’t take the blame for the robotic arm as it was being developed by another group and it was far from functioning when I finished my platform (yes I know I’m being salty).
So here’s the demonstration video I made after finished the project. You go watch it before continuing.
When I first do a demo to my supervisor (Prof. Peng Shi, the guy got his own Wikipedia page), he said: “…right now it’s still very simple, what is it use for?”. I think I died a bit inside after he said that. Prof. Peng was very nice, but he only saw me 4 times during the 3 months I was working on it (2 times on the stairs while I was going somewhere), so I can understand he did not see it as a great achievement on my part. Also, I’m inexperienced, getting an LED to blink probably make me smile already.
The real, good stuffs
Anyways, I will use this post to talk about my mistakes, my experiences on this project. The actual documentation should be found in this GitHub link, along with the code base, 3D drawing, and PCB design.
I love physics as much as the next guy, but I’m nowhere good at it. Math too, jeez. I did alright in high school and uni but I always feel like I lack the big picture vision and the. I did not come up with the dynamic model for the rover, but I was lucky enough to find this research paper, which is good enough (maybe even too good, as I only used the first few pages).
The image on the right is basically all the math that I got to do to get the required speed of each wheel, given the required linear speed that I want. Easy peasy? Not really. What I failed to see is their setup is different than mine. Their v0, v1, v2 was different than mine v0, v1, v2. The sign is switched, the phase is incorrect. It’s a mess.
This, however, led to me blaming the wrong part of code when things not working out. Fixing the wrong parts leads to making the right parts behave like a bad puppy. I still have nightmare sometimes because of that. When I finally figure it out what really went wrong (and fix it), the thing just works.
For the longest time, I hated myself so much for this. It delayed the whole operation, and caused me not able to work on the part I’m most interested in which is create computer vision for the rover.
So my second supervisor is Mr. Xin Yuan. He’s a Ph.D. candidate at the time and I guess this is kinda what he has to do apart from the usual research works. I heard we are also his first research group that he supervises. I like him. Smart, independent but he is more of an academic individual rather than a practical engineer.
His idea for a feedback system was to have ONE IMU sensor on the rover and have accelerometer and gyroscope data to calculate the current position. That caused me more than a month to implement to realize that it is nearly impossible to get any good tracking from that alone as the drifting error is huge at a short period of time (we talking few seconds short).
So we ended up using THREE IMU sensors, one on each of the wheels then use gyroscope data to find the velocity of each wheel and from that, calculate the current position. That is much better, but only after I ran it through a Kalman Filter. I know that the de facto way to do this is using 3 encoders but we were kinda tight on budget at that time (we already bought 4 IMU sensors initially).
But then I realized that the Shield (which use the same chip as the Arduino Nano btw) is not fast enough to acquire 3 sensor data, do all the computation, drive 3 stepper motors (yes, we used stepper motors, I will talk about that next) and communicate with the Raspberry Pi at the same time. At a certain point, the speed of the stepper motor just levels off (because it’s not fast enough to send enough pulses to the stepper driver). Here are some graphs to demonstrate, the blue line is the speed I want it to get to, the black line is the data after went through Kalman Filter (trust me, you don’t want to see pre-Kalman, it’s a messy mess):
So I use another Nano to take data and do all necessary computation and that solved the problem, nice and easy.
So we use stepper motors. Oh boy, was that a fun decision. I can see Xin Yuan’s reasoning behind this (stepper motor is accurate for position control without needing feedback), but what both of us failed to realize was the amount of torque output from the motors. It was simply not enough to drive a 10cm in diameter wheel. The wheels run smoothly when applying no resistance but start skipping steps as soon as the rover runs on the ground (rover was pretty heavy). Then the whole idea of not needing feedback is lost, since we can’t really know how many steps are skipped. Hence the feedback. But I do have to admit, control speed on a stepper motor is much easier than on a DC motor (I’m not a control guru, actually, I know nothing about control at the time of writing this post).
That’s all the major ones I could think of, there are a couple minor more, mostly safety-related (safety is not a joke guys, it will start hurting your $$$ bad if you ignore it).
I learned a lot from this project, mostly project management side (the absolute worst), but I didn’t talk too much about that here, as it is too personal. If I became rich and famous one day, this project will be the start of it all.
Anyways, I want to close this post but not sure how, so here’s a photo of me and Prof. Cheng-Chew Lim. The guy is the absolute legend in EEE department, head of school, director of research and all. And look at me, I can’t stop smiling haha.
So how did I do? Too much chit chat, rambling? Too little (I doubt that)? I’m more relax and unprofessional in my blog compare to my GitHub. Well, that’s the whole reason I created my own blog in the first place. I can’t put on a straight face for too long haha.
But jeez, please leave a comment. I’m lonely :(.