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

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

Comments

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 site:answers.ros.org import service ?

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

And is this a duplicate of #q342113 ?

Delb gravatar image Delb  ( 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 image ehsan_amp  ( 2020-01-21 07:55:10 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
2

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

Question Tools

1 follower

Stats

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

Seen: 1,788 times

Last updated: Jan 21 '20