Member of The Internet Defense League

Total Pageviews

Saturday, March 26, 2011

Next Semester! (Will be HELL)

Well, I've pretty much figured out the classes I'm going to be taking:

Let me paint you the picture:
Wake up on monday morning:
Struggle out of bed, brush teeth run off to Calc 3 for 8:30-9:20
After that rush over to the next building for fundamentals of physics
Once thats over with, relax in a dining hall on central campus, reading over notes and eating until 11:45 when I run over to my computer organization class.
After that read a bit more and maybe eat if I'm still hungry, once it's 1:55 mozy on over to Evolutionary robotics to get my awesome on.

tuesday:
Wake up and brush teeth and eat, head over to Evolutionary Computation at 10 go over to it, get out, do homework for all my classes and then sleep. Only one class, bing bing!

Wednesday: same as monday

thursday!
Wake up for 8:30-9:45 calc 3 again! Moan and bitch about courseload while doing homework until 10 (only 15 minutes of bitching of course!) when I run over to Evolutionary computation. after that, same as tuesday

Friday!
Wake up and go through monday's routine with an added twist at the end! At 4:05 go to a 2 hour or so physics lab! After that, contemplate how much illegal drinking is worth, decide against it, and sit and code and study!

And as all of this is happening, perhaps I'll TA a program'n class or work a work study job as well.

Saturday and Sunday? Lay comotosed on bed by amount of knowledge intake while reading every course book ever.

Thursday, March 24, 2011

Tommorow is a new day

You know, last night I was lying in bed and just thinking, my roommate and I say said goodnight to each other and I almost said: "Tommorow's a new day"

This struck me. Because it's what my mother always repeated to me whenever she would tell me goodnight. And I realized, that it was that attitude which continues to push me forward. Yeah, today might suck, but tomorrow is a new day. Today was awesome? Tomorrows a new day and it will be just as promising. It's so simple, but so freeing. And as I was thinking about this, another bit of info popped up in my head, about talking to my friend Julie earlier about how I'm going to send my children to church 'til they hit their teenage years. Why? Not because I want them to believe in some religious god or something, but because it instills good moral values. And helps to shape development towards a nicer and kinder person. I know that I despised being woken up in the mornings to go to church, but I still went. And sometimes when I was in a bad situation, I was able to extract myself out and realize that whatever was happening was wrong. It taught me kindness and to think of other people's shoes.

I'm not saying that people can't come to be like this without a church-upbringing, but I'm pretty sure it probably helps. Maybe if I had gone longer and paid more attention I wouldn't be such a selfish person sometimes.

Recently I've caught myself being selfish, and I've acknowledged it to myself and then continued on. This might not be that great, because I'm not actually doing anything about it, which I guess could be considered worse. But, at least I'm starting to notice when I'm putting myself first. For example, my roommate wanted to get a single for next year. I didn't take any offense, I know he just likes his own time and space and such, and I was alright with rooming with 'a random' so to speak. So I told him to figure out where he would be living and such and if he couldn't get a single to let me know before the deadline for housing contracts. Long story short, he couldn't get a single so we, or rather I, went to the virtual tours of the other dorms. Because I didn't want to live in the same building again due to it's lack of social environment. I found a nice one that had already kinda stuck itself into my head (affectionately called the Castle, or the haunted Castle, etc.) and asked him about it. I then marketed and sold him on it. It wasn't hard because it was a good choice of rooming and such, but I was thinking about it yesterday and wondering if somehow I was being selfish and forcing him to room with me there and if I had made all the decisions and not just him.

There's not really a good way to tell in my opinion. But sometimes it's just those moments that irk me a bit. But then a qualify and justify and selfishness, and I do so with a simple logic: This is my life, this is my college time, I will do what I have to do in order to get the education I need to make my life the best it can be in the future.  This can get me in situations sometimes when what I do is... not so morally correct by own ethics. I try to follow a bit of Kantian philosophy with a bit of u-calc (Utilitarian Calculus) that I learned from my health care ethics class. I identity with not using people as means to an end, but at the same time, if the overall effect of using one person helps a multitude, then my u-calc kicks in and lo' n behold I've used someone to get somewhere. It happens. Alot I'm sure if you think about it.

Wednesday, March 23, 2011

Made a new Blog

Hi everyone, just letting anyone whoever stops by here to see the computer science related projects I do, they're now on my other blog, EthanEldridgeCS.blogspot.com.

Monday, March 21, 2011

XY Velocity for a projectile? Solved for

Alright, So last I left off I had coded how to deal with projectiles moving in a strictly horizontal or vertical way. And was waiting on making the code for dealing with both velocities. At first I thought I would have to deal with some type of equation of two variables and solve form both of them using some complex business, but it turns out the method I use is at least 3x simpler than that.
So, first off I use the same method I've been using to get the time interval I should be using in my estimates. since I've described that in previous blogs I won't bother redefining it here. From that I get my hBound variable which is the top of said time interval. From here, I can compute how far the projectile will travel in the time given that it travels at a constant speed of 2.0 units. I then figure out the heading of my turret to aim at so it points at the targets estimated position after hBound time. From here all I need is the vector to give to the projectile as its x movement and y movement. So, using the cos of the gun's theta times the distance of the projectile as the x component and the sin of the guns theta times the distance of the projectile as the y component, I make up my vector. From this I have a triangle that may or may not overshoot the position if fired at the wrong time. So how do I figure my delay time out?

Simple, I take the magnitude of that vector I just made and divide by hBound to get how many units of time it will take to traverse this hypotenuse I've created. If that number is equal to the time it takes for the projectile to get to the estimated position then hoorah fire right away, weapons free, danger close. If its less than that then set up delay which is as simple as Time of the target - Time of the projectile. And the other situation, where T(proj) > T(target) never occurs because that would violate the work above with the whole hBound thing, theres a reason it's called the hBound you know. From here things get pretty simple.

since I have my heading, my delay time (if there is one) all that is left to do is to fire. Which is done by created  anew object that has the position of the turret, the velocity vector is the heading vector of the turret(which has been normalized) multiplied by the velocitiy I know the projectile will travel (2.0 units), ahem. Tah-dah.

Now of course is where I fork myself, should I proceed to trying to create a 3d version of this? Or should I build up a simple library in DirectX to actually see whats going on instead of just numbers? Hmmm.

Sunday, March 13, 2011

Horizontal Target Tracking

Woo!

Just finished coding the turret of my current project to lead a target thats moving only horizontally. It took me a while to wrap my head around alot of the numbers, and also I was accidentally using degrees to start off my turrets heading and not radians. Wups!

Anyway, so this is how I accomplish leading a target horizontally:


 first using vector arithmatic and dot products and arcCos, we get the heading we'll be firing on.
 then we account for possible time delays in order to account for differences in distance.

 Heres the code: there is some stuff missing that is declared a bit above, such as getting the hBound which is the time where the distance the projectile will travel becomes greater (or equal to) than the distance the target will travel in the same amount of time. This is used so that we can lead the target. But because we lead it, we need to make sure to fire at the correct time in order to score a direct hit. So thats why we do some subtraction between the amount of distance and time and all that. Anyway: Heres the code:



if(target.velocity.y == 0 && target.velocity.x != 0){ //target only moves horizontally
                //get the heading to fire on.
                estMagPos = estMagPos + estMagVel*hBound;
                Vector2D gt =  (estMagPos - gun.position ).Normalize();
                gun.theta -= acos(Dot(gt,gun.heading));
                gun.heading = gt;
                //now, account for leading and time delay
                //hBound * vel = how much distance the proj will travel. 
                //Use the gun.theta and this to resolve the vector into it's components
                //then the distance between the (hBound * vel) - x of target
                double projd = hBound * vel;
                projd = (cos(gun.theta ))*projd; // x distance of vector
                double deltax = projd - estMagPos.x;
                double waitT = deltax/vel;
                gun.countdown = -waitT; //negation to make positive. no neg times
                gun.locked = true;
                std::cout << "Target Locked. Countdown Til Firing: " << gun.countdown << std::endl;
                system("hal target lockd");


So, the calls to system and hal are just a speech program to say the string aloud. 

Saturday, March 12, 2011

Getting a bit farther with my vectors

 So I've gotten a bit father with things, these two images show some of the thought process on what I'm working on right now.
Which is, targeting and leading when the object is moving horizontally only. I've already worked out the case for the stationary target, which is the easiest, so now I'm working on the next easiest (I think) which is just horizontal movement.
this image right here shows how I was trying to think about zones and ranges of the turret.


normally, I would go into detail on more stuff. But I'm pressed for time right now, but once I get back to the world of internets, then I will gladly post and describe all the difficulties I've been having and how I've been solving them.

coming close of vacation.

So, my vacation is starting to come to a close. And I'm looking at what I expected from this vacation, and what I actually got.

I expected that I would, maybe not get laid, but find someone here who might be a friend who I could share attraction with. And maybe have a brief fling. I did kiss one of my friends, but it's normal for her and I to kiss. We're close, and the kissing really doesn't mean much. I kiss a few of my female friends on the cheeks when I see or leave them, this one I kiss on either the cheek or the lips. It's not a romantic kiss though, it's kind of like an italian kiss I suppose because it's more friendly than anything else. Anyway, getting off topic here aren't I? I expected to maybe cuddle with a specific friend and to admit some feelings for her. That didn't happen, because even though I saw her twice... maybe three times, it was always with a group. And since she invited people to events that we had planned on doing. I'm taking her hint that she just wants to be friends who tell each other they love each other and act like boyfriend girlfirend without the actual physical affection and only the virtual. It's just fake. I'm not a fake person, most of the time, and I don't especially enjoy fake. I do put on my smile for a good amount of the day, and I tend to shrug off my insecurities and sweep all my problems under an apathetic bed. I don't want a fake relationship, and I don't want a fake love, because after pretending for so long, it starts to feel like it might actually be something. I'm tired of that illusion. ... cough. I expected to see lots of friends and catch up on old times. That kind of happened, with one of my friends. The weird thing is, it was a friend who I am close with, but she was the only one who actually gave a damn to ask about me. Most of my conversations go something like this:
Hi, hi, how are you, and then they go on for a while, when they stop, they don't ask about me, so I further the conversation by asking them how their lives are going. And then the topic is them, them, them. I wish that for once or twice, maybe I could be the topic.

I think I'm mainly annoyed at the level of drama that occured while I was home. As noted by my previous rather depressing blogpost, my friend screwed up his relationship with his girl, and happened to do it with the girl who I was falling for. It's the reason I took a walk yesterday. Loaded the playlist I talked about onto my mp3 player and went for a walk in the crappy overcast weather. It was good, I got a good amount of thinking done. I was trying to figure out if I actually really like the girl enough to go for it, or if I'm more attracted to her as a friend. I didn't really figure too much out. But, I do think I'm attracted to her based on our common fuck ups. A'la she has baggage. Much in the same way I do. She still thinks about her big ex, and mentions him a lot. He was a big part of her life, so its no wonder a lot of things still remind her of him. And I think I like that about her, because I feel the same way about my ex from a long time ago. Everything still reminds me of her. Maybe that's why coming back home is kind of painful sometimes.

I expected more from my vacation, maybe some sunshine. I know I can't control the weather, but I've seen the sun once this entire week. It's frustrating when you want to go out and do fun things with friends, but they dont want to because the weather is shitty. It's rather annoyying and difficult.

I guess, when it comes down to it, I am looking forward to go back to VT, when I've talked to people over SMS, I've had to erase a part of a text that said: I only have x days before I go back home, multiple times, I guess I consider VT more home than this place to some extent. Maybe it's just nice to have a freshstart and not have all the people who already know you and stuff. Start new, find someone new, who hopefully wont fuck up my mind like my ex did.

Wednesday, March 9, 2011

Turret Estimation

Workin on my program some more:

So I've come up with a bit more code, and a few more interesting problems. I think I've figured out how to use my vectors correctly. I can use velocity vectors and position vectors to estimate the locations of objects. It's great.

The problem I've come up with is how to figure out where to rotate my turret to in order to fire. Because I have a few variables I need to keep track of, and keep in mind.

1. The projectiles statistics: the bullet or shell to be fired by the turret has a velocity vector and position vector. Once I move into a 3d space I may include a mass in here. But besides that, velocity is a straight float, why? Because I don't know which x y components to give the vector because I don't know the theta. so, a straight number like 2.5 m/s or something, allows me to estimate where to shoot the bullet. This will make sense once I describe my idea for this.
2. The target objects estimated path using the pings. This gives me a velocity vector and a position vector for the target.
3. The current heading, or theta of the turret.

So, my method, is briefly describe in the picture below.

I ran atrial of it last night, and it appeared to be working, but I do need to iron out some kinks in the simulation

Tuesday, March 8, 2011

Personal Crap, Playlist. Cheaters

Better to have loved and lost, then to have loved at all. What bullshit. People who have never had a girlfriend or had the kind of damage done to them that only a bad break up can inflict should count themselves lucky. If you never know how it feels to be broken, then aren't you better for it? You need to make mistakes to grow, but some times mistakes do the complete opposite. Getting you stuck in a permanent loop of reevaluation of the things that happened. They might feel like they get lonely, but thats not true loneliness. You can't miss what you never had. And missing is the worst part of it all.

One of my friends fooled around with another one of my friends. Unfortunately, the boy has a girlfriend. He fessed up, which is good of him. And obviously the girlfriend said what any normal girlfriend would. I don't know if they're broken up, but they'll definately be talking and be on eggshells for a while I think. He's a bit of a moron sometimes in all respects. Not with what he does, although some of that, but with how he copes with things of this magnitude. He tries to punish himself for doing stupid things. And it's not like a regular emo kid who cuts themselves, bleeds it out, and then gets on with the rest of their day. Nope, he's gotta do more permanent damage. Goes out and breaks a couple fingers. Smooth, now not only do you have a hospital bill, you have a broken heart, broken relationship, and a broken hand. Anyway, the reason I'm writing about it, is not because I think people should be notified of these things, because they have no business with that, but because it hurt me. Even if he didn't know it, it's not like I told him anything. The girl he ended up fooling around with, is a girl who I've been crushing on. I haven't really acted on it, or told anyone besides maybe 2 people. And I didn't tell him, but he's known me long enough, seen how I treat girls who I like enough, that maybe he should have picked up on that. Or I don't know, maybe I expected him not to fuck up his life more than it already was, yeah, making out and letting hands wander with a girl whose not your girlfriend is wicked smart. Ugh.

I suppose I don't really have too much of a reason to be upset. Maybe it was just because it was so sudden. And the fact that I've been talking to this girl for quite a while, and having some pretty deep conversations with her. Admitting things to her that I don't tell anyone else. Letting myself open up again for once. But whatever right? That isn't important. She told me stuff to, letting me know things that she wasn't sharing with too many other people if anyone. And I felt comfortable talking to her about it, it seemed right. I felt like maybe I had found someone else finally. She would tell me about her current boy trouble and stuff. Liking a guy who I know is a womanizer, and I was giving her advice. You know how it is. Boy A fucks with Girl B and Boy C, who is falling in love with Girl B comforts her and hopes that everything works out for her, even if none of those plans include him. God, I hate it so much. Its like a constant wave of shit from the ocean of bad tidings.

I'm just having some bad luck it seems like, not that my luck has changed at all for the last 3 years. I've been screwed since I broke up with the first girl I actually loved.  The girl who moved away has stopped talking to me. I guess she didn't really like me that much. The girl who I thought liked me and was only a few towns away back home doesn't respond anymore either. The girl who I was opening up to made some moves with one of my better friends and screwed his life up. And thats all just within the last few weeks or so. Its pretty fantastic. And before that? Dating someone for the sake of dating and not for actual feelings. Ended that badly and really hurt her, though shes alright now. And before that? Being led on by a girl who became a really good friend, but who still led me on after a brief fling. And before that? 2 or so years of loneliness, trying to recover from losing the girl who I had devoted everything to, who I'm still not over. And that was, I don't know, 4-5 years ago? My life is pretty fantastic it seems.

And the best thing is? It's pretty much imposible for me to have any sort of relationship anymore. Because the kind of relationship I want, is a longterm one, because those are what I do best, and I like being with a girl who I can tell I love and know that in a few months, we'll still be together. But I can't do that, school doesn't permit that kind of bullshit. A few months home, a few months at school, back and forth. Back and forth. No car means I cant come home to visit anybody I would date here. And work and the demands of life means that whoever was back home wouldn't be able to come up to visit me. And we all know how well keeping a relationship alive over the phone goes.

I feel like I'm just stuck in a loop. Spiralling down into a hole, and then suddenly I'm at the toplevel again, but I can see the hole again and I'm falling, spiralling over and over and over. Never escaping, no new swirls injected into my feedback loop to mix things up for the better. And then when I do open up to let something new in, I get screwed again. Is it so bad to want to be loved like everyone else? Watching the people who have what I want screw it up or renonce it because they're tired of it and want to be single again, or whatever reasons they think up. Is awful.  I'm hoping things will be different after school, when I have a career, a well paying job. Everything like that. Maybe my luck will change. Maybe getting away from these people who hurt me, and tear me apart inside will do me some good.

I'm on vacation, but so far this vacation has brought up more drama in me than the entire semester so far. When I'm home, it seems the drama is in abundance. At school? Theres no drama, no problems besides some tests and maybe wondering about if I should try to date someone for 3 months while I'm in school. Maybe I'm better off getting away from all these people who I consider my friends. Maybe the reason college kids drift away from their old childhood friends is because they realize that all those memories with them are dead weight. Yeah its fantastic to have friends who have that deeper understanding of what you've been through. But, I don't know. Maybe I just want to move on to something better.

I think I made the playlist I made last night well. It's titled: Alone. And is 2.4 hours of songs that reflect the mood I'm in right now.
Hyper Chondriac Music -Muse
Everything reminds me of her -Elliot Smith
Escape - Muse
Asleep - The Smiths
You're not sorry - Taylor Swift
Man in the mirror - Michael Jackson
Oscillate Wildly - The smiths
Dancing with Tears in my Eyes - Ke$ha
Endlessly - Muse
Little Lion Man - Mumford & Sons
Under the Bridge -Red Hot Chili Peppars
Con-science - Muse
Street Spirit -Radiohead
I will - Radiohead
Dead Hearts - Stars
Please Don't tell her - Jason Mraz
I know its over - the Smiths
Honestly - AMerican Footbal
Du Erkennst Mich Nicht Wieder -Wir Sing Helden
Tied Together with a Smile - Taylor Swift
Host - Muse
Blindness - Metric
Ohne Dich - Rammstein
Я твоя не первая - Tatu
Last Kiss - Taylor Swift
Last Night I dreamt that somebody loved me - The Smiths
Bist Du Nicht Mude - Wir sind Helden
Thinking about you - Radiohead
Can't Smile without you - Barry Manilow
Goodnight Goodnight - Maroon 5
Muscle Museum - Muse
Wo Bist Du - The Rammstein
The Untitled (In the End) - Linkin Park
To Live is to Die -Metallica

Thursday, March 3, 2011

Radar Tracking Turret!

I came up with a new idea to code! It will probably take up a good chunk of my nights during spring break

I simple turret that tracks and fires at objects in its pinging field, in 2d space. Once I get that working, I'll think about working in 3d space.

Here are a couple of my sketches for ideas:










ok, so the first image is how the ping system will work. The second is how the pings data will be used to determine the vector of the object being targeted. and the last is how the turret will estimate where to fire.

So this is how I plan to do it. No code yet!
Have the turret object which will hold its own cordinates in its plane, its angle of firing and a pointer to its projectile loaded.
The projectile object will have a velocity and x,y cordinates. (once I move to 3d space it will have mass and other things)
The target will have an x,y and a velocity and theta for movement.
Then there is the collections object that will store all these things. this will be used by the pings sent out by the turret to let the turret know the location of the target object.

A few of the details still need to be worked out. But I've got enough that I can start a basic console prototype

Wednesday, March 2, 2011

OCaml Pattern Matching and etc.

I've a midterm tomorrow, in 3 classes. Anyway, calculus isn't hard. German will be alright. But programming languages, not that it will be hard, but just.... Ok so, we're allowed to use our notes we've taken in class as well as the daily summaries that he has given us in the past. Unfortunately, I've been taking all my notes in LaTeX on my computer. Which means I need to print them. Which means I need a printer, which means I needed to get my roommate to print it out. Which means I went and did something fun and asked him to do it. I came back a while later, and bam. Thirty Five Pages. THIRTY FIVE BLOODY PAGES of notes. Granted that's for the entire first half of this semester. But... It's computer paper! Formatted! To what looks like 10 size font. That's a lot of characters. Plenty of bits.

Anyway, besides that, I've just completed programming a reverse polish notation calculator in OCaml. The powers of pattern matching are spectacular. For anyone who has never programmed in Objective OCaml, I'd recommend attempting to. The type system is very nice, even if trying to figure out your error messages is a pain in the ass. I normally love my C++ but I do enjoy OCaml's elegance factor.

This semester seems like it's been quite a jump in what I've learned as far as CS goes. Before this semester I had no idea how to use php, javascript, server side includes, ocaml, unix file commands, batch file commands, and some directX code. Its a trend I would like to keep, this upward mobility of my learning. I like.

Tuesday, March 1, 2011

Midterms

Welcome to midterm hell.

Okay, it's not that bad, but its pretty bad. Last week I had my Data Structures and Algorithm's midterm, of which I managed to botch spectaculary. Why would I spend so much time studying tree rules on rotation when he said he was going to give us those? Who know. I suppose I was just dumb, anyway, I totally spaced out on how to convert a ternary tree to a binary tree (inorder traversal adding it along the way btw) and probably screwed up somewhere in the big O notation section. It's unfortunate. But thats the only midterm I've taken. Why? with spring break so close?

Because all my damn tests in every other class are on Thursday. That's right! Calculus at 8:30, German 2 periods after that, and then Programming Languages a few periods after that. And then to top it off, I get to go to my diversity requirement class (also known as YOU-ARE-A-RACIST-DICK-CONFESS-IT) where the teacher will proceed to try to make you feel like shit. 3 tests and an amoral beatdown? Certainly what I want for my thursday...

And they wonder why college kids start drinking on thursday nights