RC car parts

I found some old RC car parts tonight. I think I can safely throw away the transmitter. But I might be able to use the servos for some testing. I’m charging the battery, although I’m not sure how to test it nor what I would use it for.

Anyone have experience wiring up the OpenMV M7 camera to some servos? I’m still wondering why I need the servo shield if I only have 2 servos and 3 are available on the board.

RoboCar Start

I recently joined a local (Omaha) group that plans on creating and racing autonomous cars. It got its inspiration from diyrobocars.com. I bought an OpenMV M7 camera off of SparkFun on CyberMonday and received it yesterday.

Read the instructions first

OpenMV has documentation on how to set up the hardware and software. I didn’t realize there were some things that I should have done before diving in. The first was to clean the camera IC. I did this later and I don’t think it helped in any way. The second was updating the firmware which did help. One thing that kept giving me errors when running the hello world script was that it was complaining about the time variable passed in to the skipframes function. The old firmware didn’t support the named parameter. All I had to do was delete the name and it worked. But after updating the firmware the name was accepted.

Another thing that puzzled me at first was why the image was not in focus. Well, had I read the instructions I would have learned that I had to twist the lens to focus it.

I wish the instructions had pictures because I was too afraid to remove the lens housing. I wasn’t 100% sure it was the entire black piece. It wasn’t until I found some images on this GitHub page that I was confident enough to take it off.

MicroSD Card

I need a microSD card. There are a lot of example programs that can save images but only if you have an SD card. I couldn’t even get the DonkeyCar program to run. It would just sort of hang and then disconnect the camera. At this point, I think it has to do with the size of the program.

Not All Screwdrivers Are Created Equal

Why would one screwdriver work for the lens mount screws not work for the focus screw? Also, the screw to hold on the lens took more force than I thought was necessary. Perhaps it needed to create threads in the plastic, but I had to tighten the screw before the lens wouldn’t move.

Questions

Do I need a separate servo “shield” if the board already has servo controls? It’s been about 20 years since I learned pulse-width modulation so I need to read up on it.  During our meeting it sounded like I needed a separate board, but it looks like the camera supports it. Maybe that was for the Raspberry Pi version.

Template

I am sort of using this project as a template. But so far all I have is the camera. The RC car on the list is sold out on Amazon, but a similar car listed on a DonkeyCar page is in stock.

Soldering

I have never done any serious soldering. But to get the header pins on the camera I will have to. Or get someone from the group to do it.

Cleaning

Here are the supplies I used:

  • Isopropyl Alcohol
  • Screwdriver
  • Lens cleaning cloth

Supplies

Lens off

IC exposed

 

Speed of Trust

I am getting more convinced that the Stephen Covey idea of the “Speed of Trust” is important. Just today I wasted a bunch of time searching for a wiki page in the corporate network only to come to the conclusion I can’t find it because it is hidden from me. Why was I looking for it? To fix a misspelling. Something that would have taken 20 seconds ended up taking much longer. Because after I couldn’t find the page I had to screenshot the typo and send it to the owner (or someone with edit access to change it). How much would it have taken to trust me and add me to the list of people that can view that page?

Another example was during our deployment: if we trusted a step was done by another team we wouldn’t have wasted our time validating something they probably already validated.

Don’t pass null

A method declaration is a contract between the caller and the callee. And if the callee states the parameters then the callee should be responsible enough to not pass null. By passing a null you are breaking that contract and the caller should not expect the method to behave properly in this case. That is why I don’t check the parameters of my methods for null – if someone passes me a null, they should expect a NullPointerException.

If you are defining a method with an optional parameter, you should overload the method. The caller can then decide which contract they are going to make with the callee. It should be up to the caller to decide which behavior is expected. It shouldn’t be up to the callee to try to determine what the caller’s intention is.

If you are tempted to just pass null from the overloaded method to the second method to avoid code duplication, don’t! As soon as you do this you are doing 2 things: first, you are breaking your own contract by passing a null. Secondly, you are now tightly coupling 2 methods with different behaviors and expectations together. Instead, to avoid duplication, look at the commonality between the methods and pull out smaller, finer-grained methods.

Dvorak Keyboard Layout

I’ve been using the Dvorak keyboard layout for about a year now. But I’m thinking of switching back. Here are my reasons:
1. Human Compatibility
There are times it is inconvenient to have a different keyboard layout than other people. The most obvious is going over to another person’s computer to help him, be it a coworker, family member or someone else. What I didn’t consider happening is when others use my computer. I didn’t think there would be a use case, but it turns out there is. Coworkers come over to help or do something cooperatively. Or I might be logged into the computer in the conference room and they want to take over the keyboard for a moment. Sometimes, rarely I admit, I let my kids use my computer. All of these times it is a hassle having to switch keyboard layouts.
2. Passwords
I don’t know about you, but I often mistype passwords. And sometimes I have to look at the keys to convince myself I am hitting the correct keys. Well, that doesn’t work when the keys aren’t labelled correctly. And when I’m creating a new password, I want to make sure I am typing what I’m thinking because there will be times I need to type the same password using a QWERTY keyboard, such as at when a computer is booted. Rarely is the keyboard the Dvorak keyboard at bootup or login.
3. Application Compatibility
For whatever reason, Outlook does not like to use the Dvorak layout and I find myself having to use the keyboard setup icon in my tray to change it to use it. Another case that trips up the mapping is when I remote into my work computer (Windows) from my Mac. The layout turns out to be neither. I think some kind of double-mapping is taking place, where QWERTY is converted to Dvorak twice. This makes me have to change my Mac layout to QWERTY for the time I am logged in.
(Edit: Two more applications: games such as Terraria that use WASD for movement and vi which uses HJKL don’t map well in my head.)
4. Shortcuts
I am pretty used to having to reach when I cut and paste, but it is a reach and not nearly as easy and handy with QWERTY.
5. Speed
I’ve been using the Dvorak keyboard for a year now and I wouldn’t say my typing is any faster. The other reason I wanted to switch to Dvorak was to lessen the strain on my hands and possibly lower my chances of carpal tunnel. If that day happens, I’ll deal with it then.

Now, how long is it going to take me to switch back to QWERTY?

Thousands Separator

Thinking outside the box, there are more ways to indicate the thousands separator…

1000000
1000000
1000000
1000000

Not that it is currently possible to style it as such in an input element.

Unless you use ‘o’s for the zeros. That could be done:

10oo0oo

Those take up less space than adding a comma:

1,000,000

In monospace:

1,000,000
1000000
1000000
1000000
1000000

Why new developers should work on legacy applications and seasoned developers on new projects

or

Why my job sucks

My job sucks.

I’ve been moved to a different team again.

Evidently, I’m the shit-polishing guy.

Yes, the guy who loves taking large piles of crap and maintaining them.

Well, the co-workers, pay, benefits, etc., those are all fine. But it’s the work. It hasn’t always been that way, but lately I’ve been busy doing “technical evolution” (my boss’s words, not mine). What does this entail you ask? This is the work necessary to move very old applications off of unsupported hardware onto the currently supported and approved frameworks — read: not the latest and greatest; the stuff that has been approved for 5 years or so. And let me tell you, it isn’t fun. The technology is old. So old that I have to re-learn the stuff. (Throwback every-day-of-the-week anybody?) But that’s not the worst part. It’s the crappy code: poorly written monstrosities that I have to read.

I don’t think clean code was a thing back then.

What I see, and hopefully it is only at my job, let there be a god, is new programmers writing all of the code! New development must be the only way to lure new programmers. (I can’t think of any other reason at the moment.)

I see two reasons poor code is produced by inexperienced programmers.  The first is they don’t realize the importance of maintainable code, or, the second reason, they think they are writing maintainable code.

Let’s discuss the second reason first.

New developers write code that is easy to understand for them. They are under the misconception that the code they are writing is very easy to understand. This is usually because they are the only one looking at their code and it was very recently written. They don’t have the experience of what to do and not do. They don’t know what it means to develop code for maintainability.

Seasoned developers have seen many different projects and learned what works and what doesn’t work. They are more realistic about designing a system. They have witnessed the pitfalls and are less likely to make them.

To address the importance of maintaining code, I suggest “allowing” new developers to support legacy apps. They gain the experience and appreciation of what “bad” (and good!) code can look like and not make the same mistakes. (And at the same time they might gain some business knowledge!)

The other reason I contest my job sucks is because all the new developers get to write code using cutting edge technologies and frameworks and tools. I, on the other hand, don’t get the opportunity to work with this stuff except at home. (Whereas a new developer might not have the same time commitments outside of work and have the time to learn new stuff.) What’s this mean? I am falling behind the times and becoming less relevant.

In conclusion, let the new developers gain the appreciation for and the knowledge how to create maintainable code by maintaining apps and let the experienced developers write new code that the noobies won’t mind maintaining.