Main Content

rosservice

Retrieve information about services in ROS network

Description

rosservice list returns a list of service names for all of the active service servers on the ROS network.

example

rosservice info svcname returns information about the specified service, svcname.

example

rosservice type svcname returns the service type.

example

rosservice uri svcname returns the URI of the service.

example

svclist = rosservice("list") returns a list of service names for all of the active service servers on the ROS network. svclist contains a cell array of service names.

example

svcinfo = rosservice("info",svcname) returns a structure of information, svcinfo, about the service, svcname.

example

svctype = rosservice("type",svcname) returns the service type of the service as a character vector.

example

svcuri = rosservice("uri",svcname) returns the URI of the service as a character vector.

example

Examples

collapse all

Connect to the ROS network. Specify the IP address of your specific network.

rosinit('192.168.17.128')
Initializing global node /matlab_global_node_23375 with NodeURI http://192.168.17.1:64875/

List the services available on the ROS master.

rosservice list
/camera/rgb/image_raw/compressed/set_parameters
/camera/set_camera_info
/camera/set_parameters
/depthimage_to_laserscan/set_parameters
/gazebo/apply_body_wrench
/gazebo/apply_joint_effort
/gazebo/clear_body_wrenches
/gazebo/clear_joint_forces
/gazebo/delete_model
/gazebo/get_joint_properties
/gazebo/get_link_properties
/gazebo/get_link_state
/gazebo/get_loggers
/gazebo/get_model_properties
/gazebo/get_model_state
/gazebo/get_physics_properties
/gazebo/get_world_properties
/gazebo/pause_physics
/gazebo/reset_simulation
/gazebo/reset_world
/gazebo/set_joint_properties
/gazebo/set_link_properties
/gazebo/set_link_state
/gazebo/set_logger_level
/gazebo/set_model_configuration
/gazebo/set_model_state
/gazebo/set_parameters
/gazebo/set_physics_properties
/gazebo/spawn_gazebo_model
/gazebo/spawn_sdf_model
/gazebo/spawn_urdf_model
/gazebo/unpause_physics
/laserscan_nodelet_manager/get_loggers
/laserscan_nodelet_manager/list
/laserscan_nodelet_manager/load_nodelet
/laserscan_nodelet_manager/set_logger_level
/laserscan_nodelet_manager/unload_nodelet
/mobile_base_nodelet_manager/get_loggers
/mobile_base_nodelet_manager/list
/mobile_base_nodelet_manager/load_nodelet
/mobile_base_nodelet_manager/set_logger_level
/mobile_base_nodelet_manager/unload_nodelet
/robot_state_publisher/get_loggers
/robot_state_publisher/set_logger_level
/rosout/get_loggers
/rosout/set_logger_level

Shut down the ROS network.

rosshutdown
Shutting down global node /matlab_global_node_23375 with NodeURI http://192.168.17.1:64875/

Connect to the ROS network. Specify the IP address of your specific network.

rosinit('192.168.17.128')
Initializing global node /matlab_global_node_09263 with NodeURI http://192.168.17.1:65083/

Get information on the |gazebo/pause_physics| service.

svcinfo = rosservice('info','gazebo/pause_physics')
svcinfo = struct with fields:
    Node: '/gazebo'
     URI: 'rosrpc://192.168.17.128:52059'
    Type: 'std_srvs/Empty'
    Args: {}

Get the service type.

svctype = rosservice('type','gazebo/pause_physics')
svctype = 
'std_srvs/Empty'

Get the service URI.

svcuri = rosservice('uri','gazebo/pause_physics')
svcuri = 
'rosrpc://192.168.17.128:52059'

Shut down the ROS network.

rosshutdown
Shutting down global node /matlab_global_node_09263 with NodeURI http://192.168.17.1:65083/

Input Arguments

collapse all

Name of service, specified as a string scalar or character vector. The service name must match its name in the ROS network.

Output Arguments

collapse all

Information about a ROS service, returned as a character vector.

List of available ROS services, returned as a cell array of character vectors.

Type of ROS service, returned as a character vector.

URI for accessing service, returned as a character vector.

Version History

Introduced in R2019b

See Also

|