Tuesday, May 17, 2016

Raspberry Pi Quadcopter (Almost 1 year update)

So I haven't been working on the Quad very much. I took it to college with me, but I couldnt find the time, space, or motivation to make any significant progress with it. the problem I was having last winter break, i believe, was that the code from PiStuffing worked, but The Quad just kept accelerating to its maximum thrust, and blew off its propeller caps. At first, I thought that this may be a problem with the PID gains, because the guy who built the code probably had a quad with different specs and mass properties. I thought I would have to somehow find the right gains for my design.

Then just recently, I had a different Idea. I realized that the commands that we were giving the quad were just simple velocity commands, and so the gains had nothing to do with the constant max thrust. Even if the gains were wrong, we would still see a constant thrust(PWM Signal)rather than an increasing one, when the velocity was set to a constant. The problem is not with the code. It is with the experiment. When testing, I did not want to destroy my ceiling, or fly in to international airspace, so I had tethered the quad to the ground using thread, with some slack.

When I ran the tests, the incorrect gains caused the quad to thrust up a little too much but because of the thread, the quad could not rise effectively. The PID took the small velocity change as an input and we needed more velocity, so it increased the velocity as an output. Now the thread was pulled taut, and velocity was zero, so the PID just kept increasing the thrust until the max thrust was reached.

I need to find a way to test the quad in a more effective way.

Solidworks and Matlab

robotics is an expensive hobby. with all of the electronics parts and the structural components, and the power supplies and the testing equipment, it is hard to find an easy way for me to build some of the ideas i had in mind. for example, I wanted to prove to myself that I could fully design and build a robotic arm, but i have no idea where to start, since randomly buying servos and parts and hoping it works is not good engineering practice, nor is it cost efficient. 

I talked to one of my professors, Dr. Panogiotis Artemiadis, about using some of his EMG devices to control a simple robotic arm, as an interesting project. he agreed to help me (and I am extremely thankful), but first I have to have a robotic arm to use. I decided that instead of spending so much time and money on building a real arm, why not design one on SOLIDWORKS, and simulate the motion and control systems in Matlab. I learned both of these softwares inn these first two years of college. So i created a very rudimentary robotic arm, with only two degrees of freedom, meaning two arms, in SOLIDWORKS. 

Once I had that assembly made, after a little bit of online research, I Installed the Simmechanics toolbox in to Matlab, and the simmechanics link in to solidworks. Then I exported the assembly as an xml file, through the simmechanics link, which seems to be the only way to actually import a model in to matlab/simulink. When I opened the xml model of the arm in simulink, the progrram automatically had created a project with all of the individual parts from my assembly, with all the relations put in. 

When I ran the simulation, the output was a 10 second video of the arm starting in one orientation, and then moving based on the effects of gravity and the relations and geometries of the parts. Because it was just a two joint arm, it modeled like a two arm pendulum, with very complex motions. 

I realized that the simulink model did not take in to account any collisions between the parts, as the arms freely swung through the base, despite both being solid parts. I am now going to focus on adding angle constraints to prevent part collision. I will also add a PID control loop, with a step function, and joint actuators at the hinges, to be able to control the angle, and the measure the torque necessary to hold up the arm. 

That max torrque will tell me how powerful of a servo will be necessary to power the arm and not break.