c++ or python
I am currently using python to make stuff in ROS, would it be worthwhile to learn cpp? Are there things you can't do with python? Is it easier to program things with c++?
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org |
I am currently using python to make stuff in ROS, would it be worthwhile to learn cpp? Are there things you can't do with python? Is it easier to program things with c++?
I'll add something to @aak2166 answer.
Some library you might want to use are going to be exclusively in Python or in CPP. For example, as far as I know, PCL is only in C++ so if you want to use it, you will have to learn C++. Smash is only in python.
So it depend as well on your project but knowing both is certainly an advantage since you won't be limited by this.
Python is used for some modules that don't need fast speed. However, python is easier to be used. I think the combination of Python and CPP could lead to more work efficiency.
Regarding performance keep in mind that a lot of C++ library (like OpenCV) can be used in Python without loss of performance since they are not executed by Python interpreter. I made some tests with face detection comparing performance between C++ and Python and I did not find significant differences.
My usual approach is to use Python for small integrations and for proof of concept taking advantage of its simplicity and switch to C++ only if this can results in performance improvements.
Python is an easier language to learn and master. The main advantage that a compiled language like c++ has is speed. For example, it might take you two weeks to program something in c++ but only 4 days in python. However, once you create that program in c++ you can expect it to execute faster (depending on the application) by about an order of magnitude.
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2015-05-02 11:40:08 -0500
Seen: 6,896 times
Last updated: May 04 '15