25 Dec

bot grasscutter progress

the robot so far

I spent today working on my robot (apart from the necessary hours spent trying to extricate the kids’ christmas presents from their fiendish wrapping). I got the grass cutting blade working.

For back story, I’m trying to build a robot which will do various things for me. For example, grass-cutting. I’m not trying to build a replacement for one of those 2000 euro robomower things. Instead, it’s a very small bot which will eventually do quite a few things.

Anyway – one thing I wanted was to have it take great care in what it does, and that means cutting each blade individually, mad as that may seem. It will eventually be able to decide whether a blade should be cut or not, for example I may give it an instruction “cut the marsh grass, but leave the ordinary stuff alone”.

So – today’s task was to build a blade that can grab a single blade and then cut it. I chose to build it as a kind of guillotine, instead of a scissors, which had been my plan before. I may change this at some time, but it works at the moment.

the blade mechanism

The guillotine was built with some wood, Meccano, elastics, and a blade taken from a craft knife. First, a hook was built by hacksawing into a Meccano spar such that it could be used to “catch” a blade of grass when turned just so. The blade was glued to a second Meccano piece and they were both placed in some wood such that a channel allowed the blade to slide forwards and back.

The blade is pulled back by an elastic, and forward by a wire which is controlled by a servo (ultimately controlled by an SD-21). The screw that you see there is for helping to push the blade down, so it doesn’t just wave about but actually slices the grass.

It took a while to get the right angle for the blade to slide along the bottom Meccano “hook” such that it was flush with the hook. If the blade is not flush, then the grass would just bend under the blade, and not get cut (an advantage for the scissors idea…). I ended up having to bend the hook itself, and it’s still not perfect.

After that was all set up, a servo was glued to the board and an electrical wire (*shrug*) tied to the blade. That screw you see on the servo’s turny thing is just so the wire can be pulled a bit further than the diameter of the turny thing.

17 Dec

drink, drink and be merry, for tomorrow we probably won't die

For years, I’ve had people telling me that I drink “too much”. And if you accept current recommendations as fact, then yes, I do. I like to have a pint on the way home from work, and sometimes have a can or two while relaxing at home. I don’t drive, and I rarely overdo it.

Anyway – I like to know what exactly I’m being accused of, so I tried researching what the limits are, and what happens if you break those limits. I came across some interesting information.

If you search online to find out what the limits are, you’ll see it written in many places as 21 units a week for males, and 14 a week for women. However, those numbers appear to have been pulled out of the air and contribute to “binge drinking” (“A lot of people think they can save up their units until the weekend–we are all guilty of that. . . . That’s where the problem lies.”).

Depending on the country, the limit is anywhere between 14 pints a week (USA) to 28 a week (Australia). Note that 28 is twice 14!

And what happens if you break that limit? According to statistics, people that drink up to five drinks a day have a lower mortality in all cases than people that don’t drink at all.

That’s incredible! To put it in other words, it is safer to have a few pints than to not drink at all. As an example, drinkers have half the risk of heart attack that non-drinkers have.

So, if someone close to you tells you to stop drinking because “it’s bad for you”, but you’re not overdoing it, tell them to back off – they are not in possession of all the facts.

03 Dec

prompt

I wrote some JavaScript today which required using a prompt() to request a number. The idea was that you have a table full of numbers, and want to change one. So, you click it, and a prompt() asks for the replacement number.

In Firefox, the prompt is a small modal window which has an ugly title saying something like “The page at http://localhost/…”.

So, I wanted to know is there a way to avoid it. I was hoping that prompt(question,value) had a secret third parameter that set the title.

Unfortunately not, but what I did find was even more annoying. the first hit for javascript prompt is a “tutorial” which is so derisive of the prompt() that I have no idea why the person bothered writing anything at all.

The JavaScript prompt is a relic from the 1990’s

The JavaScript prompt is not very useful and many find it slightly annoying, but hey, this tutorial is here to educate you, so let’s learn how to make that prompt!

You can use a prompt for a wide variety of useless tasks, but below we use it for an exceptionally silly task.

Good job, Tizag – I wonder if all your students (if any can stand the method of teaching) learn to treat JavaScript with the derision that you do. I bet you go to bed chortling at how clever your insults are and how the people that use JavaScript day to day are all idiots.

By the way, you’ve made a few incorrect statements.

The JavaScript prompt is a relic from the 1990’s that you seldom see being used in modern day websites.

Ever heard of Ajax? It involves a lot of user interaction. That sometimes involves requesting a value from the user. The way you do that is prompt(). Now, you /could/ write your own custom version of prompt(), but when it comes down to it, that’s just a prettier version of something that you claim is a relic.

The JavaScript prompt is not very useful

Except for those very common cases where you might require input of a single value.

many find it slightly annoying

[citation needed]

but hey, this tutorial is here to educate you

If education means teaching to sneer, belittle, and misunderstand, then you are correct.

The point of the JavaScript prompt is to gather information from the user so that the information can be used throughout the site to give the visitor a personalized feel.

No! The “point” of prompt() is in its name – it prompts the user for a value. What you do with the value afterwards is of no bearing at all to the function itself.

By the way, your “tutorial” doesn’t even say what the two parameters of prompt() do.

Fail.