ROS Service Server/Client

../../../../_images/ros_service_client_server1.png

Within a Gazebo Plugin GenericDomainModel, a ROS Service Server or Client is represented by a GenericDomainModelPort with the following Attributes.

Attributes Value Description
Type service  
Attribute 0 [default service name] Default ROS Service name
Attribute 1    
Attribute 2 [msg type] ROS Service Msg Type - e.g. Trigger
Attribute 7 ros  

If the CyPhy Master Interpreter is run, these Attributes will be used to populate the parent Gazebo Plugin Model’s corresponding gazebo element in the generated ROS .urdf file.

For each netlist of connected ports, the Interpreter will check that the the port types all match (e.g. a ROS Topic Publisher cannot broadcast to a ROS Service Server) and that the Service Msg types (if specified) all match.

If the port is connected to other ports, a unique ROS Service name will be generated and assigned to ports in that netlist.

Otherwise, Attribute 0’s Value will be used.

The ROS Service Client or ROS Service Server GenericDomainModelPort’s name is used as a key to populate the Gazebo Plugin GenericDomainModel’s connected template file Resource with the ROS Service name.

Example ROS Service Client GenericDomainModelPort

../../../../_images/example_ros_service_client.png

Example Template Resource

<robot>
  <gazebo>
    <plugin name="example_plugin" filename="libexample_plugin.so">
          <rosServiceClient>${ROS Service Client}</rosServiceClient>
      ...
  </gazebo>
</robot>

Example Generated URDF

<robot>
  ...
  <gazebo>
    <plugin name="example_plugin" filename="libexample_plugin.so">
          <rosServiceClient>example_service</rosServiceClient>
      ...
  </gazebo>
  ...
</robot>