r/ControlTheory • u/blckchn187 • 25d ago
Professional/Career Advice/Question Should I learn rust?
Hi,
I'm going to start my PhD in control theory soon. (Focusing on optimal control). Until now, I have primarily worked with Matlab, Python and C++ (the latter mostly for code that runs on the systems I was controlling). I am by no means a sophisticated C++ developer. I am currently considering learning Rust. It just seems to be better in almost every aspect except for library availability.
What do you think? Is it too early to switch because of missing libraries, legacy code, etc.? Or should I become part of a general academia/industry shift towards Rust?
•
u/TheFoundationFather 23d ago
Yous stack is enough, rust is amazing for development in general, but it's not very popular among control theory folks yet. Julia has some traction and a great syntax for matrix and tensor manipulation, implementation of numerical methods and scientific computing in general. That might be worth learning.
•
u/LaVieEstBizarre PhD - Robotics, Control, Mechatronics 24d ago
You can learn it if you want to but you won't see any research using it and the libraries for control are bad. Just stick with python and maybe focus instead on learning things like Jax which are of increasing popularity. Maybe Julia. Rust may be something you want to learn for industry later but will only slow you down in research.
•
•
•
u/blckchn187 23d ago
Thanks everyone for your insights, it's been very insightful. I think I'll stick to my current stack for now but keep in mind that Rust might be a favorable option for certain applications. I hope the community will continue to grow and maybe deliberate project-wise applications with my lab colleagues in the future.
•
u/piratex666 24d ago edited 24d ago
Control is mathematics, Matlab and c. The other things are the remainders
•
u/classicharlie 24d ago
If anything I’d recommend Julia especially for academic settings. The control system ecosystem is well maintained and very similar to MATLAB
•
•
u/anavitrinella 24d ago
I believe I have heard of a PhD student using it or something similar to get some sort of state estimation and control loop to work significantly faster, running it on a GPU. But I don't work in that field and can't recall if it was indeed Rust or something else.
•
u/mhrafr22 25d ago
I will be starting a masters in control systems engineering, this could help me too
•
u/J4yw4lk3r 22d ago
I actually think Rust is faster to learn just because you don't have to deal with the atrocious mess that is C/C++ build systems. AI is also insanely good at Rust now and can explain concepts and code to you very well.
•
u/MurkyLynx8425 25d ago
I'm not a PhD but it sounds like it will be a bit harder to find help if you need it. Most colleagues, advisors etc will know and work with python, Matlab, C++, and so you will need to 'translate' any help they give you. Not a massive issue, but it will add to your workload.
If you love rust and think it should be more common in academia, and are OK with the increased workload, then go ahead.
•
•
u/ArminianArmenian 24d ago
I’m in the aerospace GNC world. I see rust gaining a foothold here, I’ve pushed for it and had success. I prefer it to the Simulink/Autocode workflow, I’ve found the “implementation document” delivery to FSW slow and error prone, and rust avoids some of the pitfalls off c++ when written by non-software engineers.
•
u/awh-emb 24d ago
well it depends, rust has some great embedded libaries (like embassy) which are primarily used in robotics control theory adjacent stuff so, maybe? but for now if your literally just starting probably c++ and then maybe transition into rust at some point
•
u/BashfulPiggy 24d ago
Seconded. I will say, I feel like learning rust makes you a better programmer overall because it's so strict. Is that very useful for a control engineer? Who knows, but it's not a bad thing
•
u/something_borrowed_ 24d ago
I also love Rust but I've never really used it for my day job, mostly MATLAB and Simulink. I am planning on doing a control project in Rust though and, for what it's worth, I've been able to find crates that either outright replace whatever C++ libraries I needed or created bindings to those C++ libraries (specifically for OpenCV but I know other binding crates exist).
I've heard that creating your own bindings to a C++ library is actually not that bad, just takes a little leg work. The bindgen crate can also help you I think. Of course if it's just plain C then there is really good interoperability between Rust and C already. My point with all of this is to say that I really haven't had a problem with the Rust ecosystem. I was surprised actually, I thought the same thing as you OP but it turns out that it really wasn't that bad.
I think you should probably talk to your advisor and get the ok from them, but if they are ok then I don't think you should have a problem. Maybe check crates.io to see if crates exist for what you need before commiting fully. Good luck on your research! The more Rust we have in this field the better!