Ask Your Question

can i use python with ros_control package ?

asked 2018-06-26 11:09:07 -0600

karim gravatar image

Hello there,

I am building a custom robot and i need to use ros_control to take advantage of it's functions, I am used to writing in Python and not C++ but the implementation of ros_control is in C++ and I am not very proficient with it, so is there's a way to use Python instead or how can I deal with this situation ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-06-26 11:11:52 -0600

gvdhoorn gravatar image

updated 2018-06-26 11:13:12 -0600

is there's a way to use Python instead

No, unfortunately not.

Edit: well, it depends actually. What do you want to do exactly? Communicate with a ros_control based robot (ie: send trajectories and setpoints), or write your own controllers and/or hardware_interface implementations? The former is perfectly possible with Python, the latter basically requires C++ (although it could be interesting to see whether something like boost::python could be used).

edit flag offensive delete link more


I want to write the hardware_interface in python, I am using a RPi so it would be perfect for me if I could do so

karim gravatar imagekarim ( 2018-06-26 11:26:25 -0600 )edit

Then the 'default' answer would be: no, you cannot use Python for that.

If you feel adventurous, and know what you are doing, you could see whether boost::python in combination with the c-api would work. ..

gvdhoorn gravatar imagegvdhoorn ( 2018-06-26 11:40:39 -0600 )edit

.. You could write a very simple hardware_interface implementation that essentially forwards all calls to a Python module that is loaded and interacted with using the c-api.

But to get that hardware_interface in place, you'd have to use C++, so perhaps this is a catch-22.

gvdhoorn gravatar imagegvdhoorn ( 2018-06-26 11:42:12 -0600 )edit

awesome, I will see what can I do and tell you if I got positive results :)

karim gravatar imagekarim ( 2018-06-26 11:52:09 -0600 )edit

As I wrote: you're going to have to use C++ to be able to integrate the Python stuff, so I'm not sure how much sense all of this makes, but ok.

gvdhoorn gravatar imagegvdhoorn ( 2018-06-26 14:47:49 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-06-26 11:09:07 -0600

Seen: 435 times

Last updated: Jun 26 '18