ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

which I should use python or c++?

asked 2019-01-01 02:16:56 -0500

fusiana gravatar image

I would like to make robot in hobby, but in the first place I wondering what I should use as language.

I read that python is slow in motion than by c++. How fetal It slowness is in actual and in future Is will not it disadvantage fix?

edit retag flag offensive close merge delete



Whichever you're more comfortable with

jayess gravatar image jayess  ( 2019-01-01 11:35:01 -0500 )edit

ROS wiki provides pretty educational tutorials for both c++ and python. It is just the matter of which language you've got experience or comfortable with, either with syntax or compilation!

Farid gravatar image Farid  ( 2019-01-02 05:18:55 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-01-02 08:10:19 -0500

The biggest factor to influence your choice as has been said is which language you're most comfortable with. If you're relatively new to both languages I would highly recommend python, the C++ code that is used when using ROS is quite advanced using many complex features of the language.

Another thing that should be considered is that the ROS python API is slightly more restrictive than the C++ API. If you're getting started with ROS and working on hobby projects then this limitation of python will probably not effect you, but it's worth bearing in mind if you move onto more advanced projects.

Regarding your question about speed. The speed of python will only effect you if you're writing your own complex algorithms in python. Using the python API all the ROS functions will still be executed using fast compiled C++ versions, only your own code will be executed using the python interpreter.

Hope this helps you make and informed choice.

edit flag offensive delete link more

Question Tools



Asked: 2019-01-01 02:16:56 -0500

Seen: 467 times

Last updated: Jan 02 '19