I'm starting a project that involves using AI and machine learning to control physical hardware in real time. My setup will include inputs like cameras for object identification, and I need reliable languages for this. I'm currently leaning toward Python because of its numerous libraries for AI and machine learning and my familiarity with it. However, I'm concerned about its efficiency since the project requires quick reactions from the software. Any suggestions on the best languages to use or advice on my current choices?
3 Answers
In a similar project, I used Java combined with a JNI serial interface with C++ for hardware control. These days, Java can be compiled into a native executable, which helps with size and speed. It’s definitely a viable choice if you consider alternatives!
While Python works well for high-level logic, it’s not the best for low-level machine learning tasks or tight hardware control loops. Many use Python for AI because it handles the high-level code easily, but the heavy lifting often happens in C/C++. If your project needs rapid responses, C/C++ is better for those critical functions. However, if your hardware is already set up to respond in real-time, Python can definitely handle the simple commands like 'move forward 10 centimeters'.
Python is typically fine for prototyping, especially since its overhead isn't usually a big deal for many applications. I’ve also heard good things about Rust, though it's not as mature as Python or C++. My suggestion? Start with Python for your initial tests, and if you find performance lacking, you can always switch to C++ later on.

That's a good point; using different languages for different components makes sense. I hadn’t thought about that before, but it seems practical since the modules would just communicate back and forth!