So, I was showing a friend something and thought y’all might like to see it too. I’m just simply grabbing the data from the accelerometer, doing some very basic math to turn it into angles (I like to do things with the least amount of math possible) and then rendering!
(Update: here’s the code if anyone wants to poke around in it. http://pastebin.com/6sBPquV0)
Sadly my screen is broken so I’m just remotely viewing the NXT screen; due to several factors there is some noticeable lag. I am looking into getting rid of that.
Anyways, I’ve got some other odds and ends on the topic of rendering things. Here’s a little sample!
Note: Please watch in HD
So! This is the first thing I make after my long hiatus. Of course, another balancing bot.
I’m very, very pleased with the stability of this one. It’s only using a gyroscope, although you will see an accelerometer, it is not actually plugged in. That is for other projects.
Anyways. This bot is actually kind of unique in the way it begins balancing. Usually when you have a segway-style bot like this, whatever position you start in is saved, and it attempts to maintain that position. So, if your robot is a little off-balanced when you start it, it will drift and/or fall in that direction.
However! This one actually doesn’t do anything based on what angle you start it out at; when you start it, it will soon detect that it’s falling, and overcompensate. Then when it switches and is falling the opposite direction, right at that moment when it’s between the two, it is perfectly balanced. It grabs that data and uses that for reference, instead of it’s starting point.
Then, once it finds true balance and stabilizes, it holds the location, rather than drifting around. (Hooray for PID that finally works, hah!)
This was the fastest thing I could throw together, and even on a solid surface it operates very, very well. Much better than that old light sensor one… :P
I have big plans for this one and will be hopefully adding bigger wheels and potentially altering the structure a bit, but for now it is really stable and works great.
Mmkay, so in order to make a new bot I need a lot of things, like the bot itself, parts, a programming environment, etc etc.
I just installed BricxCC again. Sweet.
I downloaded some demo code to remind me how to use the sensor I have. Sweet.
I couldn’t find my rechargeable batteries so I just picked up a 24-pack of good-quality (personally tested) alkalines for less than seven bucks. Sweet.
I have the USB cable, the NXT, three motors, the wheels I’m going to use, the NXT cables, and some of the parts. I haven’t found my sensor yet (hooray for moving TWICE recently so everything is in boxes) but I’m sure I’ll find it soon. I’m shooting a wedding today, though, so I won’t have as much time to work on this as I’d like, sadly.
But hey, at least I have batteries! :D
So, someone requested I upload some of my robot pictures to imgur so they could see them. I grabbed a few and threw them together here, along with some descriptions!
I understand that if you keep at least 50% of the weight below the point where the two ends of the chain are secured, then the balancing is much easier. What this guy here does is amazing.
I’m going to try and tackle something like this for my next robot. I’ve got a basic design laid out in my head, and I’ll only need to use my analog, single-axis gyro for this, as opposed to the digital 3-axis+accelerometer unit, which will make this much easier. (Working with data over i2c is not my thing… yet.)
Anyways, just wanted to do a quick mini-post.
Also, just wanted to let y’all know: I’ve got another NXT video up on my youtube channel, and IT’S IN 3D. Go find it, it should be the latest one there.
Rather than blathering about the usual ‘been busy with life’ I’ll get down to the meaty stuff.
I’m considering working with NXT again. But, I need to state some things.
I have a 3-axis analog(?) accelerometer (from HiTechnic), a single-axis analog gyro (also from HT), and a Dexter Industries dIMU (digital 3-axis gyro and 3-axis accel all in one).
On top of those sensors I have the standard NXT 1.0 kit, although I’m considering gutting the mic and turning into something else, still undecided about what I’d turn it into.
I can’t think of anything else I have off the top of my head—wii motes, a jailbroken iTouch, and a PS3 controller are also in my inventory but those are non-standard.
Lastly, I do things that are challenges. Render grayscale on a black and white screen without knowing other people have done this? Check. Build a balancing bot from a light sensor without knowing that’s how other people did it? Check. Building one from just an accelerometer? Check. building self-driving ballbots, unicycles, and motorcycles? Check, check, and check. Writing a physics engine just for the sake of driving crazy visuals on the display? Check. I could go on, but you get the idea: using something beyond it’s original purposes, thinking outside the box.
So with that in mind… what should I attempt next? I’d like to try my hand at a hexapod, I think, or some take on a walking bot. You guys do some pretty crazy stuff yourself, and while I don’t have fancy stuff like omniwheels or anything, I’ve still got a crazy brain that works around such obstacles.
So I end this post with a vague question, sue me. I’m just trying to get the ball rolling.
Edit: I forgot to mention. If I can’t find anything interesting enough to get me back into NXT, that stuff is for sale, y’all. I’m trying to sell the HiTechnic sensors anyways since I obviously don’t need them…
So I’ve got it working.
Thankfully Matthew Richardson gave me a library for it, and a good friend of mine taught me about the “#include” function (so I don’t have to have the library in all of my programs); now I can read values from it. These values are currently the three axes of the gyro and the three axes of the accelerometer. Unfortunately I seem to be getting a huge error from my accel. It’s not completely unusable, because I can always calculate what the offset is and then implement that in the library. I think that’s the best way to do it, at least, but I’ve never worked with libraries before so I’m probably doing it all wrong.
I drew a realllllly basic graphic of the dIMU and overlaid it on screenshots of the NXT Screen tool in BricxCC, running a bit of code to show the X, Y, and Z values of the accelerometer. You can see just how off the sensor is…. I will need to fix that so that my brother can write some Statics/Dynamics code! :D