1
$\begingroup$

What's the difference? I see my service in rossrv list but not with rosservice list.

From ROS wiki

• rossrv: displays information about .srv data structures.

• rosservice: lists and queries ROS Services

There's an abridged tree structure of the files below this text for clarity.

I have catkin_ws/src/simple_arm/srv/GoToPosition.srv that I see when I run

$ rossrv list
...
simple_arm/GoToPosition
...

However, my request handler is in catkin_ws/src/simple_arm/src/arm_mover.cpp and I only see it in rosservice list as

$ rosservice list
...
/arm_mover/safe_move
...

Why can't I see /arm_mover/safe_move under rossrv list if it is a service? And the inverse with simple_arm/GoToPosition?

$ tree
.
├── build
│   │   ├── setup.bash
│   ├── catkin_generated
│   ├── first_package
│   ├── simple_arm
│          ├── arm_mover.dir
├── devel
│   ├── include
│   │   └── simple_arm
│   │       ├── GoToPosition.h
│   │       ├── GoToPositionRequest.h
│   │       └── GoToPositionResponse.h
│   ├── lib
│   │   └── simple_arm
│   │       ├── arm_mover
│   │       └── simple_mover
└── src
    ├── CMakeLists.txt -> /opt/ros/melodic/share/catkin/cmake/toplevel.cmake
    ├── first_package
    │   ├── CMakeLists.txt
    │   └── package.xml
    └── simple_arm
        ├── CMakeLists.txt
        ├── config
        │   └── controllers.yaml
        ├── images
        │   └── simulation.png
        ├── launch
        │   ├── robot_control.xml
        │   ├── robot_description.xml
        │   └── robot_spawn.launch
        ├── LICENSE
        ├── meshes
        │   └── camera.dae
        ├── package.xml
        ├── README.md
        ├── src
        │   ├── arm_mover.cpp
        │   └── simple_mover.cpp
        ├── srv
        │   └── GoToPosition.srv
        ├── urdf
        │   ├── simple_arm.gazebo.xacro
        │   └── simple_arm.urdf.xacro
        └── worlds
            └── willow_garage.world
$\endgroup$

1 Answer 1

3
$\begingroup$

The difference is that rossrv is a tool for inspecting service types (i.e. .srv files), while rosservice provides access to running services. So for example, when you call rossrv list it will show what service types are known in the current workspace, while rosservice list shows the names of the services currently running.

In your case, the service type is simple_arm/GoToPosition and the running service name is /arm_mover/safe_move, so logically the former shows up in rossrv list and the latter in rosservice list.

Another way to explain the difference between both tools is to think of rossrv as the service equivalent of rosmsg, and of rosservice as the service equivalent of rostopic. Just like rosmsg is concerned with message types and rostopic with topics to / from which messages are published / subscribed, so does rossrv is concerned with service types and rosservice with endpoints from which services can be called.

$\endgroup$
1
  • $\begingroup$ True. The .srv file just shows what types can go into requests and responses so it is like rosmg. $\endgroup$ Apr 13, 2020 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.