[ROS Q&A] 058 - Service global name error

Опубликовано: 01 Март 2026
на канале: The Construct Robotics Institute
499
2

More ROS Learning Resources: https://goo.gl/DuTPtK
Q: I'm having a lot of troubles doing the following in ROS: I would like to subscribe to a fakeARpublisher and resend a pose information through a service. In short, I did a script that it is subscribed to a topic and at the same time acts like a server for a service called LocalizePart. The code is given below:

A: Hello,

I had formatted your code got something like this:

Finally, I've reproduced your problem and concluded that to solve it you only have to import the server response library.

ROS creates 3 classes for each service message: Service definition, Request message and Response message. You should take a look here: http://wiki.ros.org/rospy/Overview/Se...

Following the code I've posted, I had just to replace this:

from myworkcell.srv import LocalizePart

with this:

from myworkcell.srv import LocalizePart, LocalizePartResponse

I hope it can help you!

--------Want to learn ROS really FAST and master the latest Robotics topics?----------
::Visit Robot Ignite Academy, the online Academy that teaches you ROS really FAST, from beginner to master, using only a web browser:https://goo.gl/LBT7EN
Robot Ignite Academy is an integrated ROS learning platform which contains a series of online ROS tutorials tied to online simulations, giving you the tools and knowledge to understand and create any ROS based robotics development.

----------Are you a ROS expert and want to develop FAST your next ROS project?----------
:: Then, use the ROS Development Studio (RDS) for your next project:https://goo.gl/EtFqmEWith the ROS Development Studio, you will be able to:
Develop ROS programs for robots in a faster way, with an already setup IDE environment that includes autocomplete. - Test the programs in real time on the provided simulated robots. Use the provided simulations or upload your own. Quickly see the results of your programming.
Debug using graphical ROS tools.
Test what you have developed on RDS in the real robot (if you have it :wink: all of these are using ONLY a web browser without any installation and not limited by any operating system. DEVELOP FOR ROS USING WINDOWS, LINUX OR OSX.