I am learning ros noetic on the page (https://wiki.ros.org/rospy_tutorials/Tutorials/WritingServiceClient)In the scripts/add_two_ints_server.py file within the beginner_tutorials package, there is a line "from beginner_tutorials.srv import AddTwoInts,AddTwoIntsResponse". But I cannot find the beginner_tutorials.srv and I want to know what it is.
1 Answer
This is based on the assumption that you've completed previous Tutorials. See this line on your link:
"Please make sure you have followed the directions in the previous tutorial for creating the service needed in this tutorial, creating the AddTwoInts.srv (be sure to choose the right version of build tool you're using at the top of wiki page in the link)."
If you haven't done so, you would need to follow this tutorial first to create those custom services: https://wiki.ros.org/ROS/Tutorials/CreatingMsgAndSrv#Creating_a_srv
-
$\begingroup$ The tutorial content you mentioned only teaches how to create the AddTwoInts.srv file, instead of the beginner_tutorials.srv file. Where does the beginner_tutorials.srv come from? $\endgroup$ Commented Feb 21 at 13:30
-
$\begingroup$ Oh I see. I think that is just a syntax to tell python to import AddTwoInts and AddTwoIntsResponse from the package named
beginner_tutorials
. Looks like the only place that uses this syntax in the generated package is ./devel/share/gennodejs/ros/beginner_tutorials/srv/AddTwoInts.js $\endgroup$– jc_sysuCommented Feb 21 at 14:24