I mentioned in my last post that I had ordered a VL53L0X sensor to have a look. It was really just curiosity; I’d pretty much decided I would just use the cheap sonar sensors. But my VL53L0X turned up during the week, and I hate to say it, but I’ve fallen in love with it. First off, it’s tiny – see the pic. And then I installed then I installed the software from ST Electronics and Mathieu Cassard and it just worked. I have a great love for things that just work straight out of the box – makes my life so much easier! But… all this code was written in C, and all my robot control is written in Python. Three choices: translate the C to Python, translate the Python to C, or interface the two.
Given that my son has only just started learning Python, I didn’t really want to shift to C (even though personally I’m far more comfortable with C than Python). It wouldn’t be too hard to re-write the C in Python – indeed there’s already at least one repository on GitHub that has partially done it. But C should be more efficient than Python, so I decided to look at how easy it would be to interface the two. A bit of digging about led me to ctypes – a foreign function library for Python. It requires dynamically-linked libraries, and the code from Mathieu Cassard creates a static one. Digging in the depths of my memory (it’s been quite a few years since I was an active C programmer!), I remembered how to do this, and then was able to load it in Python (with the aid of ctypes) and use its functions. I do need to do some more extensive testing of it, but I’m pretty happy that it seems to work. (And in any case, there’s always the fallback position of rewriting the C code in Python.)
So I have another 3 of these cute little sensors due to be delivered today. Far more elegant than the sonar sensors. And next weekend, I should be able to do some work on straight line speed and maze 🙂
Meanwhile, the rest of the team were considering the skittles competition. When we registered, I said we weren’t sure about that one, but with the power issues solved, and the driver confident about his driving skills, they were ready for another challenge. So they spent the weekend considering ball-firing options. I don’t think they’ve settled on a solution yet, but it’s looking like we’ll be doing this one too.
And we also need to add our bling… I have a mote set that I would like to use for this. One of the nice things about this kit is that you can add an external power source for the motes, so I’m hoping that if the kit does put too much strain on our power supply, I can just use this option. But I would also like to get some fancy light-work going, coordinating with what the bot is doing. That’ll be my (and littlest team member’s) challenge after the autonomous challenges are sorted.