0
$\begingroup$

Rosanswers logo

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


Originally posted by ehsan_amp on ROS Answers with karma: 33 on 2020-01-21

Post score: 0


Original comments

Comment by Delb on 2020-01-21:
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 ?

Comment by Delb on 2020-01-21:
And is this a duplicate of #q342113 ?

Comment by ehsan_amp on 2020-01-21:
@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.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by ehsan_amp with karma: 33 on 2020-01-21

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.