Python -- why or why?

Hi

OK, not specifically concerned with PiBorg products but...

Can anybody explain to my why Python is so entrenched in the Raspberry Pi world? I mean, in an embedded, resource-constrained device, surely a programming environment that is interpreted and requires a 200Mb runtime system is one of the worst possible choices?

This rant was occasioned by trying to find programming examples for the Pi Camera module, and there being nothing except in bloody Python :/

Best wishes
Kevin

piborg's picture

As a C programmer by trade I completely understand your fustration...

Put simply the Raspberry Pi Foundation has made a large effort towards making everything on the Raspberry Pi easily operable from Python.
Their aim is to get people with no experience in programming started, hence the choice of a neewbie friendly language.

For this reason most of our examples are also in Python as it makes them easy to read and edit for those who do not have a strong grasp on programming yet.
We have however made a couple of examples in C as well, unfortunately these have been centred around the I2C bus control and not the camera module.

I am not sure if this will help you but there is someone who has made a C++ library for accessing the camera: http://www.uco.es/investiga/grupos/ava/node/40

Thanks. I wasn't really expecting you to solve all my problems, but the sympathy is welcome.

I tried the camera library you suggested and, while it works just fine, It uses an awful lot of CPU. I suspect it's doing something in code that the python library is able to do in the GPU or something like that. I raided the source for raspistill for inspiration, but it was just about incomprehensible. Oh well, I'll just have to do the camera capture bit in python -- not the end of the world.

sigpaw@hotmail.com's picture

Although I see constructs from more than a couple of different languages in Python. It generally "feels" C-ish. Doesn't seem that much of a stretch to transpose the Python in bits and pieces, over time to C. That's been in the back of my mind from the start.

I'm also wondering about patching Jessie's 4.1 kernel with RTAI - although they currently only support up to 3.8.xx kernels. I would love to have a true deterministic RT thread attribute to schedule my robot's functions under.

Anybody know - have the low latency/rt preempt patches been migrated to anything other than i-386?

I got my DiddyBorg running on Windows 10 IoT core and a C# port I did of the python code for PicoBorg Reverse, pretty easy. I think I fried the I2C controller or something though, by setting the bus speed to fast, but that's another thread.

Subscribe to Comments for "Python -- why or why?"