Ask Your Question

How to import service file (.srv) in a python node?

asked 2020-01-21 03:10:13 -0600

ehsan_amp gravatar image

I want to import .srv file from another package into my python node. How can I do that? Thanks in advance.

edit retag flag offensive close merge delete


Can you specify what you already tried, what is not working (and provide the resulting error messages) please ? There are already multiples topics about this on this site, have you tried searching on google with import service ?

Delb gravatar imageDelb ( 2020-01-21 03:55:16 -0600 )edit

And is this a duplicate of #q342113 ?

Delb gravatar imageDelb ( 2020-01-21 03:56:34 -0600 )edit

@Delb Thanks for your answer. Yes, I wanted to call a predefined service as I explained in #q342113. I will write it down as an answer.

ehsan_amp gravatar imageehsan_amp ( 2020-01-21 07:55:10 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-01-21 08:04:20 -0600

ehsan_amp gravatar image

I Found the problem and each time I compiled the code, it couldn't found the .srv file. when I wanted to import a service file from another package into a python node, I should first write the package name and the folder name inside that. After that, I use the file name for importing. Like:

from dynamixel_controllers.srv import TorqueEnable

dynamixel_controller is the name of the package that I want to import file from that and inside the folder srv there is a file named TorqueEnable.

edit flag offensive delete link more

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: 2020-01-21 03:10:13 -0600

Seen: 25 times

Last updated: Jan 21